# Communications

**Summary:** Endpoints for Communications

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

<a id="get-api-v1-communications-sms-short-links-code"></a>
## Resolve an SMS unsubscribe short code

`GET /api/v1/communications/sms-short-links/{code}`

Looks up the short code, verifies it has not expired, and returns a freshly minted HMAC unsubscribe token, the link expiry timestamp, and the owning tenant hostname. Called by the public short-link resolver page (e.g. subr.no/u/{code}) to redirect into the tenant unsubscribe page.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `code` (Required) | path | `string` | `pattern`: `/^[A-Za-z0-9]{8}$/` |

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `token` (Required) | `string` | Freshly minted HMAC unsubscribe token (base64url) — short-lived, scoped per recipient/consent |
| `expiresAt` (Required) | `string (date-time)` | When the underlying short link expires (ISO 8601). Token TTL is bounded by this. |
| `tenantHostName` (Required) | `string` | Hostname of the tenant that owns this short link. Lets the short-link domain (e.g. subr.no) redirect to the tenant unsubscribe page. |
| `testContext` | `TestContextDto` | Test-context metadata, only present when the short link was created via "Send test SMS". Frontend uses this to render the admin preview UI; the security gate is the signed isTest claim in the token. |
| `testContext.environment` (Required when parent is present) | `string` | Environment label (e.g. "tenant.subrite.no" or "staging.tenant.subrite.no"). |
| `testContext.adminEmail` (Required when parent is present) | `string` | Email of the admin who triggered the test SMS, when known. Null if user was deleted. · Can be null |
| `testContext.recipient` (Required when parent is present) | `string` | Masked recipient phone number for the test send. Null if not stored. · Can be null |
| `testContext.sentAt` (Required when parent is present) | `string (date-time)` | When the short link was created (sentAt for the test SMS). |
| `testContext.messageId` (Required when parent is present) | `string` | Short-link code, used as the message identifier. |

#### 401

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

unauthorized

| 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": [
    {}
  ]
}
```

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 404

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

smsShortLinkNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"smsShortLinkNotFound"` |
| `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": "smsShortLinkNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 410

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

smsShortLinkExpired

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"smsShortLinkExpired"` |
| `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": "smsShortLinkExpired",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/sms-short-links/{code}' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "token": "<token>",
  "expiresAt": "2019-08-24T14:15:22Z",
  "tenantHostName": "string",
  "testContext": {
    "environment": "string",
    "adminEmail": "string",
    "recipient": "string",
    "sentAt": "2019-08-24T14:15:22Z",
    "messageId": "string"
  }
}
```

<a id="get-api-v1-communications"></a>
## Get all communication set ups

`GET /api/v1/communications`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |
| `communicationChannel` (Required) | query | `string` |   |

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of Communication` |   |
| `items[].name` (Required when parent is present) | `string` |   |
| `items[].status` (Required when parent is present) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `items[].smsContent` (Required when parent is present) | `string` |   |
| `items[].subject` (Required when parent is present) | `string` |   |
| `items[].emailEditorRawContent` (Required when parent is present) | `object` |   |
| `items[].communicationType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `items[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `items[].scheduledAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].completedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].adminUserId` (Required when parent is present) | `number` |   |
| `items[].tenantId` (Required when parent is present) | `number` |   |
| `items[].consentId` (Required when parent is present) | `number` |   |
| `items[].segmentId` (Required when parent is present) | `number` |   |
| `items[].templateId` (Required when parent is present) | `number` |   |
| `items[].emailPreviewText` (Required when parent is present) | `string` |   |
| `items[].deliveryMethod` (Required when parent is present) | `string` |   |
| `items[].externalEmailBody` (Required when parent is present) | `string` |   |
| `items[].emailHtmlPreview` (Required when parent is present) | `string` |   |
| `items[].hostName` (Required when parent is present) | `string` | Can be null |
| `items[].senderId` (Required when parent is present) | `number` |   |
| `items[].totalRecipients` (Required when parent is present) | `number` | Can be null |
| `items[].totalPages` (Required when parent is present) | `number` | Can be null |
| `items[].audienceBasis` (Required when parent is present) | `string` | Can be null |
| `items[].customerWindowMonths` (Required when parent is present) | `number` | Can be null |
| `items[].sender` (Required when parent is present) | `CommunicationSender` |   |
| `items[].sender.senderName` (Required when parent is present) | `string` |   |
| `items[].sender.senderEmail` (Required when parent is present) | `string` |   |
| `items[].sender.replyTo` (Required when parent is present) | `string` |   |
| `items[].sender.communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `items[].sender.providerRegion` (Required when parent is present) | `string` | Allowed values: `"global"`, `"eu"` · Can be null |
| `items[].sender.status` (Required when parent is present) | `string` | Allowed values: `"pending"`, `"approved"`, `"archived"` |
| `items[].sender.requestSentAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].sender.tenantId` (Required when parent is present) | `number` |   |
| `items[].sender.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `items[].sender.id` (Required when parent is present) | `number` |   |
| `items[].sender.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].sender.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].sender.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].sender.metaData` (Required when parent is present) | `object` |   |
| `items[].adminUser` (Required when parent is present) | `User` | Nested fields omitted: field limit. |
| `items[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `items[].consent` (Required when parent is present) | `Consent` |   |
| `items[].consent.integrationId` (Required when parent is present) | `string` |   |
| `items[].consent.title` (Required when parent is present) | `string` |   |
| `items[].consent.description` (Required when parent is present) | `string` |   |
| `items[].consent.image` (Required when parent is present) | `string` |   |
| `items[].consent.showOnCheckoutPage` (Required when parent is present) | `boolean` |   |
| `items[].consent.showOnMyPage` (Required when parent is present) | `boolean` |   |
| `items[].consent.status` (Required when parent is present) | `boolean` |   |
| `items[].consent.purpose` (Required when parent is present) | `string` | Allowed values: `"marketing_and_newsletter"`, `"consent"` |
| `items[].consent.frequency` (Required when parent is present) | `string` |   |
| `items[].consent.defaultSubscribed` (Required when parent is present) | `boolean` |   |
| `items[].consent.sortOrder` (Required when parent is present) | `number` |   |
| `items[].consent.visibility` (Required when parent is present) | `string` | Allowed values: `"subscriber"`, `"nonSubscriber"`, `"all"` |
| `items[].consent.newsletterProviderConfig` (Required when parent is present) | `NewsletterProviderConfig` | Nested fields omitted: depth limit. |
| `items[].consent.newsletterProviderConfigId` (Required when parent is present) | `number` |   |
| `items[].consent.tenantId` (Required when parent is present) | `number` |   |
| `items[].consent.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `items[].consent.communications` (Required when parent is present) | `array of Communication` | Recursive schema; nested fields are not repeated. |
| `items[].consent.id` (Required when parent is present) | `number` |   |
| `items[].consent.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].consent.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].consent.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].consent.metaData` (Required when parent is present) | `object` |   |
| `items[].segment` (Required when parent is present) | `Segment` | Nested fields omitted: field limit. |
| `items[].template` (Required when parent is present) | `CommunicationTemplate` | Nested fields omitted: field limit. |
| `items[].communicationLogs` (Required when parent is present) | `array of CommunicationLog` | Nested fields omitted: field limit. |
| `items[].id` (Required when parent is present) | `number` |   |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].metaData` (Required when parent is present) | `object` |   |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 400

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

badRequest

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications?communicationChannel=%3CcommunicationChannel%3E' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="post-api-v1-communications"></a>
## Create a communication set up

`POST /api/v1/communications`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `communicationType` | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communicationChannel` (Required) | `string` | Allowed values: `"sms"`, `"email"` |
| `name` (Required) | `string` |   |
| `senderId` | `number` |   |
| `consentId` | `number` |   |
| `segmentId` | `number` |   |
| `smsContent` | `string` |   |
| `subject` | `string` |   |
| `emailEditorRawContent` | `object` |   |
| `templateId` | `number` |   |
| `emailPreviewText` | `string` |   |
| `deliveryMethod` | `string` |   |
| `externalEmailBody` | `string` |   |
| `hostName` | `string` | `maxLength`: `255` |

**Example request body**

`application/json`

```json
{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}
```

### Responses

#### 201

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

| Name | Type | Description |
| --- | --- | --- |
| `id` (Required) | `number` |   |
| `name` (Required) | `string` |   |
| `communicationType` (Required) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `smsContent` (Required) | `string` | Can be null |
| `subject` (Required) | `string` | Can be null |
| `emailEditorRawContent` (Required) | `object` | Can be null |
| `emailPreviewText` (Required) | `string` | Can be null |
| `status` (Required) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `communicationChannel` (Required) | `string` | Allowed values: `"sms"`, `"email"` |
| `createdAt` (Required) | `string (date-time)` |   |
| `updatedAt` (Required) | `string (date-time)` |   |
| `senderId` (Required) | `number` |   |
| `sender` (Required) | `string` |   |
| `segmentId` (Required) | `number` |   |
| `segmentName` (Required) | `string` |   |
| `consentId` (Required) | `number` |   |
| `consentName` (Required) | `string` |   |
| `tenantId` (Required) | `number` |   |
| `adminUserId` (Required) | `number` |   |
| `adminUserName` (Required) | `string` |   |
| `emailHtmlPreview` (Required) | `string` | Can be null |
| `template` (Required) | `CommunicationTemplate` | Can be null |
| `template.name` (Required when parent is present) | `string` |   |
| `template.templateType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `template.communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `template.locale` (Required when parent is present) | `string` | Allowed values: `"en"`, `"no"`, `"sv"`, `"da"` |
| `template.template` (Required when parent is present) | `string` |   |
| `template.tenantId` (Required when parent is present) | `number` |   |
| `template.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `template.id` (Required when parent is present) | `number` |   |
| `template.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `template.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `template.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `template.metaData` (Required when parent is present) | `object` |   |
| `scheduledAt` (Required) | `string (date-time)` | Can be null |
| `completedAt` (Required) | `string (date-time)` | Can be null |
| `deliveryMethod` (Required) | `string` |   |
| `externalEmailBody` (Required) | `string` | Can be null |
| `senderEmail` (Required) | `string` | Can be null |

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl https://api.subrite.no/api/v1/communications \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}'
```

### Example response

201 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="get-api-v1-communications-id"></a>
## Get a communication set up

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

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

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

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"communicationNotFound"` |
| `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": "communicationNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="post-api-v1-communications-id"></a>
## Send SMS/Email to members of a list by communication ID

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

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 201

#### 400

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

badRequest, communicationIsNotReady, senderEmailUnapproved

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"communicationIsNotReady"`, `"senderEmailUnapproved"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

<a id="delete-api-v1-communications-id"></a>
## Delete a communication set up

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

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{}
```

<a id="patch-api-v1-communications-id"></a>
## Update a communication set up

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

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `communicationType` | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communicationChannel` | `string` | Allowed values: `"sms"`, `"email"` |
| `emailContent` | `string` | Email content in HTML format |
| `name` | `string` |   |
| `senderId` | `number` |   |
| `consentId` | `number` |   |
| `segmentId` | `number` |   |
| `smsContent` | `string` |   |
| `subject` | `string` |   |
| `emailEditorRawContent` | `object` |   |
| `templateId` | `number` |   |
| `emailPreviewText` | `string` |   |
| `deliveryMethod` | `string` |   |
| `externalEmailBody` | `string` |   |
| `hostName` | `string` | `maxLength`: `255` |

**Example request body**

`application/json`

```json
{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}
```

### Responses

#### 200

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

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

#### 400

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

badRequest, communicationCannotBeUpdated, scheduledTimeMustBeInTheFuture

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"communicationCannotBeUpdated"`, `"scheduledTimeMustBeInTheFuture"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}'
```

### Example response

200 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="get-api-v1-communications-by-status"></a>
## Get communications, optionally filtered by status (for segment filtering)

`GET /api/v1/communications/by-status`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `status` | query | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `[].id` (Required when parent is present) | `number` |   |
| `[].name` (Required when parent is present) | `string` |   |

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
[
  {
    "id": 0,
    "name": "string"
  }
]
```

<a id="get-api-v1-communications-email-list"></a>
## Get all emails of users tenant

`GET /api/v1/communications/email/list`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |

### Responses

#### 200

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

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "emailEditorRawContent": {},
      "communicationLogs": [],
      "metaData": {}
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="post-api-v1-communications-one-off-email"></a>
## Send a one off email

`POST /api/v1/communications/one-off/email`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `email` | `string (email)` |   |
| `memberId` | `string` |   |
| `subject` (Required) | `string` |   |
| `message` (Required) | `string` | Message content - supports plain text or HTML (auto-detected). When using HTML with attributes containing double quotes, escape them or use single quotes. |

**Example request body**

`application/json`

```json
{
  "email": "user@example.com",
  "memberId": "string",
  "subject": "string",
  "message": {
    "summary": "Plain text message",
    "value": "Hello, this is a plain text message with line breaks.\n\nThis is a new paragraph."
  }
}
```

### Responses

#### 201

#### 400

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

recipientEmailMissing, failedToSendOneOffEmail, or badRequest with errors\[\] = invalidMessageContent on `message`

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"recipientEmailMissing"`, `"failedToSendOneOffEmail"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

memberNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"memberNotFound"` |
| `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": "memberNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 422

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

emailProviderRequestInvalid

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"emailProviderRequestInvalid"` |
| `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": "emailProviderRequestInvalid",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 502

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

emailProviderUnavailable

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"emailProviderUnavailable"` |
| `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": "emailProviderUnavailable",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 503

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

emailProviderRateLimited

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"emailProviderRateLimited"` |
| `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": "emailProviderRateLimited",
  "message": "string",
  "errors": [
    {}
  ]
}
```

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/one-off/email \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "email": "user@example.com",
  "memberId": "string",
  "subject": "string",
  "message": {
    "summary": "Plain text message",
    "value": "Hello, this is a plain text message with line breaks.\n\nThis is a new paragraph."
  }
}'
```

<a id="post-api-v1-communications-email-send"></a>
## Email Service API

`POST /api/v1/communications/email/send`

Allows authenticated tenants to send emails using the platform email service

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Name of the communication |
| `senderId` (Required) | `number` | The ID of the sender · `minimum`: `1` |
| `communicationType` (Required) | `string` | The type of communication · Allowed values: `"marketing"`, `"information"` |
| `consentId` | `number` | The ID of the consent · `minimum`: `1` |
| `segmentId` (Required) | `number` | The ID of the segment · `minimum`: `1` |
| `subject` (Required) | `string` | The subject of the communication |
| `emailPreviewText` | `string` | The preview text of the communication |
| `templateId` | `number` | The ID of the template · `minimum`: `1` |
| `emailContent` (Required) | `string` | The content of the communication |
| `hostName` | `string` | Originating tenant hostname for unsubscribe link generation. Validated against the tenant; falls back to primary hostname if missing/invalid. · `maxLength`: `255` |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string"
}
```

### Responses

#### 201

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

| Name | Type | Description |
| --- | --- | --- |
| `success` (Required) | `boolean` |   |
| `message` (Required) | `string` |   |
| `id` (Required) | `number` |   |

#### 400

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

communicationIsNotReady, senderEmailUnapproved

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"communicationIsNotReady"`, `"senderEmailUnapproved"` |
| `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": "communicationIsNotReady",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/email/send \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string"
}'
```

### Example response

201 · `application/json`

```json
{
  "success": true,
  "message": "Email sent successfully",
  "id": 123
}
```

<a id="post-api-v1-communications-send-single-sms"></a>
## SMS Service API

`POST /api/v1/communications/send-single-sms`

Allows authenticated tenants to send sms using the platform email service

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `communicationType` (Required) | `COMMUNICATION_TYPE` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `phoneNumber` (Required) | `string` |   |
| `message` (Required) | `string` |   |
| `senderId` (Required) | `number` |   |
| `memberId` (Required) | `string` |   |

**Example request body**

`application/json`

```json
{
  "communicationType": "automation",
  "phoneNumber": "<phoneNumber>",
  "message": "string",
  "senderId": 0,
  "memberId": "string"
}
```

### Responses

#### 201

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

senderNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"senderNotFound"` |
| `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": "senderNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 422

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

smsProviderRequestInvalid

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"smsProviderRequestInvalid"` |
| `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": "smsProviderRequestInvalid",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 502

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

smsProviderUnavailable

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"smsProviderUnavailable"` |
| `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": "smsProviderUnavailable",
  "message": "string",
  "errors": [
    {}
  ]
}
```

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/send-single-sms \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "communicationType": "automation",
  "phoneNumber": "<phoneNumber>",
  "message": "string",
  "senderId": 0,
  "memberId": "string"
}'
```

<a id="post-api-v1-communications-email-test"></a>
## Test a third party email

`POST /api/v1/communications/email/test`

Allows authenticated tenants to send test email using the platform email service

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Name of the communication |
| `senderId` (Required) | `number` | The ID of the sender · `minimum`: `1` |
| `communicationType` (Required) | `string` | The type of communication · Allowed values: `"marketing"`, `"information"` |
| `consentId` | `number` | The ID of the consent · `minimum`: `1` |
| `segmentId` (Required) | `number` | The ID of the segment · `minimum`: `1` |
| `emailPreviewText` | `string` | The preview text of the communication |
| `templateId` | `number` | The ID of the template · `minimum`: `1` |
| `emailContent` (Required) | `string` | The content of the communication |
| `hostName` | `string` | Originating tenant hostname for unsubscribe link generation. Validated against the tenant; falls back to primary hostname if missing/invalid. · `maxLength`: `255` |
| `subject` | `string` | The subject of the test email |
| `recipients` (Required) | `array of string (email)` | List of email recipients for the test email · `minItems`: `1`, `maxItems`: `5` |
| `id` | `number` | Communication ID · `minimum`: `1` |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string",
  "subject": "string",
  "recipients": [
    "recipient1@example.com",
    "recipient2@example.com"
  ],
  "id": 1
}
```

### Responses

#### 201

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

| Name | Type | Description |
| --- | --- | --- |
| `success` (Required) | `boolean` |   |
| `message` (Required) | `string` |   |
| `id` (Required) | `number` |   |

#### 400

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

communicationChannelNotSupported

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"communicationChannelNotSupported"` |
| `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": "communicationChannelNotSupported",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

notFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"notFound"` |
| `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": "notFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 422

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

emailProviderRequestInvalid

Same fields as [Send a one off email (422)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 502

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

emailProviderUnavailable

Same fields as [Send a one off email (502)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

#### 503

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

emailProviderRateLimited

Same fields as [Send a one off email (503)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/email/test \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string",
  "subject": "string",
  "recipients": [
    "recipient1@example.com",
    "recipient2@example.com"
  ],
  "id": 1
}'
```

### Example response

201 · `application/json`

```json
{
  "success": true,
  "message": "Email sent successfully",
  "id": 123
}
```

<a id="get-api-v1-communications-email-preview-html-id"></a>
## Preview an email

`GET /api/v1/communications/email/preview-html/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

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

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "htmlPreview": "string"
}
```

<a id="post-api-v1-communications-email-schedule"></a>
## Schedule a third party email

`POST /api/v1/communications/email/schedule`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Name of the communication |
| `senderId` (Required) | `number` | The ID of the sender · `minimum`: `1` |
| `communicationType` (Required) | `string` | The type of communication · Allowed values: `"marketing"`, `"information"` |
| `consentId` | `number` | The ID of the consent · `minimum`: `1` |
| `segmentId` (Required) | `number` | The ID of the segment · `minimum`: `1` |
| `emailPreviewText` | `string` | The preview text of the communication |
| `templateId` | `number` | The ID of the template · `minimum`: `1` |
| `emailContent` (Required) | `string` | The content of the communication |
| `hostName` | `string` | Originating tenant hostname for unsubscribe link generation. Validated against the tenant; falls back to primary hostname if missing/invalid. · `maxLength`: `255` |
| `subject` | `string` | The subject of the scheduled email |
| `scheduledAt` (Required) | `string (date-time)` | The date and time to schedule the email |
| `timeZone` (Required) | `string` | The timezone for the scheduled date and time |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string",
  "subject": "string",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo"
}
```

### Responses

#### 201

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

Same fields as [Email Service API (201)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-email-send).

#### 400

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

scheduledTimeMustBeInTheFuture

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"scheduledTimeMustBeInTheFuture"` |
| `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": "scheduledTimeMustBeInTheFuture",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/email/schedule \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string",
  "hostName": "string",
  "subject": "string",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo"
}'
```

### Example response

201 · `application/json`

```json
{
  "success": true,
  "message": "Email sent successfully",
  "id": 123
}
```

<a id="post-api-v1-communications-id-email-schedule"></a>
## Schedule an email by communication id

`POST /api/v1/communications/{id}/email/schedule`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `scheduledAt` (Required) | `string (date-time)` | The date and time to schedule the email |
| `timeZone` | `string` | The timezone for the scheduled date and time |
| `name` | `string` | Name of the communication |
| `senderId` | `number` | The ID of the sender · `minimum`: `1` |
| `communicationType` | `string` | The type of communication · Allowed values: `"marketing"`, `"information"` |
| `consentId` | `number` | The ID of the consent · `minimum`: `1` |
| `segmentId` | `number` | The ID of the segment · `minimum`: `1` |
| `subject` | `string` | The subject of the communication |
| `emailPreviewText` | `string` | The preview text of the communication |
| `templateId` | `number` | The ID of the template · `minimum`: `1` |
| `emailContent` | `string` | The content of the communication |

**Example request body**

`application/json`

```json
{
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string"
}
```

### Responses

#### 201

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

| Name | Type | Description |
| --- | --- | --- |
| `success` (Required) | `boolean` |   |
| `message` (Required) | `string` |   |
| `id` (Required) | `number` |   |
| `communication` (Required) | `CommunicationResponseDto` |   |
| `communication.id` (Required) | `number` |   |
| `communication.name` (Required) | `string` |   |
| `communication.communicationType` (Required) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communication.smsContent` (Required) | `string` | Can be null |
| `communication.subject` (Required) | `string` | Can be null |
| `communication.emailEditorRawContent` (Required) | `object` | Can be null |
| `communication.emailPreviewText` (Required) | `string` | Can be null |
| `communication.status` (Required) | `string` | Allowed values: `"draft"`, `"ready"`, `"scheduled"`, `"completed"`, `"failed"`, `"processing"` |
| `communication.communicationChannel` (Required) | `string` | Allowed values: `"sms"`, `"email"` |
| `communication.createdAt` (Required) | `string (date-time)` |   |
| `communication.updatedAt` (Required) | `string (date-time)` |   |
| `communication.senderId` (Required) | `number` |   |
| `communication.sender` (Required) | `string` |   |
| `communication.segmentId` (Required) | `number` |   |
| `communication.segmentName` (Required) | `string` |   |
| `communication.consentId` (Required) | `number` |   |
| `communication.consentName` (Required) | `string` |   |
| `communication.tenantId` (Required) | `number` |   |
| `communication.adminUserId` (Required) | `number` |   |
| `communication.adminUserName` (Required) | `string` |   |
| `communication.emailHtmlPreview` (Required) | `string` | Can be null |
| `communication.template` (Required) | `CommunicationTemplate` | Can be null |
| `communication.template.name` (Required when parent is present) | `string` |   |
| `communication.template.templateType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communication.template.communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `communication.template.locale` (Required when parent is present) | `string` | Allowed values: `"en"`, `"no"`, `"sv"`, `"da"` |
| `communication.template.template` (Required when parent is present) | `string` |   |
| `communication.template.tenantId` (Required when parent is present) | `number` |   |
| `communication.template.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `communication.template.id` (Required when parent is present) | `number` |   |
| `communication.template.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `communication.template.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `communication.template.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `communication.template.metaData` (Required when parent is present) | `object` |   |
| `communication.scheduledAt` (Required) | `string (date-time)` | Can be null |
| `communication.completedAt` (Required) | `string (date-time)` | Can be null |
| `communication.deliveryMethod` (Required) | `string` |   |
| `communication.externalEmailBody` (Required) | `string` | Can be null |
| `communication.senderEmail` (Required) | `string` | Can be null |

#### 400

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

badRequest, scheduledTimeMustBeInTheFuture, scheduledFailed

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"scheduledTimeMustBeInTheFuture"`, `"scheduledFailed"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}/email/schedule' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string"
}'
```

### Example response

201 · `application/json`

```json
{
  "success": true,
  "message": "Email sent successfully",
  "id": 123,
  "communication": "Communication"
}
```

<a id="get-api-v1-communications-email-tokens"></a>
## Get personalized tokens for email communication

`GET /api/v1/communications/email/tokens`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `memberInfo` (Required) | `array of string` |   |
| `myPageLink` (Required) | `array of string` |   |

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "memberInfo": [
    "string"
  ],
  "myPageLink": [
    "string"
  ]
}
```

<a id="get-api-v1-communications-email-templates"></a>
## Get communication email templates

`GET /api/v1/communications/email/templates`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `[].name` (Required when parent is present) | `string` |   |
| `[].templateType` (Required when parent is present) | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `[].locale` (Required when parent is present) | `string` | Allowed values: `"en"`, `"no"`, `"sv"`, `"da"` |
| `[].template` (Required when parent is present) | `string` |   |
| `[].tenantId` (Required when parent is present) | `number` |   |
| `[].tenant` (Required when parent is present) | `Tenant` |   |
| `[].tenant.market` (Required when parent is present) | `string` | Operating market of the tenant (immutable post-install). · Allowed values: `"NO"`, `"SE"`, `"DK"` |
| `[].tenant.productName` | `string` | The product name of the tenant · Allowed values: `"enterprise"`, `"communication"`, `"custom"` |
| `[].tenant.additionalFeatures` | `array of string` | The additional features of the tenant · Allowed values: `"email"`, `"sms"`, `"push"`, `"podcasts"`, `"subscription"`, `"insights"`, `"dashboard"`, `"automation"`, `"export"`, `"accounting"`, `"invoices"`, `"ai"` |
| `[].tenant.disabledFeatures` | `array of string` | The disabled features of the tenant · Allowed values: `"email"`, `"sms"`, `"push"`, `"podcasts"`, `"subscription"`, `"insights"`, `"dashboard"`, `"automation"`, `"export"`, `"accounting"`, `"invoices"`, `"ai"` |
| `[].tenant.name` (Required when parent is present) | `string` |   |
| `[].tenant.isActive` (Required when parent is present) | `boolean` |   |
| `[].tenant.defaultLanguage` (Required when parent is present) | `string` | Allowed values: `"en"`, `"no"`, `"sv"`, `"da"` |
| `[].tenant.hostName` (Required when parent is present) | `string` |   |
| `[].tenant.logo` (Required when parent is present) | `string` |   |
| `[].tenant.favicon` (Required when parent is present) | `string` |   |
| `[].tenant.authLogo` (Required when parent is present) | `string` |   |
| `[].tenant.authLogoHeight` (Required when parent is present) | `number` |   |
| `[].tenant.siteUrl` (Required when parent is present) | `string` |   |
| `[].tenant.termsUrl` (Required when parent is present) | `string` |   |
| `[].tenant.privacyUrl` (Required when parent is present) | `string` |   |
| `[].tenant.gtm` (Required when parent is present) | `string` |   |
| `[].tenant.taxRates` | `array of number` |   |
| `[].tenant.smsOtp` (Required when parent is present) | `boolean` |   |
| `[].tenant.emailProvider` (Required when parent is present) | `string` | Allowed values: `"brevo"`, `"sendgrid"` |
| `[].tenant.tenantContact` (Required when parent is present) | `string` |   |
| `[].tenant.registeredBusinessNo` (Required when parent is present) | `string` |   |
| `[].tenant.bankAccountNo` (Required when parent is present) | `string` |   |
| `[].tenant.swiftCode` (Required when parent is present) | `string` |   |
| `[].tenant.iban` (Required when parent is present) | `string` |   |
| `[].tenant.defaultLogoutURL` (Required when parent is present) | `string` |   |
| `[].tenant.postalAddress` (Required when parent is present) | `string` |   |
| `[].tenant.otpTemplateId` | `Translation` | Nested fields omitted: field limit. |
| `[].tenant.smsSenderId` (Required when parent is present) | `number` |   |
| `[].tenant.emailSenderId` (Required when parent is present) | `number` |   |
| `[].tenant.smsSender` (Required when parent is present) | `CommunicationSender` | Nested fields omitted: field limit. |
| `[].tenant.emailSender` (Required when parent is present) | `CommunicationSender` | Nested fields omitted: field limit. |
| `[].tenant.products` (Required when parent is present) | `array of Product` | Nested fields omitted: field limit. |
| `[].tenant.users` (Required when parent is present) | `array of User` | Nested fields omitted: field limit. |
| `[].tenant.members` (Required when parent is present) | `array of Member` | Nested fields omitted: field limit. |
| `[].tenant.roles` (Required when parent is present) | `array of Role` | Nested fields omitted: field limit. |
| `[].tenant.subscriptionPlans` (Required when parent is present) | `array of SubscriptionPlan` | Nested fields omitted: field limit. |
| `[].tenant.packages` (Required when parent is present) | `array of Package` | Nested fields omitted: field limit. |
| `[].tenant.invoices` (Required when parent is present) | `array of Invoice` | Nested fields omitted: field limit. |
| `[].tenant.orders` (Required when parent is present) | `array of Order` | Nested fields omitted: field limit. |
| `[].tenant.paymentProviders` (Required when parent is present) | `array of PaymentProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.newslettersProviderConfig` (Required when parent is present) | `array of NewsletterProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.paymentProviderConfigs` (Required when parent is present) | `array of PaymentProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.oidcClients` (Required when parent is present) | `array of OidcClient` | Nested fields omitted: field limit. |
| `[].tenant.oauthProviders` (Required when parent is present) | `array of OauthProvider` | Nested fields omitted: field limit. |
| `[].tenant.activityLogs` (Required when parent is present) | `array of ActivityLog` | Nested fields omitted: field limit. |
| `[].tenant.m2m_api_clients` (Required when parent is present) | `array of M2MApiClient` | Nested fields omitted: field limit. |
| `[].tenant.customProperties` (Required when parent is present) | `array of CustomProperty` | Nested fields omitted: field limit. |
| `[].tenant.consents` (Required when parent is present) | `array of Consent` | Nested fields omitted: field limit. |
| `[].tenant.preference` (Required when parent is present) | `Preference` | Nested fields omitted: field limit. |
| `[].tenant.settings` (Required when parent is present) | `TenantSettings` | Nested fields omitted: field limit. |
| `[].tenant.communicationTemplates` (Required when parent is present) | `array of CommunicationTemplate` | Recursive schema; nested fields are not repeated. |
| `[].tenant.additionalHostnames` (Required when parent is present) | `array of TenantHostname` | Nested fields omitted: field limit. |
| `[].tenant.exportHistory` (Required when parent is present) | `array of ExportHistory` | Nested fields omitted: field limit. |
| `[].tenant.arReportHistory` (Required when parent is present) | `array of ArReportHistory` | Nested fields omitted: field limit. |
| `[].tenant.mypageCardsSettings` (Required when parent is present) | `array of MypageCardsSettings` | Nested fields omitted: field limit. |
| `[].tenant.webhooks` (Required when parent is present) | `array of Webhook` | Nested fields omitted: field limit. |
| `[].tenant.customOrders` (Required when parent is present) | `array of CustomOrder` | Nested fields omitted: field limit. |
| `[].tenant.customOrderSources` (Required when parent is present) | `array of CustomOrderSource` | Nested fields omitted: field limit. |
| `[].tenant.brandKits` (Required when parent is present) | `array of BrandKit` | Nested fields omitted: field limit. |
| `[].tenant.communicationReceivers` (Required when parent is present) | `array of CommunicationReceiver` | Nested fields omitted: field limit. |
| `[].tenant.id` (Required when parent is present) | `number` |   |
| `[].tenant.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
[
  {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "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-communications-email-senders"></a>
## Get all email sender

`GET /api/v1/communications/email/senders`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `[].senderName` (Required when parent is present) | `string` |   |
| `[].senderEmail` (Required when parent is present) | `string` |   |
| `[].replyTo` (Required when parent is present) | `string` |   |
| `[].communicationChannel` (Required when parent is present) | `string` | Allowed values: `"sms"`, `"email"` |
| `[].providerRegion` (Required when parent is present) | `string` | Allowed values: `"global"`, `"eu"` · Can be null |
| `[].status` (Required when parent is present) | `string` | Allowed values: `"pending"`, `"approved"`, `"archived"` |
| `[].requestSentAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenantId` (Required when parent is present) | `number` |   |
| `[].tenant` (Required when parent is present) | `Tenant` |   |
| `[].tenant.market` (Required when parent is present) | `string` | Operating market of the tenant (immutable post-install). · Allowed values: `"NO"`, `"SE"`, `"DK"` |
| `[].tenant.productName` | `string` | The product name of the tenant · Allowed values: `"enterprise"`, `"communication"`, `"custom"` |
| `[].tenant.additionalFeatures` | `array of string` | The additional features of the tenant · Allowed values: `"email"`, `"sms"`, `"push"`, `"podcasts"`, `"subscription"`, `"insights"`, `"dashboard"`, `"automation"`, `"export"`, `"accounting"`, `"invoices"`, `"ai"` |
| `[].tenant.disabledFeatures` | `array of string` | The disabled features of the tenant · Allowed values: `"email"`, `"sms"`, `"push"`, `"podcasts"`, `"subscription"`, `"insights"`, `"dashboard"`, `"automation"`, `"export"`, `"accounting"`, `"invoices"`, `"ai"` |
| `[].tenant.name` (Required when parent is present) | `string` |   |
| `[].tenant.isActive` (Required when parent is present) | `boolean` |   |
| `[].tenant.defaultLanguage` (Required when parent is present) | `string` | Allowed values: `"en"`, `"no"`, `"sv"`, `"da"` |
| `[].tenant.hostName` (Required when parent is present) | `string` |   |
| `[].tenant.logo` (Required when parent is present) | `string` |   |
| `[].tenant.favicon` (Required when parent is present) | `string` |   |
| `[].tenant.authLogo` (Required when parent is present) | `string` |   |
| `[].tenant.authLogoHeight` (Required when parent is present) | `number` |   |
| `[].tenant.siteUrl` (Required when parent is present) | `string` |   |
| `[].tenant.termsUrl` (Required when parent is present) | `string` |   |
| `[].tenant.privacyUrl` (Required when parent is present) | `string` |   |
| `[].tenant.gtm` (Required when parent is present) | `string` |   |
| `[].tenant.taxRates` | `array of number` |   |
| `[].tenant.smsOtp` (Required when parent is present) | `boolean` |   |
| `[].tenant.emailProvider` (Required when parent is present) | `string` | Allowed values: `"brevo"`, `"sendgrid"` |
| `[].tenant.tenantContact` (Required when parent is present) | `string` |   |
| `[].tenant.registeredBusinessNo` (Required when parent is present) | `string` |   |
| `[].tenant.bankAccountNo` (Required when parent is present) | `string` |   |
| `[].tenant.swiftCode` (Required when parent is present) | `string` |   |
| `[].tenant.iban` (Required when parent is present) | `string` |   |
| `[].tenant.defaultLogoutURL` (Required when parent is present) | `string` |   |
| `[].tenant.postalAddress` (Required when parent is present) | `string` |   |
| `[].tenant.otpTemplateId` | `Translation` | Nested fields omitted: field limit. |
| `[].tenant.smsSenderId` (Required when parent is present) | `number` |   |
| `[].tenant.emailSenderId` (Required when parent is present) | `number` |   |
| `[].tenant.smsSender` (Required when parent is present) | `CommunicationSender` | Recursive schema; nested fields are not repeated. |
| `[].tenant.emailSender` (Required when parent is present) | `CommunicationSender` | Recursive schema; nested fields are not repeated. |
| `[].tenant.products` (Required when parent is present) | `array of Product` | Nested fields omitted: field limit. |
| `[].tenant.users` (Required when parent is present) | `array of User` | Nested fields omitted: field limit. |
| `[].tenant.members` (Required when parent is present) | `array of Member` | Nested fields omitted: field limit. |
| `[].tenant.roles` (Required when parent is present) | `array of Role` | Nested fields omitted: field limit. |
| `[].tenant.subscriptionPlans` (Required when parent is present) | `array of SubscriptionPlan` | Nested fields omitted: field limit. |
| `[].tenant.packages` (Required when parent is present) | `array of Package` | Nested fields omitted: field limit. |
| `[].tenant.invoices` (Required when parent is present) | `array of Invoice` | Nested fields omitted: field limit. |
| `[].tenant.orders` (Required when parent is present) | `array of Order` | Nested fields omitted: field limit. |
| `[].tenant.paymentProviders` (Required when parent is present) | `array of PaymentProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.newslettersProviderConfig` (Required when parent is present) | `array of NewsletterProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.paymentProviderConfigs` (Required when parent is present) | `array of PaymentProviderConfig` | Nested fields omitted: field limit. |
| `[].tenant.oidcClients` (Required when parent is present) | `array of OidcClient` | Nested fields omitted: field limit. |
| `[].tenant.oauthProviders` (Required when parent is present) | `array of OauthProvider` | Nested fields omitted: field limit. |
| `[].tenant.activityLogs` (Required when parent is present) | `array of ActivityLog` | Nested fields omitted: field limit. |
| `[].tenant.m2m_api_clients` (Required when parent is present) | `array of M2MApiClient` | Nested fields omitted: field limit. |
| `[].tenant.customProperties` (Required when parent is present) | `array of CustomProperty` | Nested fields omitted: field limit. |
| `[].tenant.consents` (Required when parent is present) | `array of Consent` | Nested fields omitted: field limit. |
| `[].tenant.preference` (Required when parent is present) | `Preference` | Nested fields omitted: field limit. |
| `[].tenant.settings` (Required when parent is present) | `TenantSettings` | Nested fields omitted: field limit. |
| `[].tenant.communicationTemplates` (Required when parent is present) | `array of CommunicationTemplate` | Nested fields omitted: field limit. |
| `[].tenant.additionalHostnames` (Required when parent is present) | `array of TenantHostname` | Nested fields omitted: field limit. |
| `[].tenant.exportHistory` (Required when parent is present) | `array of ExportHistory` | Nested fields omitted: field limit. |
| `[].tenant.arReportHistory` (Required when parent is present) | `array of ArReportHistory` | Nested fields omitted: field limit. |
| `[].tenant.mypageCardsSettings` (Required when parent is present) | `array of MypageCardsSettings` | Nested fields omitted: field limit. |
| `[].tenant.webhooks` (Required when parent is present) | `array of Webhook` | Nested fields omitted: field limit. |
| `[].tenant.customOrders` (Required when parent is present) | `array of CustomOrder` | Nested fields omitted: field limit. |
| `[].tenant.customOrderSources` (Required when parent is present) | `array of CustomOrderSource` | Nested fields omitted: field limit. |
| `[].tenant.brandKits` (Required when parent is present) | `array of BrandKit` | Nested fields omitted: field limit. |
| `[].tenant.communicationReceivers` (Required when parent is present) | `array of CommunicationReceiver` | Nested fields omitted: field limit. |
| `[].tenant.id` (Required when parent is present) | `number` |   |
| `[].tenant.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `[].tenant.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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
[
  {
    "senderName": "<senderName>",
    "senderEmail": "string",
    "replyTo": "string",
    "communicationChannel": "sms",
    "providerRegion": "global",
    "status": "pending",
    "requestSentAt": "2019-08-24T14:15:22Z",
    "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": {}
    },
    "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-communications-email-edit-id"></a>
## DEPRECATED: Update a communication set up for third party

`PATCH /api/v1/communications/email/edit/{id}`

**Deprecated**

This endpoint is deprecated as of 2025-10-28. Use PATCH /api/v1/communications/:id/email/edit instead.

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `communicationType` | `string` | Allowed values: `"automation"`, `"crm"`, `"marketing"`, `"otp"`, `"information"`, `"emailStandard"`, `"jobCompletion"`, `"oneOff"` |
| `communicationChannel` | `string` | Allowed values: `"sms"`, `"email"` |
| `emailContent` | `string` | Email content in HTML format |
| `scheduledAt` (Required) | `string (date-time)` | The date and time to schedule the email |
| `timeZone` (Required) | `string` | The timezone for the scheduled date and time |
| `name` | `string` |   |
| `senderId` | `number` |   |
| `consentId` | `number` |   |
| `segmentId` | `number` |   |
| `smsContent` | `string` |   |
| `subject` | `string` |   |
| `emailEditorRawContent` | `object` |   |
| `templateId` | `number` |   |
| `emailPreviewText` | `string` |   |
| `deliveryMethod` | `string` |   |
| `externalEmailBody` | `string` |   |
| `hostName` | `string` | `maxLength`: `255` |

**Example request body**

`application/json`

```json
{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}
```

### Responses

#### 200

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

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

#### 400

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

badRequest, communicationCannotBeUpdated, scheduledTimeMustBeInTheFuture

Same fields as [Update a communication set up (400)](https://www.subrite.no/developers/communications?md=true#patch-api-v1-communications-id).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/email/edit/{id}' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}'
```

### Example response

200 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="patch-api-v1-communications-id-email-edit"></a>
## Update a communication set up for email third party

`PATCH /api/v1/communications/{id}/email/edit`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

Same fields as [DEPRECATED: Update a communication set up for third party (Request body)](https://www.subrite.no/developers/communications?md=true#patch-api-v1-communications-email-edit-id).

**Example request body**

`application/json`

```json
{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}
```

### Responses

#### 200

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

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

#### 400

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

badRequest, communicationCannotBeUpdated, scheduledTimeMustBeInTheFuture

Same fields as [Update a communication set up (400)](https://www.subrite.no/developers/communications?md=true#patch-api-v1-communications-id).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}/email/edit' \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "communicationType": "automation",
  "communicationChannel": "sms",
  "emailContent": "<p>Hello {{name}},</p><p>Your email content here...</p>",
  "scheduledAt": "2019-08-24T14:15:22Z",
  "timeZone": "Europe/Oslo",
  "name": "string",
  "senderId": 0,
  "consentId": 0,
  "segmentId": 0,
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "templateId": 0,
  "emailPreviewText": "string",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "hostName": "string"
}'
```

### Example response

200 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="post-api-v1-communications-id-schedule"></a>
## Schedule a communication

`POST /api/v1/communications/{id}/schedule`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `scheduledAt` | `string (date-time)` |   |

**Example request body**

`application/json`

```json
{
  "scheduledAt": "2019-08-24T14:15:22Z"
}
```

### Responses

#### 201

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

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

#### 400

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

badRequest, scheduledTimeMustBeInTheFuture, scheduledFailed, senderEmailUnapproved

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"scheduledTimeMustBeInTheFuture"`, `"scheduledFailed"`, `"senderEmailUnapproved"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}/schedule' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "scheduledAt": "2019-08-24T14:15:22Z"
}'
```

### Example response

201 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="post-api-v1-communications-id-schedule-cancel"></a>
## Cancel a communication schedule

`POST /api/v1/communications/{id}/schedule/cancel`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 201

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

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

#### 400

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

badRequest, communicationIsNotScheduled

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"communicationIsNotScheduled"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

201 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="post-api-v1-communications-id-sms-test"></a>
## Send a test SMS using the given communication ID to verify SMS content

`POST /api/v1/communications/{id}/sms/test`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `phoneNumbers` (Required) | `array of string` | `maxItems`: `5` |

**Example request body**

`application/json`

```json
{
  "phoneNumbers": [
    "<phoneNumbers>"
  ]
}
```

### Responses

#### 201

#### 400

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

badRequest, communicationChannelNotSupported

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"communicationChannelNotSupported"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

notFound

Same fields as [Test a third party email (404)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-email-test).

**Example response**

`application/json`

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

#### 422

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

smsProviderRequestInvalid

Same fields as [SMS Service API (422)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-send-single-sms).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 502

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

smsProviderUnavailable

Same fields as [SMS Service API (502)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-send-single-sms).

**Example response**

`application/json`

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

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}/sms/test' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "phoneNumbers": [
    "<phoneNumbers>"
  ]
}'
```

<a id="post-api-v1-communications-id-email-test"></a>
## Send a test email using the given communication ID to verify email content

`POST /api/v1/communications/{id}/email/test`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `recipients` (Required) | `array of string (email)` | List of email recipients for the test email · `minItems`: `1`, `maxItems`: `5` |
| `name` | `string` | Name of the communication |
| `senderId` | `number` | The ID of the sender · `minimum`: `1` |
| `communicationType` | `string` | The type of communication · Allowed values: `"marketing"`, `"information"` |
| `consentId` | `number` | The ID of the consent · `minimum`: `1` |
| `segmentId` | `number` | The ID of the segment · `minimum`: `1` |
| `subject` | `string` | The subject of the communication |
| `emailPreviewText` | `string` | The preview text of the communication |
| `templateId` | `number` | The ID of the template · `minimum`: `1` |
| `emailContent` | `string` | The content of the communication |

**Example request body**

`application/json`

```json
{
  "recipients": [
    "recipient1@example.com",
    "recipient2@example.com"
  ],
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string"
}
```

### Responses

#### 201

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

Same fields as [Test a third party email (201)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-email-test).

#### 400

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

badRequest, wrongCommunicationChannel, senderEmailUnapproved

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"wrongCommunicationChannel"`, `"senderEmailUnapproved"` |
| `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 [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

notFound

Same fields as [Test a third party email (404)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-email-test).

**Example response**

`application/json`

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

#### 422

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

emailProviderRequestInvalid

Same fields as [Send a one off email (422)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 502

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

emailProviderUnavailable

Same fields as [Send a one off email (502)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

#### 503

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

emailProviderRateLimited

Same fields as [Send a one off email (503)](https://www.subrite.no/developers/communications?md=true#post-api-v1-communications-one-off-email).

**Example response**

`application/json`

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

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/{id}/email/test' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "recipients": [
    "recipient1@example.com",
    "recipient2@example.com"
  ],
  "name": "string",
  "senderId": 1,
  "communicationType": "marketing",
  "consentId": 1,
  "segmentId": 1,
  "subject": "string",
  "emailPreviewText": "string",
  "templateId": 1,
  "emailContent": "string"
}'
```

### Example response

201 · `application/json`

```json
{
  "success": true,
  "message": "Email sent successfully",
  "id": 123
}
```

<a id="get-api-v1-communications-id-members-preview"></a>
## Preview communication members

`GET /api/v1/communications/{id}/members/preview`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of CommunicationMembersResponseDto` |   |
| `items[].id` (Required when parent is present) | `string` |   |
| `items[].fullName` (Required when parent is present) | `string` |   |
| `items[].email` (Required when parent is present) | `string` |   |
| `items[].phone` (Required when parent is present) | `string` |   |
| `items[].status` | `string` |   |
| `items[].memberNumber` (Required when parent is present) | `number` |   |
| `items[].userId` (Required when parent is present) | `number` | Can be null |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "items": [
    {}
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="get-api-v1-communications-id-members-audience-split"></a>
## Split of a communication audience into existing customers, consent holders and excluded members

`GET /api/v1/communications/{id}/members/audience-split`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `mode` (Required) | `string` | Which rule the split follows: 'none' (no consent object, channel address only), 'consent' (accepted consent required), or 'legitimate\_interests' (existing customers plus consent) · Allowed values: `"none"`, `"consent"`, `"legitimate_interests"` |
| `customerWindowMonths` (Required) | `number` | The customer relationship window applied under legitimate interests · Can be null |
| `segmentTotal` (Required) | `number` | Members of the list with a usable address for the channel |
| `existingCustomers` (Required) | `number` | Reachable as existing customers under legitimate interests |
| `viaConsent` (Required) | `number` | Reachable through accepted consent on the selected consent object |
| `total` (Required) | `number` | Recipients of the send: existingCustomers + viaConsent |
| `excluded` (Required) | `number` | Members of the list the send will not reach |
| `legalReferences` (Required) | `CommunicationAudienceLegalReferencesDto` |   |
| `legalReferences.existingCustomers` (Required) | `string` |   |
| `legalReferences.viaConsent` (Required) | `string` |   |
| `legalReferences.excluded` (Required) | `string` |   |
| `marketingLawShort` (Required) | `string` |   |

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "mode": "none",
  "customerWindowMonths": 0,
  "segmentTotal": 0,
  "existingCustomers": 0,
  "viaConsent": 0,
  "total": 0,
  "excluded": 0,
  "legalReferences": {
    "existingCustomers": "GDPR art. 6(1)(f) · markedsføringsloven § 15(3)",
    "viaConsent": "GDPR art. 6(1)(a) · markedsføringsloven § 15(1)",
    "excluded": "markedsføringsloven § 15(1) · no consent on record"
  },
  "marketingLawShort": "mfl. § 15"
}
```

<a id="get-api-v1-communications-id-members-communicated"></a>
## Get communicated members

`GET /api/v1/communications/{id}/members/communicated`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |

### Responses

#### 200

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

Same fields as [Preview communication members (200)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-id-members-preview).

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "items": [
    {}
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="get-api-v1-communications-id-members-communicated-summary"></a>
## Count the members a communication was sent to and the members it skipped

`GET /api/v1/communications/{id}/members/communicated/summary`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `sent` (Required) | `number` | Members the communication was sent to, each counted once |
| `skippedBounced` (Required) | `number` | Members not sent to because their address hard-bounced or reported spam before |

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "sent": 0,
  "skippedBounced": 0
}
```

<a id="get-api-v1-communications-id-stats"></a>
## Get communication stats

`GET /api/v1/communications/{id}/stats`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `success` (Required) | `number` |   |
| `processed` (Required) | `number` |   |
| `failed` (Required) | `number` |   |
| `total` (Required) | `number` |   |

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "success": 0,
  "processed": 0,
  "failed": 0,
  "total": 0
}
```

<a id="post-api-v1-communications-template-image-upload"></a>
## Upload template image

`POST /api/v1/communications/template-image/upload`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `image` (Required) | `file` |   |

### Responses

#### 201

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

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

#### 400

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

badRequest with errors\[\] = templateImageRequired on `image`

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 413

fileSizeExceeded

#### 415

invalidFileType

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/template-image/upload \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --form 'image=@<file>'
```

### Example response

201 · `application/json`

```json
{
  "imageUrl": "string"
}
```

<a id="get-api-v1-communications-id-email-statistics"></a>
## Get email activity statistics

`GET /api/v1/communications/{id}/email/statistics`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `totalProcessed` (Required) | `number` |   |
| `totalDelivered` (Required) | `number` |   |
| `totalNotDelivered` (Required) | `number` |   |
| `totalHardBounced` (Required) | `number` |   |
| `totalOpened` (Required) | `number` |   |
| `totalUniqueOpened` (Required) | `number` |   |
| `totalClicked` (Required) | `number` |   |
| `totalUniqueClicked` (Required) | `number` |   |
| `totalDeliveredPercentage` (Required) | `number` |   |
| `totalNotDeliveredPercentage` (Required) | `number` |   |
| `totalOpenedPercentage` (Required) | `number` |   |
| `totalClickedPercentage` (Required) | `number` |   |
| `totalNotOpened` (Required) | `number` |   |
| `urlStats` (Required) | `array of UrlStatDto` |   |
| `urlStats[].url` (Required when parent is present) | `string` |   |
| `urlStats[].totalClicks` (Required when parent is present) | `number` |   |
| `urlStats[].uniqueClicks` (Required when parent is present) | `number` |   |
| `urlStats[].shareOfClicks` (Required when parent is present) | `number` |   |
| `urlStats[].shareOfUniqueClicks` (Required when parent is present) | `number` |   |

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "totalProcessed": 0,
  "totalDelivered": 0,
  "totalNotDelivered": 0,
  "totalHardBounced": 0,
  "totalOpened": 0,
  "totalUniqueOpened": 0,
  "totalClicked": 0,
  "totalUniqueClicked": 0,
  "totalDeliveredPercentage": 0,
  "totalNotDeliveredPercentage": 0,
  "totalOpenedPercentage": 0,
  "totalClickedPercentage": 0,
  "totalNotOpened": 0,
  "urlStats": [
    {}
  ]
}
```

<a id="post-api-v1-communications-id-copy"></a>
## Copy a communication setup

`POST /api/v1/communications/{id}/copy`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 201

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

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

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

communicationNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

201 · `application/json`

```json
{
  "id": 0,
  "name": "string",
  "communicationType": "automation",
  "smsContent": "string",
  "subject": "string",
  "emailEditorRawContent": {},
  "emailPreviewText": "string",
  "status": "draft",
  "communicationChannel": "sms",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "senderId": 0,
  "sender": "string",
  "segmentId": 0,
  "segmentName": "string",
  "consentId": 0,
  "consentName": "string",
  "tenantId": 0,
  "adminUserId": 0,
  "adminUserName": "<adminUserName>",
  "emailHtmlPreview": "string",
  "template": {
    "name": "string",
    "templateType": "automation",
    "communicationChannel": "sms",
    "locale": "en",
    "template": "string",
    "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": {}
    },
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "scheduledAt": "2019-08-24T14:15:22Z",
  "completedAt": "2019-08-24T14:15:22Z",
  "deliveryMethod": "string",
  "externalEmailBody": "string",
  "senderEmail": "string"
}
```

<a id="get-api-v1-communications-newsletter-communication-id"></a>
## Get newsletter by communication id

`GET /api/v1/communications/newsletter/communication/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

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

#### 400

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

badRequest

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

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 404

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

newsletterNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"newsletterNotFound"` |
| `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": "newsletterNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "messageId": "string"
}
```

<a id="get-api-v1-communications-newsletter-id"></a>
## Get newsletter by message id

`GET /api/v1/communications/newsletter/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `string` |   |
| `x-tenant-host` (Required) | header | `string` | Host the web copy is served on. The email is only found within the tenant that owns it. |

### Responses

#### 200

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

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

#### 401

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

unauthorized

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

#### 404

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

newsletterNotFound

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/communications/newsletter/{id}' \
  --header 'Authorization: Bearer <token>' \
  --header 'x-tenant-host: <x-tenant-host>'
```

### Example response

200 · `application/json`

```json
{
  "htmlContent": "string"
}
```

<a id="post-api-v1-communications-one-off-email-queue-process"></a>
## Process one-off email queue with pagination

`POST /api/v1/communications/one-off-email-queue/process`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `page` | `number` | Page number for pagination · Default: `1` · `minimum`: `1` |
| `limit` | `number` | Number of emails to process per page · Default: `10` · `minimum`: `1` |

**Example request body**

`application/json`

```json
{
  "page": 1,
  "limit": 10
}
```

### Responses

#### 201

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Resolve an SMS unsubscribe short code (401)](https://www.subrite.no/developers/communications?md=true#get-api-v1-communications-sms-short-links-code).

### Example request

```bash
curl https://api.subrite.no/api/v1/communications/one-off-email-queue/process \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "page": 1,
  "limit": 10
}'
```

### Example response

201 · `application/json`

```json
{}
```
