# Consent Requests

## The ConsentRequest object

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `consentRequest`. |
| `id` | string | Yes | Unique identifier for the consent request. |
| `createdAt` | string | Yes | The timestamp at which the consent request was created. |
| `deliveryMethod` | null | emailLink | sms | smsLink | smsOTP | Yes | The method by which the consent request is delivered to the user. |
| `expiredAt` | null,string | Yes | The timestamp at which the consent request expired. |
| `operation` | change.phoneNumber | change.provider | exchange.sim | issue.portOutCredentials | portin.subscription | Yes | The operation being requested. |
| `status` | approved | bypassed | canceled | expired | pending | Yes | The status of the consent request. |
| `subject` | string | Yes | The ID of resource being affected by the operation. It can be for example a port out ID, if the operation is `issue.portOutCredentials`. |
| `subscription` | string | Yes | Unique identifier for the subscription inferred from the resource associated with this consent request, e.g. a port-out, porting, or subscription change. |

---

## Retrieve a consent request

`GET /projects/{project}/consentRequests/{consentRequest}`

Retrieves a consent request by the given id.

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project` | string | Yes | The unique identifier for the [project](https://developers.gigs.com/core/projects#the-project-resource). |
| `consentRequest` | string | Yes | The unique identifier of the consent request. |

### Responses

#### 200 — Returns the consent request if it exists.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `consentRequest`. |
| `id` | string | Yes | Unique identifier for the consent request. |
| `createdAt` | string | Yes | The timestamp at which the consent request was created. |
| `deliveryMethod` | null | emailLink | sms | smsLink | smsOTP | Yes | The method by which the consent request is delivered to the user. |
| `expiredAt` | null,string | Yes | The timestamp at which the consent request expired. |
| `operation` | change.phoneNumber | change.provider | exchange.sim | issue.portOutCredentials | portin.subscription | Yes | The operation being requested. |
| `status` | approved | bypassed | canceled | expired | pending | Yes | The status of the consent request. |
| `subject` | string | Yes | The ID of resource being affected by the operation. It can be for example a port out ID, if the operation is `issue.portOutCredentials`. |
| `subscription` | string | Yes | Unique identifier for the subscription inferred from the resource associated with this consent request, e.g. a port-out, porting, or subscription change. |

#### 403 — The authenticated user doesn't have permissions to perform the request.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

#### 404 — The requested resource doesn't exist.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

#### 422 — The request can't be processed, often due to an invalid parameter or incompatible system state.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

---

## Approves the consent request

`POST /projects/{project}/consentRequests/{consentRequest}/approve`

Grants consent for the given request. This will trigger the consent
request to be processed and the request to transition to the
approved status. The consent request must be
in the pending status in order to be approved.

### Body

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | string | Yes | The OTP associated with the consent request, used to validate the given consent. |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project` | string | Yes | The unique identifier for the [project](https://developers.gigs.com/core/projects#the-project-resource). |
| `consentRequest` | string | Yes | The unique identifier of the consent request. |

### Responses

#### 200 — Returns the consent request.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `consentRequest`. |
| `id` | string | Yes | Unique identifier for the consent request. |
| `createdAt` | string | Yes | The timestamp at which the consent request was created. |
| `deliveryMethod` | null | emailLink | sms | smsLink | smsOTP | Yes | The method by which the consent request is delivered to the user. |
| `expiredAt` | null,string | Yes | The timestamp at which the consent request expired. |
| `operation` | change.phoneNumber | change.provider | exchange.sim | issue.portOutCredentials | portin.subscription | Yes | The operation being requested. |
| `status` | approved | bypassed | canceled | expired | pending | Yes | The status of the consent request. |
| `subject` | string | Yes | The ID of resource being affected by the operation. It can be for example a port out ID, if the operation is `issue.portOutCredentials`. |
| `subscription` | string | Yes | Unique identifier for the subscription inferred from the resource associated with this consent request, e.g. a port-out, porting, or subscription change. |

#### 403 — The authenticated user doesn't have permissions to perform the request.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

#### 404 — The requested resource doesn't exist.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

#### 422 — The request can't be processed, often due to an invalid parameter or incompatible system state.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `object` | string | Yes | Type of object is always `error`. |
| `code` | string | No | An optional machine-readable description of the error. Present for errors that could be handled programmatically. |
| `details` | object[] | No | Optional array containing specific information for the current error.  <!-- theme: info --> > #### Preview > > This property is currently in preview and might change in the future. > > We’re excited to hear your feedback and ideas. Please send an email > to [support@gigs.com](mailto:support@gigs.com) to share your thoughts.  |
| `documentation` | string[] | No | An optional list of URLs providing further information to resolve the error. |
| `hint` | string | No | An optional explanation how to resolve the error. |
| `message` | string | Yes | A human readable description of the error. |
| `type` | string | Yes | The type of [error](https://developers.gigs.com/api/error-handling) returned. |

---
