# Distribution

**Summary:** Endpoints for Distribution

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

<a id="get-api-v1-distribution-titles"></a>
## List the DI titles the tenant can generate distribution files for

`GET /api/v1/distribution/titles`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `[].diProductCode` (Required when parent is present) | `string` |   |
| `[].productNames` (Required when parent is present) | `array of string` |   |
| `[].publicationDays` (Required when parent is present) | `string` | Weekdays the title is published, digits 1-7 where 1 is Monday. · Can be null |

#### 401

unauthorized

#### 403

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

forbiddenResource

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

### Example request

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

### Example response

200 · `application/json`

```json
[
  {
    "diProductCode": "ABC",
    "productNames": [],
    "publicationDays": "4"
  }
]
```

<a id="get-api-v1-distribution-runs"></a>
## List distribution runs, newest distribution date first

`GET /api/v1/distribution/runs`

**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` · `DistributionRunResponseDtoPaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of DistributionRunResponseDto` |   |
| `items[].id` (Required when parent is present) | `number` |   |
| `items[].diProductCode` (Required when parent is present) | `string` |   |
| `items[].distributionDate` (Required when parent is present) | `string` |   |
| `items[].transType` (Required when parent is present) | `DISTRIBUTION_TRANS_TYPE` | Allowed values: `"C"`, `"T"` |
| `items[].status` (Required when parent is present) | `DISTRIBUTION_RUN_STATUS` | Allowed values: `"queued"`, `"started"`, `"completed"`, `"failed"` |
| `items[].startedBy` (Required when parent is present) | `string` | Can be null |
| `items[].generatedAt` (Required when parent is present) | `string (date-time)` | Can be null |
| `items[].addressParseFailureCount` (Required when parent is present) | `number` |   |
| `items[].addressStoppedCount` (Required when parent is present) | `number` | How many of the address failures this run wrote as Type=S. |
| `items[].error` (Required when parent is present) | `string` | Can be null |
| `items[].files` (Required when parent is present) | `array of DistributionFileResponseDto` |   |
| `items[].files[].id` (Required when parent is present) | `number` |   |
| `items[].files[].kind` (Required when parent is present) | `DISTRIBUTION_FILE_KIND` | Allowed values: `"subscriber_deliveries"`, `"messages"`, `"single_copy_retailers"`, `"single_copy_quantities"` |
| `items[].files[].fileName` (Required when parent is present) | `string` |   |
| `items[].files[].byteSize` (Required when parent is present) | `number` |   |
| `items[].files[].rowCount` (Required when parent is present) | `number` |   |
| `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 [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

### Example request

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

### Example response

200 · `application/json`

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

<a id="post-api-v1-distribution-runs"></a>
## Start generating the four DI files for one title and distribution date

`POST /api/v1/distribution/runs`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `diProductCode` (Required) | `string` | DI product code of the title, as set on its products. · `pattern`: `/^[A-Za-z0-9]{1,5}$/` |
| `distributionDate` (Required) | `string` | The delivery date the files describe, YYYY-MM-DD. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |

**Example request body**

`application/json`

```json
{
  "diProductCode": "ABC",
  "distributionDate": "2026-08-27"
}
```

### Responses

#### 201

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

| Name | Type | Description |
| --- | --- | --- |
| `id` (Required) | `number` |   |
| `diProductCode` (Required) | `string` |   |
| `distributionDate` (Required) | `string` |   |
| `transType` (Required) | `DISTRIBUTION_TRANS_TYPE` | Allowed values: `"C"`, `"T"` |
| `status` (Required) | `DISTRIBUTION_RUN_STATUS` | Allowed values: `"queued"`, `"started"`, `"completed"`, `"failed"` |
| `startedBy` (Required) | `string` | Can be null |
| `generatedAt` (Required) | `string (date-time)` | Can be null |
| `addressParseFailureCount` (Required) | `number` |   |
| `addressStoppedCount` (Required) | `number` | How many of the address failures this run wrote as Type=S. |
| `error` (Required) | `string` | Can be null |
| `files` (Required) | `array of DistributionFileResponseDto` |   |
| `files[].id` (Required when parent is present) | `number` |   |
| `files[].kind` (Required when parent is present) | `DISTRIBUTION_FILE_KIND` | Allowed values: `"subscriber_deliveries"`, `"messages"`, `"single_copy_retailers"`, `"single_copy_quantities"` |
| `files[].fileName` (Required when parent is present) | `string` |   |
| `files[].byteSize` (Required when parent is present) | `number` |   |
| `files[].rowCount` (Required when parent is present) | `number` |   |
| `addressParseFailures` (Required) | `array of AddressParseFailureDto` | Deliveries left out because the address could not be split; stopped ones first. |
| `addressParseFailures[].memberPackageId` (Required when parent is present) | `number` |   |
| `addressParseFailures[].memberNumber` (Required when parent is present) | `number` | Can be null |
| `addressParseFailures[].name` (Required when parent is present) | `string` |   |
| `addressParseFailures[].line1` (Required when parent is present) | `string` |   |
| `addressParseFailures[].stopped` (Required when parent is present) | `boolean` | True when this run wrote the delivery as Type=S, so the subscriber lost delivery. |

#### 400

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

Body validation failed, or the tenant has no DI customer code

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"distributionCustomerSystemMissing"` |
| `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`

DI is not enabled for the tenant, or the user lacks access to data exports

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

#### 404

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

distributionTitleNotFound

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

#### 409

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

A run for this title and date already exists, or another run of the title is unfinished

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

#### 500

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

internalServerError

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

**Example response**

`application/json`

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

#### 503

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

distributionQueueFailed

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

### Example request

```bash
curl https://api.subrite.no/api/v1/distribution/runs \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "diProductCode": "ABC",
  "distributionDate": "2026-08-27"
}'
```

### Example response

201 · `application/json`

```json
{
  "id": 0,
  "diProductCode": "string",
  "distributionDate": "2026-08-27",
  "transType": "C",
  "status": "queued",
  "startedBy": "string",
  "generatedAt": "2019-08-24T14:15:22Z",
  "addressParseFailureCount": 0,
  "addressStoppedCount": 0,
  "error": "string",
  "files": [
    {}
  ],
  "addressParseFailures": [
    {}
  ]
}
```

<a id="get-api-v1-distribution-runs-id"></a>
## Get one distribution run with its files and address problems

`GET /api/v1/distribution/runs/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

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

Same fields as [Start generating the four DI files for one title and distribution date (201)](https://www.subrite.no/developers/distribution?md=true#post-api-v1-distribution-runs).

#### 400

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

badRequest

Same fields as [List distribution runs, newest distribution date first (400)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-runs).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

**Example response**

`application/json`

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

#### 404

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

distributionRunNotFound

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

#### 500

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

internalServerError

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "id": 0,
  "diProductCode": "string",
  "distributionDate": "2026-08-27",
  "transType": "C",
  "status": "queued",
  "startedBy": "string",
  "generatedAt": "2019-08-24T14:15:22Z",
  "addressParseFailureCount": 0,
  "addressStoppedCount": 0,
  "error": "string",
  "files": [
    {}
  ],
  "addressParseFailures": [
    {}
  ]
}
```

<a id="get-api-v1-distribution-files-id-download"></a>
## Download a stored DI file; the file name is in the X-Filename header

`GET /api/v1/distribution/files/{id}/download`

**Authentication:** Bearer token (JWT)

### Parameters

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

### Responses

#### 200

Content type: `application/xml` · `any`

The XML file, ISO-8859-1 encoded

#### 400

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

badRequest

Same fields as [List distribution runs, newest distribution date first (400)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-runs).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

**Example response**

`application/json`

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

#### 404

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

distributionFileNotFound

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

#### 500

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

internalServerError

Same fields as [List the DI titles the tenant can generate distribution files for (403)](https://www.subrite.no/developers/distribution?md=true#get-api-v1-distribution-titles).

#### 502

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

distributionFileDownloadFailed

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

### Example request

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