# Communication consents

**Summary:** Endpoints for Communication consents

- Role: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/communication-consents
- Updated: 2026-10-13
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="get-api-v1-consents"></a>
## Get all consents

`GET /api/v1/consents`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

Content type: `application/json` · `array of ConsentResponseDto`

| Name | Type | Description |
| --- | --- | --- |
| `[].integrationId` (Required when parent is present) | `string` |   |
| `[].title` (Required when parent is present) | `string` |   |
| `[].description` (Required when parent is present) | `string` |   |
| `[].image` (Required when parent is present) | `string` |   |
| `[].showOnCheckoutPage` (Required when parent is present) | `boolean` |   |
| `[].showOnMyPage` (Required when parent is present) | `boolean` |   |
| `[].status` (Required when parent is present) | `boolean` |   |
| `[].purpose` (Required when parent is present) | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `[].frequency` (Required when parent is present) | `string` |   |
| `[].defaultSubscribed` (Required when parent is present) | `boolean` |   |
| `[].sortOrder` (Required when parent is present) | `number` |   |
| `[].visibility` (Required when parent is present) | `string` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` |
| `[].newsletterProviderConfig` (Required when parent is present) | `NewsletterProviderConfig` |   |
| `[].newsletterProviderConfig.provider` (Required when parent is present) | `string` | Allowed values: `"mailchimp"`, `"make"`, `"mailmojo"` |
| `[].newsletterProviderConfig.name` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.tenantId` (Required when parent is present) | `number` |   |
| `[].newsletterProviderConfig.config` (Required when parent is present) | `NewsletterConfig` |   |
| `[].newsletterProviderConfig.config.id` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.name` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.listName` | `string` |   |
| `[].newsletterProviderConfig.config.webhookSecret` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.apiKey` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.userName` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.password` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.accessToken` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.refreshToken` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.integrationId` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].newsletterProviderConfig.consents` (Required when parent is present) | `array of Consent` | Nested fields omitted: field limit. |
| `[].newsletterProviderConfig.id` (Required when parent is present) | `number` |   |
| `[].newsletterProviderConfig.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.metaData` (Required when parent is present) | `object` |   |
| `[].newsletterProviderConfigId` (Required when parent is present) | `number` |   |
| `[].tenantId` (Required when parent is present) | `number` |   |
| `[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].communications` (Required when parent is present) | `array of Communication` |   |
| `[].communications[].name` (Required when parent is present) | `string` |   |
| `[].communications[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `[].communications[].smsContent` (Required when parent is present) | `string` |   |
| `[].communications[].subject` (Required when parent is present) | `string` |   |
| `[].communications[].emailEditorRawContent` (Required when parent is present) | `object` |   |
| `[].communications[].communicationType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `[].communications[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `[].communications[].scheduledAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].completedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].adminUserId` (Required when parent is present) | `number` |   |
| `[].communications[].tenantId` (Required when parent is present) | `number` |   |
| `[].communications[].consentId` (Required when parent is present) | `number` |   |
| `[].communications[].segmentId` (Required when parent is present) | `number` |   |
| `[].communications[].templateId` (Required when parent is present) | `number` |   |
| `[].communications[].emailPreviewText` (Required when parent is present) | `string` |   |
| `[].communications[].deliveryMethod` (Required when parent is present) | `string` |   |
| `[].communications[].externalEmailBody` (Required when parent is present) | `string` |   |
| `[].communications[].emailHtmlPreview` (Required when parent is present) | `string` |   |
| `[].communications[].hostName` (Required when parent is present) | `string` | Can be null |
| `[].communications[].senderId` (Required when parent is present) | `number` |   |
| `[].communications[].totalRecipients` (Required when parent is present) | `number` | Can be null |
| `[].communications[].totalPages` (Required when parent is present) | `number` | Can be null |
| `[].communications[].audienceBasis` (Required when parent is present) | `string` | Can be null |
| `[].communications[].customerWindowMonths` (Required when parent is present) | `number` | Can be null |
| `[].communications[].sender` (Required when parent is present) | `CommunicationSender` | Nested fields omitted: field limit. |
| `[].communications[].adminUser` (Required when parent is present) | `User` | Nested fields omitted: field limit. |
| `[].communications[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].communications[].consent` (Required when parent is present) | `Consent` | Nested fields omitted: field limit. |
| `[].communications[].segment` (Required when parent is present) | `Segment` | Nested fields omitted: field limit. |
| `[].communications[].template` (Required when parent is present) | `CommunicationTemplate` | Nested fields omitted: field limit. |
| `[].communications[].communicationLogs` (Required when parent is present) | `array of CommunicationLog` | Nested fields omitted: field limit. |
| `[].communications[].id` (Required when parent is present) | `number` |   |
| `[].communications[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].metaData` (Required when parent is present) | `object` |   |
| `[].id` (Required when parent is present) | `number` |   |
| `[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].metaData` (Required when parent is present) | `object` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` |   |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl https://api.subrite.no/api/v1/consents \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
[
  {
    "integrationId": "string",
    "title": "string",
    "description": "string",
    "image": "string",
    "showOnCheckoutPage": true,
    "showOnMyPage": true,
    "status": true,
    "purpose": "marketing_and_newsletter",
    "frequency": "string",
    "defaultSubscribed": true,
    "sortOrder": 0,
    "visibility": "subscriber",
    "newsletterProviderConfig": {
      "consents": [],
      "metaData": {}
    },
    "newsletterProviderConfigId": 0,
    "tenantId": 0,
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "communications": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  }
]
```

<a id="post-api-v1-consents"></a>
## Create a new consent

`POST /api/v1/consents`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `multipart/form-data` · Required · `ConsentDto`

| Name | Type | Description |
| --- | --- | --- |
| `imagePreview` | `string` |   |
| `previousImageUrl` | `string` |   |
| `image` | `file` |   |
| `imageUrl` | `string (uri)` | Public URL of a file in the Assets library to use as the consent image, instead of uploading bytes. The file is referenced rather than copied. |
| `sortOrder` | `number` |   |
| `visibility` | `ConsentVisibility` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` · Default: `"all"` |
| `purpose` (Required) | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `title` (Required) | `string` | `maxLength`: `100` |
| `description` (Required) | `string` | `maxLength`: `255` |
| `status` (Required) | `boolean` |   |
| `frequency` (Required) | `string` |   |
| `showOnCheckoutPage` (Required) | `boolean` |   |
| `showOnMyPage` (Required) | `boolean` |   |
| `defaultSubscribed` (Required) | `boolean` |   |
| `externalProvider` | `ExternalProviderNewsLetterDto` |   |
| `externalProvider.name` (Required when parent is present) | `string` |   |
| `externalProvider.provider` (Required when parent is present) | `string` | Allowed values: `"mailchimp"`, `"make"`, `"mailmojo"` |
| `externalProvider.config` | `NewsletterConfig` |   |
| `externalProvider.config.id` (Required when parent is present) | `string` |   |
| `externalProvider.config.name` (Required when parent is present) | `string` |   |
| `externalProvider.config.listName` | `string` |   |
| `externalProvider.config.webhookSecret` (Required when parent is present) | `string` |   |
| `externalProvider.config.apiKey` (Required when parent is present) | `string` |   |
| `externalProvider.config.userName` (Required when parent is present) | `string` |   |
| `externalProvider.config.password` (Required when parent is present) | `string` |   |
| `externalProvider.config.accessToken` (Required when parent is present) | `string` |   |
| `externalProvider.config.refreshToken` (Required when parent is present) | `string` |   |
| `externalProvider.config.integrationId` (Required when parent is present) | `string` |   |

### Responses

#### 201

Content type: `application/json` · `ConsentResponseDto`

| Name | Type | Description |
| --- | --- | --- |
| `integrationId` (Required) | `string` |   |
| `title` (Required) | `string` |   |
| `description` (Required) | `string` |   |
| `image` (Required) | `string` |   |
| `showOnCheckoutPage` (Required) | `boolean` |   |
| `showOnMyPage` (Required) | `boolean` |   |
| `status` (Required) | `boolean` |   |
| `purpose` (Required) | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `frequency` (Required) | `string` |   |
| `defaultSubscribed` (Required) | `boolean` |   |
| `sortOrder` (Required) | `number` |   |
| `visibility` (Required) | `string` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` |
| `newsletterProviderConfig` (Required) | `NewsletterProviderConfig` |   |
| `newsletterProviderConfig.provider` (Required) | `string` | Allowed values: `"mailchimp"`, `"make"`, `"mailmojo"` |
| `newsletterProviderConfig.name` (Required) | `string` |   |
| `newsletterProviderConfig.tenantId` (Required) | `number` |   |
| `newsletterProviderConfig.config` (Required) | `NewsletterConfig` |   |
| `newsletterProviderConfig.config.id` (Required) | `string` |   |
| `newsletterProviderConfig.config.name` (Required) | `string` |   |
| `newsletterProviderConfig.config.listName` | `string` |   |
| `newsletterProviderConfig.config.webhookSecret` (Required) | `string` |   |
| `newsletterProviderConfig.config.apiKey` (Required) | `string` |   |
| `newsletterProviderConfig.config.userName` (Required) | `string` |   |
| `newsletterProviderConfig.config.password` (Required) | `string` |   |
| `newsletterProviderConfig.config.accessToken` (Required) | `string` |   |
| `newsletterProviderConfig.config.refreshToken` (Required) | `string` |   |
| `newsletterProviderConfig.config.integrationId` (Required) | `string` |   |
| `newsletterProviderConfig.tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `newsletterProviderConfig.consents` (Required) | `array of Consent` | Nested fields omitted: field limit. |
| `newsletterProviderConfig.id` (Required) | `number` |   |
| `newsletterProviderConfig.createdAt` (Required) | `string (date-time)` |   |
| `newsletterProviderConfig.updatedAt` (Required) | `string (date-time)` |   |
| `newsletterProviderConfig.deletedAt` (Required) | `string (date-time)` |   |
| `newsletterProviderConfig.metaData` (Required) | `object` |   |
| `newsletterProviderConfigId` (Required) | `number` |   |
| `tenantId` (Required) | `number` |   |
| `tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `communications` (Required) | `array of Communication` |   |
| `communications[].name` (Required when parent is present) | `string` |   |
| `communications[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `communications[].smsContent` (Required when parent is present) | `string` |   |
| `communications[].subject` (Required when parent is present) | `string` |   |
| `communications[].emailEditorRawContent` (Required when parent is present) | `object` |   |
| `communications[].communicationType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communications[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `communications[].scheduledAt` (Required when parent is present) | `string (date-time)` |   |
| `communications[].completedAt` (Required when parent is present) | `string (date-time)` |   |
| `communications[].adminUserId` (Required when parent is present) | `number` |   |
| `communications[].tenantId` (Required when parent is present) | `number` |   |
| `communications[].consentId` (Required when parent is present) | `number` |   |
| `communications[].segmentId` (Required when parent is present) | `number` |   |
| `communications[].templateId` (Required when parent is present) | `number` |   |
| `communications[].emailPreviewText` (Required when parent is present) | `string` |   |
| `communications[].deliveryMethod` (Required when parent is present) | `string` |   |
| `communications[].externalEmailBody` (Required when parent is present) | `string` |   |
| `communications[].emailHtmlPreview` (Required when parent is present) | `string` |   |
| `communications[].hostName` (Required when parent is present) | `string` | Can be null |
| `communications[].senderId` (Required when parent is present) | `number` |   |
| `communications[].totalRecipients` (Required when parent is present) | `number` | Can be null |
| `communications[].totalPages` (Required when parent is present) | `number` | Can be null |
| `communications[].audienceBasis` (Required when parent is present) | `string` | Can be null |
| `communications[].customerWindowMonths` (Required when parent is present) | `number` | Can be null |
| `communications[].sender` (Required when parent is present) | `CommunicationSender` | Nested fields omitted: field limit. |
| `communications[].adminUser` (Required when parent is present) | `User` | Nested fields omitted: field limit. |
| `communications[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `communications[].consent` (Required when parent is present) | `Consent` | Nested fields omitted: field limit. |
| `communications[].segment` (Required when parent is present) | `Segment` | Nested fields omitted: field limit. |
| `communications[].template` (Required when parent is present) | `CommunicationTemplate` | Nested fields omitted: field limit. |
| `communications[].communicationLogs` (Required when parent is present) | `array of CommunicationLog` | Nested fields omitted: field limit. |
| `communications[].id` (Required when parent is present) | `number` |   |
| `communications[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `communications[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `communications[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `communications[].metaData` (Required when parent is present) | `object` |   |
| `id` (Required) | `number` |   |
| `createdAt` (Required) | `string (date-time)` |   |
| `updatedAt` (Required) | `string (date-time)` |   |
| `deletedAt` (Required) | `string (date-time)` |   |
| `metaData` (Required) | `object` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, invalidExternalProviderConfig

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"invalidExternalProviderConfig"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 413

fileSizeExceeded

#### 415

invalidFileType

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl https://api.subrite.no/api/v1/consents \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --form 'image=@<file>' \
  --form 'purpose=marketing_and_newsletter' \
  --form 'title=string' \
  --form 'description=string' \
  --form 'status=true' \
  --form 'frequency=string' \
  --form 'showOnCheckoutPage=true' \
  --form 'showOnMyPage=true' \
  --form 'defaultSubscribed=true'
```

### Example response

201 · `application/json`

```json
{
  "integrationId": "string",
  "title": "string",
  "description": "string",
  "image": "string",
  "showOnCheckoutPage": true,
  "showOnMyPage": true,
  "status": true,
  "purpose": "marketing_and_newsletter",
  "frequency": "string",
  "defaultSubscribed": true,
  "sortOrder": 0,
  "visibility": "subscriber",
  "newsletterProviderConfig": {
    "provider": "mailchimp",
    "name": "string",
    "tenantId": 0,
    "config": {},
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "consents": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "newsletterProviderConfigId": 0,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "communications": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="get-api-v1-consents-unsubscribe-validate"></a>
## Validate unsubscribe token

`GET /api/v1/consents/unsubscribe/validate`

Accepts an unsubscribe token as a query parameter and validates if the token is valid and not expired.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `token` (Required) | query | `string` | The unsubscribe token to validate |

### Responses

#### 200

#### 400

Content type: `application/json` · `ErrorResponse`

invalidOrExpiredUnsubscribeToken, incompleteUnsubscribeTokenPayload, consentIsAlreadyUnsubscribed

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"invalidOrExpiredUnsubscribeToken"`, `"incompleteUnsubscribeTokenPayload"`, `"consentIsAlreadyUnsubscribed"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "invalidOrExpiredUnsubscribeToken",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### default

Token is valid and not expired

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/unsubscribe/validate?token=%3Ctoken%3E' \
  --header 'Authorization: Bearer <token>'
```

<a id="post-api-v1-consents-unsubscribe"></a>
## Unsubscribe from newsletter and communications

`POST /api/v1/consents/unsubscribe`

Accepts an unsubscribe token and processes the unsubscribe request.

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `UnsubscribeTokenDto`

| Name | Type | Description |
| --- | --- | --- |
| `token` (Required) | `string` |   |

**Example request body**

`application/json`

```json
{
  "token": "<token>"
}
```

### Responses

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

invalidOrExpiredUnsubscribeToken, incompleteUnsubscribeTokenPayload, consentIsAlreadyUnsubscribed

Same fields as [Validate unsubscribe token (400)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents-unsubscribe-validate).

**Example response**

`application/json`

```json
{
  "messageCode": "invalidOrExpiredUnsubscribeToken",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl https://api.subrite.no/api/v1/consents/unsubscribe \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "token": "<token>"
}'
```

<a id="get-api-v1-consents-id"></a>
## Get consent details

`GET /api/v1/consents/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Content type: `application/json` · `ConsentResponseDto`

Same fields as [Create a new consent (201)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

consentNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"consentNotFound"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "consentNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/{id}' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "integrationId": "string",
  "title": "string",
  "description": "string",
  "image": "string",
  "showOnCheckoutPage": true,
  "showOnMyPage": true,
  "status": true,
  "purpose": "marketing_and_newsletter",
  "frequency": "string",
  "defaultSubscribed": true,
  "sortOrder": 0,
  "visibility": "subscriber",
  "newsletterProviderConfig": {
    "provider": "mailchimp",
    "name": "string",
    "tenantId": 0,
    "config": {},
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "consents": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "newsletterProviderConfigId": 0,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "communications": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="post-api-v1-consents-id"></a>
## create consent and member and sync third party newsletter

`POST /api/v1/consents/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `string` |   |

### Request body

Content type: `application/json` · Required · `ConsentRequestDto`

| Name | Type | Description |
| --- | --- | --- |
| `email` (Required) | `string (email)` |   |
| `status` (Required) | `string` | Allowed values: `"accepted"`, `"withdrawn"`, `"subscribed"`, `"unsubscribed"` |
| `reference` | `string` |   |

**Example request body**

`application/json`

```json
{
  "email": "user@example.com",
  "status": "accepted",
  "reference": "string"
}
```

### Responses

#### 201

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 417

Content type: `application/json` · `ErrorResponse`

newsletterSyncFailed

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"newsletterSyncFailed"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "newsletterSyncFailed",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/{id}' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "email": "user@example.com",
  "status": "accepted",
  "reference": "string"
}'
```

<a id="delete-api-v1-consents-id"></a>
## Delete a consent

`DELETE /api/v1/consents/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 204

#### 400

Content type: `application/json` · `ErrorResponse`

consentIsAlreadyUsedByMembers

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"consentIsAlreadyUsedByMembers"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "consentIsAlreadyUsedByMembers",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

consentNotFound

Same fields as [Get consent details (404)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents-id).

**Example response**

`application/json`

```json
{
  "messageCode": "consentNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/{id}' \
  --request DELETE \
  --header 'Authorization: Bearer <token>'
```

<a id="patch-api-v1-consents-id"></a>
## Update a consent

`PATCH /api/v1/consents/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `multipart/form-data` · Required · `UpdateConsentDto`

| Name | Type | Description |
| --- | --- | --- |
| `imagePreview` | `string` |   |
| `previousImageUrl` | `string` |   |
| `image` | `file` |   |
| `imageUrl` | `string (uri)` | Public URL of a file in the Assets library to use as the consent image, instead of uploading bytes. The file is referenced rather than copied. |
| `sortOrder` | `number` |   |
| `visibility` | `ConsentVisibility` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` · Default: `"all"` |
| `removeExternalProvider` | `boolean` |   |
| `purpose` | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `title` | `string` | `maxLength`: `100` |
| `description` | `string` | `maxLength`: `255` |
| `status` | `boolean` |   |
| `frequency` | `string` |   |
| `showOnCheckoutPage` | `boolean` |   |
| `showOnMyPage` | `boolean` |   |
| `defaultSubscribed` | `boolean` |   |
| `externalProvider` | `ExternalProviderNewsLetterDto` |   |
| `externalProvider.name` (Required when parent is present) | `string` |   |
| `externalProvider.provider` (Required when parent is present) | `string` | Allowed values: `"mailchimp"`, `"make"`, `"mailmojo"` |
| `externalProvider.config` | `NewsletterConfig` |   |
| `externalProvider.config.id` (Required when parent is present) | `string` |   |
| `externalProvider.config.name` (Required when parent is present) | `string` |   |
| `externalProvider.config.listName` | `string` |   |
| `externalProvider.config.webhookSecret` (Required when parent is present) | `string` |   |
| `externalProvider.config.apiKey` (Required when parent is present) | `string` |   |
| `externalProvider.config.userName` (Required when parent is present) | `string` |   |
| `externalProvider.config.password` (Required when parent is present) | `string` |   |
| `externalProvider.config.accessToken` (Required when parent is present) | `string` |   |
| `externalProvider.config.refreshToken` (Required when parent is present) | `string` |   |
| `externalProvider.config.integrationId` (Required when parent is present) | `string` |   |

### Responses

#### 200

Content type: `application/json` · `ConsentResponseDto`

Same fields as [Create a new consent (201)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents).

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, invalidExternalProviderConfig

Same fields as [Create a new consent (400)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

consentNotFound

Same fields as [Get consent details (404)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents-id).

**Example response**

`application/json`

```json
{
  "messageCode": "consentNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 413

fileSizeExceeded

#### 415

invalidFileType

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/{id}' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --form 'image=@<file>'
```

### Example response

200 · `application/json`

```json
{
  "integrationId": "string",
  "title": "string",
  "description": "string",
  "image": "string",
  "showOnCheckoutPage": true,
  "showOnMyPage": true,
  "status": true,
  "purpose": "marketing_and_newsletter",
  "frequency": "string",
  "defaultSubscribed": true,
  "sortOrder": 0,
  "visibility": "subscriber",
  "newsletterProviderConfig": {
    "provider": "mailchimp",
    "name": "string",
    "tenantId": 0,
    "config": {},
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "consents": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "newsletterProviderConfigId": 0,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "communications": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="patch-api-v1-consents-id-transfer-integration"></a>
## Move a consent's newsletter integration to another consent

`PATCH /api/v1/consents/{id}/transfer-integration`

The integration id moves with the provider config, so provider webhooks and M2M callers posting to it keep working. The source consent gets a fresh integration id.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `TransferConsentIntegrationDto`

| Name | Type | Description |
| --- | --- | --- |
| `targetConsentId` (Required) | `number` | The consent that takes over the integration. It must not have one already. · `minimum`: `1` |

**Example request body**

`application/json`

```json
{
  "targetConsentId": 2
}
```

### Responses

#### 200

Content type: `application/json` · `ConsentResponseDto`

Same fields as [Create a new consent (201)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

consentsNotFoundOrAccessDenied

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"consentsNotFoundOrAccessDenied"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "consentsNotFoundOrAccessDenied",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 409

Content type: `application/json` · `ErrorResponse`

consentNotConnected, consentAlreadyConnected

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"consentNotConnected"`, `"consentAlreadyConnected"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "consentNotConnected",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/{id}/transfer-integration' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "targetConsentId": 2
}'
```

### Example response

200 · `application/json`

```json
{
  "integrationId": "string",
  "title": "string",
  "description": "string",
  "image": "string",
  "showOnCheckoutPage": true,
  "showOnMyPage": true,
  "status": true,
  "purpose": "marketing_and_newsletter",
  "frequency": "string",
  "defaultSubscribed": true,
  "sortOrder": 0,
  "visibility": "subscriber",
  "newsletterProviderConfig": {
    "provider": "mailchimp",
    "name": "string",
    "tenantId": 0,
    "config": {},
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "consents": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "newsletterProviderConfigId": 0,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "communications": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="get-api-v1-consents-webhook-mailchimp-webhooksecret"></a>
## Get mailchimp webhook validation

`GET /api/v1/consents/webhook/mailchimp/{webhooksecret}`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/webhook/mailchimp/{webhooksecret}' \
  --header 'Authorization: Bearer <token>'
```

<a id="post-api-v1-consents-webhook-mailchimp-webhooksecret"></a>
## Sync member consent from mailchimp

`POST /api/v1/consents/webhook/mailchimp/{webhooksecret}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `webhooksecret` (Required) | path | `string` |   |

### Responses

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

invalidWebhookSecret

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"invalidWebhookSecret"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "invalidWebhookSecret",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/webhook/mailchimp/{webhooksecret}' \
  --request POST \
  --header 'Authorization: Bearer <token>'
```

<a id="post-api-v1-consents-webhook-make-webhooksecret"></a>
## Sync member consent from make

`POST /api/v1/consents/webhook/make/{webhooksecret}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `webhooksecret` (Required) | path | `string` |   |

### Responses

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

invalidWebhookSecret

Same fields as [Sync member consent from mailchimp (400)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents-webhook-mailchimp-webhooksecret).

**Example response**

`application/json`

```json
{
  "messageCode": "invalidWebhookSecret",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/webhook/make/{webhooksecret}' \
  --request POST \
  --header 'Authorization: Bearer <token>'
```

<a id="put-api-v1-consents-bulk-sort-order"></a>
## Bulk update consent sort orders

`PUT /api/v1/consents/bulk-sort-order`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `BulkUpdateConsentSortOrderDto`

| Name | Type | Description |
| --- | --- | --- |
| `consents` (Required) | `array of ConsentSortOrderItemDto` | Array of consent IDs and their new sort orders |
| `consents[].id` (Required when parent is present) | `number` | The consent ID |
| `consents[].sortOrder` (Required when parent is present) | `number` | The sort order for the consent (lower numbers appear first) · `minimum`: `0` |

### Responses

#### 200

Content type: `application/json` · `array of ConsentResponseDto`

| Name | Type | Description |
| --- | --- | --- |
| `[].integrationId` (Required when parent is present) | `string` |   |
| `[].title` (Required when parent is present) | `string` |   |
| `[].description` (Required when parent is present) | `string` |   |
| `[].image` (Required when parent is present) | `string` |   |
| `[].showOnCheckoutPage` (Required when parent is present) | `boolean` |   |
| `[].showOnMyPage` (Required when parent is present) | `boolean` |   |
| `[].status` (Required when parent is present) | `boolean` |   |
| `[].purpose` (Required when parent is present) | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `[].frequency` (Required when parent is present) | `string` |   |
| `[].defaultSubscribed` (Required when parent is present) | `boolean` |   |
| `[].sortOrder` (Required when parent is present) | `number` |   |
| `[].visibility` (Required when parent is present) | `string` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` |
| `[].newsletterProviderConfig` (Required when parent is present) | `NewsletterProviderConfig` |   |
| `[].newsletterProviderConfig.provider` (Required when parent is present) | `string` | Allowed values: `"mailchimp"`, `"make"`, `"mailmojo"` |
| `[].newsletterProviderConfig.name` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.tenantId` (Required when parent is present) | `number` |   |
| `[].newsletterProviderConfig.config` (Required when parent is present) | `NewsletterConfig` |   |
| `[].newsletterProviderConfig.config.id` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.name` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.listName` | `string` |   |
| `[].newsletterProviderConfig.config.webhookSecret` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.apiKey` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.userName` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.password` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.accessToken` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.refreshToken` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.config.integrationId` (Required when parent is present) | `string` |   |
| `[].newsletterProviderConfig.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].newsletterProviderConfig.consents` (Required when parent is present) | `array of Consent` | Nested fields omitted: field limit. |
| `[].newsletterProviderConfig.id` (Required when parent is present) | `number` |   |
| `[].newsletterProviderConfig.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].newsletterProviderConfig.metaData` (Required when parent is present) | `object` |   |
| `[].newsletterProviderConfigId` (Required when parent is present) | `number` |   |
| `[].tenantId` (Required when parent is present) | `number` |   |
| `[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].communications` (Required when parent is present) | `array of Communication` |   |
| `[].communications[].name` (Required when parent is present) | `string` |   |
| `[].communications[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `[].communications[].smsContent` (Required when parent is present) | `string` |   |
| `[].communications[].subject` (Required when parent is present) | `string` |   |
| `[].communications[].emailEditorRawContent` (Required when parent is present) | `object` |   |
| `[].communications[].communicationType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `[].communications[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `[].communications[].scheduledAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].completedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].adminUserId` (Required when parent is present) | `number` |   |
| `[].communications[].tenantId` (Required when parent is present) | `number` |   |
| `[].communications[].consentId` (Required when parent is present) | `number` |   |
| `[].communications[].segmentId` (Required when parent is present) | `number` |   |
| `[].communications[].templateId` (Required when parent is present) | `number` |   |
| `[].communications[].emailPreviewText` (Required when parent is present) | `string` |   |
| `[].communications[].deliveryMethod` (Required when parent is present) | `string` |   |
| `[].communications[].externalEmailBody` (Required when parent is present) | `string` |   |
| `[].communications[].emailHtmlPreview` (Required when parent is present) | `string` |   |
| `[].communications[].hostName` (Required when parent is present) | `string` | Can be null |
| `[].communications[].senderId` (Required when parent is present) | `number` |   |
| `[].communications[].totalRecipients` (Required when parent is present) | `number` | Can be null |
| `[].communications[].totalPages` (Required when parent is present) | `number` | Can be null |
| `[].communications[].audienceBasis` (Required when parent is present) | `string` | Can be null |
| `[].communications[].customerWindowMonths` (Required when parent is present) | `number` | Can be null |
| `[].communications[].sender` (Required when parent is present) | `CommunicationSender` | Nested fields omitted: field limit. |
| `[].communications[].adminUser` (Required when parent is present) | `User` | Nested fields omitted: field limit. |
| `[].communications[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `[].communications[].consent` (Required when parent is present) | `Consent` | Nested fields omitted: field limit. |
| `[].communications[].segment` (Required when parent is present) | `Segment` | Nested fields omitted: field limit. |
| `[].communications[].template` (Required when parent is present) | `CommunicationTemplate` | Nested fields omitted: field limit. |
| `[].communications[].communicationLogs` (Required when parent is present) | `array of CommunicationLog` | Nested fields omitted: field limit. |
| `[].communications[].id` (Required when parent is present) | `number` |   |
| `[].communications[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].communications[].metaData` (Required when parent is present) | `object` |   |
| `[].id` (Required when parent is present) | `number` |   |
| `[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].metaData` (Required when parent is present) | `object` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

consentsNotFoundOrAccessDenied

Same fields as [Move a consent's newsletter integration to another consent (404)](https://www.subrite.no/developers/communication-consents?md=true#patch-api-v1-consents-id-transfer-integration).

**Example response**

`application/json`

```json
{
  "messageCode": "consentsNotFoundOrAccessDenied",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl https://api.subrite.no/api/v1/consents/bulk-sort-order \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "consents": [
    {}
  ]
}'
```

### Example response

200 · `application/json`

```json
[
  {
    "integrationId": "string",
    "title": "string",
    "description": "string",
    "image": "string",
    "showOnCheckoutPage": true,
    "showOnMyPage": true,
    "status": true,
    "purpose": "marketing_and_newsletter",
    "frequency": "string",
    "defaultSubscribed": true,
    "sortOrder": 0,
    "visibility": "subscriber",
    "newsletterProviderConfig": {
      "consents": [],
      "metaData": {}
    },
    "newsletterProviderConfigId": 0,
    "tenantId": 0,
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "communications": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  }
]
```

<a id="get-api-v1-consents-mailmojo-get-credentials-integrationid"></a>
## Get Mailmojo credentials

`GET /api/v1/consents/mailmojo/get-credentials/{integrationId}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `integrationId` (Required) | path | `string` |   |

### Responses

#### 200

Content type: `application/json` · `MailmojoCredentialsResponseDto`

| Name | Type | Description |
| --- | --- | --- |
| `clientId` | `string` |   |
| `clientSecret` | `string` |   |
| `accessToken` | `string` |   |
| `refreshToken` | `string` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### default

Content type: `application/json` · `MailmojoCredentialsResponseDto`

Mailmojo credentials

Same fields as [Get Mailmojo credentials (200)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents-mailmojo-get-credentials-integrationid).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/mailmojo/get-credentials/{integrationId}' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "clientId": "string",
  "clientSecret": "<clientSecret>",
  "accessToken": "<accessToken>",
  "refreshToken": "<refreshToken>"
}
```

<a id="get-api-v1-consents-webhook-mailmojo-authorize"></a>
## OAuth callback endpoint for Mailmojo

`GET /api/v1/consents/webhook/mailmojo/authorize`

This endpoint receives the authorization code from Mailmojo after user authorization. It always answers with a page that posts MAILMOJO\_AUTH\_SUCCESS or MAILMOJO\_AUTH\_FAILED (with a messageCode) to the admin page that opened the authorization popup.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `code` | query | `string` |   |
| `state` (Required) | query | `string` |   |

### Responses

#### 200

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/webhook/mailmojo/authorize?state=%3Cstate%3E' \
  --header 'Authorization: Bearer <token>'
```

<a id="post-api-v1-consents-webhook-mailmojo-webhooksecret"></a>
## OAuth callback endpoint for Mailmojo

`POST /api/v1/consents/webhook/mailmojo/{webhooksecret}`

This endpoint receives the authorization code from Mailmojo after user authorization

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `webhooksecret` (Required) | path | `string` |   |

### Responses

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

invalidWebhookSecret

Same fields as [Sync member consent from mailchimp (400)](https://www.subrite.no/developers/communication-consents?md=true#post-api-v1-consents-webhook-mailchimp-webhooksecret).

**Example response**

`application/json`

```json
{
  "messageCode": "invalidWebhookSecret",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all consents (403)](https://www.subrite.no/developers/communication-consents?md=true#get-api-v1-consents).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/consents/webhook/mailmojo/{webhooksecret}' \
  --request POST \
  --header 'Authorization: Bearer <token>'
```
