# Export channels

> Channels API · Import Export

```http
POST /api/channel-export/
```

Returns the channels as one JSON document, sent as a file download. To recreate the channels, on this unit or another, send that document as `payload` in the import request. The whole document must go across exactly as returned, edits are not supported.

Any authenticated user can call it.

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Request body

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

- `channels` · object · Optional — The `metadata.name` of each channel to export. Absent or empty, every channel is exported. A name with no channel is skipped.
  - One of the following variants:
    - **array** (list of strings)
      - Array items (string):
    - **null** (null)
- `includeServices` · boolean · Optional · _Defaults to true_ — Include the unit-specific settings needed to restore the channels exactly. Off, the export holds the channel specs only.
- `description` · object · Optional — Free text stored in the export.
  - One of the following variants:
    - **string** (string)
    - **null** (null)

## Example request

```bash
curl -X POST "/api/channel-export/" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "channels": [
    "string"
  ],
  "includeServices": true,
  "description": "string"
}'
```

## Responses

### 200 — The export.

- `schemaVersion` · string · Optional · _Defaults to 1_ — The export's format version. Import accepts `1`.
- `description` · object · Optional — The `description` given when the export was made.
  - One of the following variants:
    - **string** (string)
    - **null** (null)
- `exportedAt` · string · **Required** · _format: date-time_ — When the export was made.
- `sourceVersion` · object · Optional — The software version of the unit that made the export.
  - One of the following variants:
    - **string** (string)
    - **null** (null)
- `sourceBeamVersion` · object · Optional — The Beam software version of the unit that made the export, when it could be read.
  - One of the following variants:
    - **string** (string)
    - **null** (null)
- `channels` · list of objects · **Required** — The exported channels. Each entry is made by export, and its contents aren't documented. Leave them as returned: the whole export document goes to import as `payload`.
  - Array items (object):

Example:

```json
{
  "schemaVersion": "1",
  "description": "string",
  "exportedAt": "2024-01-01T00:00:00Z",
  "sourceVersion": "string",
  "sourceBeamVersion": "string",
  "channels": [
    {}
  ]
}
```

### 401 — - Sign-in needed (AUTH-0002). - Sign-in expired (AUTH-0003). - Sign-in not valid (AUTH-0004).

- `detail` · string · **Required** — The first entry's `userMessage`, for a caller that reads only one string.
- `status` · integer · **Required** — The HTTP status of this response, repeated so a stored copy of the body is complete.
- `errors` · list of objects · **Required** — Each problem found. Never empty. `detail` repeats the first one.
  - Array items (object):
    - `code` · string · **Required** — Identifies the failure, for example `PLATFORM-0001`. Quote it if you contact support.
    - `transient` · boolean · **Required** — True if the problem may go away on its own, so trying again later could work.
    - `showCode` · boolean · **Required** — A hint that showing `code` to the user is advisable because the problems is unlikely to be resolvable directly by the user. This puts the code in front of the user in the situations where they are most likely to contact support.
    - `userShort` · string · **Required** · _<=40 characters_ — A short label for the problem, written for the user. Can be used as a title or heading.
    - `userMessage` · string · **Required** · _<=512 characters_ — What went wrong and what to do about it, written for the user.
    - `detail` · string · **Required** · _<=512 characters_ — Technical text for an integrator or support. Don't make it the first thing the UI user sees. In some cases, it could be reasonable to make it available to the user if they ask for it, for example in a 'Show technical details' link.
    - `loc` · list of objects · Optional — Where in the request this error is, as a list of keys and indexes, for example `["body", "spec", "outputs", 0, "transport", "url"]`. The first item says which part of the request: `body` or `query`. Empty when the error isn't about a part of the request.
      - Array items (object):
        - One of the following variants:
          - **string** (string)
          - **integer** (integer)

Example:

```json
{
  "detail": "Input should be greater than or equal to 1024",
  "errors": [
    {
      "code": "REQUEST-0021",
      "detail": "spec.outputs[0].transport.port: Input should be greater than or equal to 1024",
      "loc": [
        "body",
        "spec",
        "outputs",
        0,
        "transport",
        "port"
      ],
      "showCode": false,
      "transient": false,
      "userMessage": "Input should be greater than or equal to 1024",
      "userShort": "Invalid value"
    }
  ],
  "status": 422
}
```

### 422 — Invalid value (REQUEST-0021).

- `detail` · string · **Required** — The first entry's `userMessage`, for a caller that reads only one string.
- `status` · integer · **Required** — The HTTP status of this response, repeated so a stored copy of the body is complete.
- `errors` · list of objects · **Required** — Each problem found. Never empty. `detail` repeats the first one.
  - Array items (object):
    - `code` · string · **Required** — Identifies the failure, for example `PLATFORM-0001`. Quote it if you contact support.
    - `transient` · boolean · **Required** — True if the problem may go away on its own, so trying again later could work.
    - `showCode` · boolean · **Required** — A hint that showing `code` to the user is advisable because the problems is unlikely to be resolvable directly by the user. This puts the code in front of the user in the situations where they are most likely to contact support.
    - `userShort` · string · **Required** · _<=40 characters_ — A short label for the problem, written for the user. Can be used as a title or heading.
    - `userMessage` · string · **Required** · _<=512 characters_ — What went wrong and what to do about it, written for the user.
    - `detail` · string · **Required** · _<=512 characters_ — Technical text for an integrator or support. Don't make it the first thing the UI user sees. In some cases, it could be reasonable to make it available to the user if they ask for it, for example in a 'Show technical details' link.
    - `loc` · list of objects · Optional — Where in the request this error is, as a list of keys and indexes, for example `["body", "spec", "outputs", 0, "transport", "url"]`. The first item says which part of the request: `body` or `query`. Empty when the error isn't about a part of the request.
      - Array items (object):
        - One of the following variants:
          - **string** (string)
          - **integer** (integer)

Example:

```json
{
  "detail": "Input should be greater than or equal to 1024",
  "errors": [
    {
      "code": "REQUEST-0021",
      "detail": "spec.outputs[0].transport.port: Input should be greater than or equal to 1024",
      "loc": [
        "body",
        "spec",
        "outputs",
        0,
        "transport",
        "port"
      ],
      "showCode": false,
      "transient": false,
      "userMessage": "Input should be greater than or equal to 1024",
      "userShort": "Invalid value"
    }
  ],
  "status": 422
}
```

### 500 — Internal error. The request could not be completed. `errors[].code` identifies the failure; quote it if you contact support.

- `detail` · string · **Required** — The first entry's `userMessage`, for a caller that reads only one string.
- `status` · integer · **Required** — The HTTP status of this response, repeated so a stored copy of the body is complete.
- `errors` · list of objects · **Required** — Each problem found. Never empty. `detail` repeats the first one.
  - Array items (object):
    - `code` · string · **Required** — Identifies the failure, for example `PLATFORM-0001`. Quote it if you contact support.
    - `transient` · boolean · **Required** — True if the problem may go away on its own, so trying again later could work.
    - `showCode` · boolean · **Required** — A hint that showing `code` to the user is advisable because the problems is unlikely to be resolvable directly by the user. This puts the code in front of the user in the situations where they are most likely to contact support.
    - `userShort` · string · **Required** · _<=40 characters_ — A short label for the problem, written for the user. Can be used as a title or heading.
    - `userMessage` · string · **Required** · _<=512 characters_ — What went wrong and what to do about it, written for the user.
    - `detail` · string · **Required** · _<=512 characters_ — Technical text for an integrator or support. Don't make it the first thing the UI user sees. In some cases, it could be reasonable to make it available to the user if they ask for it, for example in a 'Show technical details' link.
    - `loc` · list of objects · Optional — Where in the request this error is, as a list of keys and indexes, for example `["body", "spec", "outputs", 0, "transport", "url"]`. The first item says which part of the request: `body` or `query`. Empty when the error isn't about a part of the request.
      - Array items (object):
        - One of the following variants:
          - **string** (string)
          - **integer** (integer)

Example:

```json
{
  "detail": "Input should be greater than or equal to 1024",
  "errors": [
    {
      "code": "REQUEST-0021",
      "detail": "spec.outputs[0].transport.port: Input should be greater than or equal to 1024",
      "loc": [
        "body",
        "spec",
        "outputs",
        0,
        "transport",
        "port"
      ],
      "showCode": false,
      "transient": false,
      "userMessage": "Input should be greater than or equal to 1024",
      "userShort": "Invalid value"
    }
  ],
  "status": 422
}
```

### 503 — Temporarily unavailable (CONN-0004).

- `detail` · string · **Required** — The first entry's `userMessage`, for a caller that reads only one string.
- `status` · integer · **Required** — The HTTP status of this response, repeated so a stored copy of the body is complete.
- `errors` · list of objects · **Required** — Each problem found. Never empty. `detail` repeats the first one.
  - Array items (object):
    - `code` · string · **Required** — Identifies the failure, for example `PLATFORM-0001`. Quote it if you contact support.
    - `transient` · boolean · **Required** — True if the problem may go away on its own, so trying again later could work.
    - `showCode` · boolean · **Required** — A hint that showing `code` to the user is advisable because the problems is unlikely to be resolvable directly by the user. This puts the code in front of the user in the situations where they are most likely to contact support.
    - `userShort` · string · **Required** · _<=40 characters_ — A short label for the problem, written for the user. Can be used as a title or heading.
    - `userMessage` · string · **Required** · _<=512 characters_ — What went wrong and what to do about it, written for the user.
    - `detail` · string · **Required** · _<=512 characters_ — Technical text for an integrator or support. Don't make it the first thing the UI user sees. In some cases, it could be reasonable to make it available to the user if they ask for it, for example in a 'Show technical details' link.
    - `loc` · list of objects · Optional — Where in the request this error is, as a list of keys and indexes, for example `["body", "spec", "outputs", 0, "transport", "url"]`. The first item says which part of the request: `body` or `query`. Empty when the error isn't about a part of the request.
      - Array items (object):
        - One of the following variants:
          - **string** (string)
          - **integer** (integer)

Example:

```json
{
  "detail": "Input should be greater than or equal to 1024",
  "errors": [
    {
      "code": "REQUEST-0021",
      "detail": "spec.outputs[0].transport.port: Input should be greater than or equal to 1024",
      "loc": [
        "body",
        "spec",
        "outputs",
        0,
        "transport",
        "port"
      ],
      "showCode": false,
      "transient": false,
      "userMessage": "Input should be greater than or equal to 1024",
      "userShort": "Invalid value"
    }
  ],
  "status": 422
}
```

---

Source spec: `channels-api` · operationId: `exportChannels`
