# Import

**Summary:** Endpoints for Import

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

<a id="get-api-v1-import"></a>
## Get all import histories of the tenant

`GET /api/v1/import`

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

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of ImportHistoryResponse` |   |
| `items[].id` (Required when parent is present) | `number` |   |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].createdBy` (Required when parent is present) | `string` |   |
| `items[].adminUserId` (Required when parent is present) | `number` |   |
| `items[].type` (Required when parent is present) | `string` | Allowed values: `"update_members"`, `"ocr"`, `"external_payment"`, `"subscriptions"` |
| `items[].fileName` (Required when parent is present) | `string` |   |
| `items[].reference` (Required when parent is present) | `string` |   |
| `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` |   |

#### 401

unauthorized

#### 403

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

forbiddenResource

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

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl https://api.subrite.no/api/v1/import \
  --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-import-history-id"></a>
## Get download stream of an import by id

`GET /api/v1/import/history/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |
| `format` (Required) | query | `string` | Allowed values: `"csv"`, `"xlsx"`, `"xls"`, `"DAT"`, `"pdf"`, `"xml"` |

### Responses

#### 200

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 404

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

notFound,invalidFileUrl

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/import/history/{id}?format=csv' \
  --header 'Authorization: Bearer <token>'
```

<a id="patch-api-v1-import-members"></a>
## Update members info by uploading file

`PATCH /api/v1/import/members`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `identifier` (Required) | `string` |   |
| `file` (Required) | `file` |   |

### Responses

#### 200

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

| Name | Type | Description |
| --- | --- | --- |
| `successCount` (Required) | `number` | Default: `0` |
| `failureCount` (Required) | `number` | Default: `0` |
| `failedUpdates` (Required) | `array of FailedUpdates` | Default: `[]` |
| `failedUpdates[].identifier` (Required when parent is present) | `object` |   |
| `failedUpdates[].fieldName` | `string` |   |
| `failedUpdates[].errorMessage` (Required when parent is present) | `string` |   |
| `failedUpdates[].detail` | `string` |   |
| `failedUpdates[].errorType` | `string` |   |

#### 400

invalidInputFormat, duplicateUniqueKey

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl https://api.subrite.no/api/v1/import/members \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --form 'identifier=string' \
  --form 'file=@<file>'
```

### Example response

200 · `application/json`

```json
{
  "successCount": 0,
  "failureCount": 0,
  "failedUpdates": []
}
```

<a id="patch-api-v1-import-members-check-consent-has-configured"></a>
## Check if consent has configured

`PATCH /api/v1/import/members/check-consent-has-configured`

**Authentication:** Bearer token (JWT)

### Request body

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

| Name | Type | Description |
| --- | --- | --- |
| `file` | `file` |   |

### Responses

#### 200

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

#### 400

invalidInputFormat, duplicateUniqueKey

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl https://api.subrite.no/api/v1/import/members/check-consent-has-configured \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --form 'file=@<file>'
```

### Example response

200 · `application/json`

```json
true
```

<a id="get-api-v1-import-members-fields"></a>
## Get all available fields for member update

`GET /api/v1/import/members/fields`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

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

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

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

### Example response

200 · `application/json`

```json
{
  "availableFields": [
    "string"
  ],
  "availableIdentifiers": [
    "string"
  ],
  "notUpdatableFields": [
    "string"
  ],
  "consentKeys": [
    {
      "communications": [],
      "metaData": {}
    }
  ]
}
```

<a id="patch-api-v1-import-external-payments"></a>
## Update external payments by uploading file

`PATCH /api/v1/import/external-payments`

**Authentication:** Bearer token (JWT)

### Request body

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

Same fields as [Update members info by uploading file (Request body)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members).

### Responses

#### 200

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

Same fields as [Update members info by uploading file (200)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members).

#### 400

invalidInputFormat, duplicateUniqueKey

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl https://api.subrite.no/api/v1/import/external-payments \
  --request PATCH \
  --header 'Authorization: Bearer <token>' \
  --form 'identifier=string' \
  --form 'file=@<file>'
```

### Example response

200 · `application/json`

```json
{
  "successCount": 0,
  "failureCount": 0,
  "failedUpdates": []
}
```

<a id="post-api-v1-import-ocr"></a>
## Update e-invoice payments by uploading OCR file

`POST /api/v1/import/ocr`

**Authentication:** Bearer token (JWT)

### Request body

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

Same fields as [Check if consent has configured (Request body)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members-check-consent-has-configured).

### Responses

#### 201

#### 400

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

invalidInputFormat

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

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

<a id="post-api-v1-import-subscriptions-validate"></a>
## Validate subscription import file before import

`POST /api/v1/import/subscriptions/validate`

**Authentication:** Bearer token (JWT)

### Request body

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

Same fields as [Check if consent has configured (Request body)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members-check-consent-has-configured).

### Responses

#### 200

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

Validation completed with list of existing emails

| Name | Type | Description |
| --- | --- | --- |
| `existingMembers` (Required) | `array of string` | Identifiers from the file that already name a member — the email, or the phone number for a row that carries no email |

#### 201

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

Same fields as [Validate subscription import file before import (200)](https://www.subrite.no/developers/import?md=true#post-api-v1-import-subscriptions-validate).

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

```bash
curl https://api.subrite.no/api/v1/import/subscriptions/validate \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --form 'file=@<file>'
```

### Example response

200 · `application/json`

```json
{
  "existingMembers": [
    "john@example.com",
    "<phone>"
  ]
}
```

<a id="post-api-v1-import-subscriptions"></a>
## Import subscriptions from a file

`POST /api/v1/import/subscriptions`

**Authentication:** Bearer token (JWT)

### Request body

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

Same fields as [Check if consent has configured (Request body)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members-check-consent-has-configured).

### Responses

#### 201

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

Same fields as [Update members info by uploading file (200)](https://www.subrite.no/developers/import?md=true#patch-api-v1-import-members).

#### 400

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

shouldNotExistForUnpaidSubscription, shouldExistForPaidSubscription, invalidFieldValue, duplicateFieldValue, shouldNotExistForFreeSubscription, invalidFieldValue, shouldNotExistForHiddenProduct, exceedsMaxAllowedQuantity, missingRequiredOptionalProduct

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

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

### Example response

201 · `application/json`

```json
{
  "successCount": 0,
  "failureCount": 0,
  "failedUpdates": []
}
```

<a id="get-api-v1-import-ocr-file-sftp"></a>
## Get all ocr files from sftp

`GET /api/v1/import/ocr-file-sftp`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

#### 401

unauthorized

#### 403

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

forbiddenResource

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

**Example response**

`application/json`

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

#### 500

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

internalServerError

Same fields as [Get all import histories of the tenant (403)](https://www.subrite.no/developers/import?md=true#get-api-v1-import).

### Example request

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