# Konsole: pairing

Quelle: https://docs.neode.sk/de/development/api-reference/console-pairing/
Zuletzt geändert: 2026-12-03

> 5 Operationen. Pairing codes for NeoDesk Desktop and NeoDesk Companion.

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als `Authorization: Bearer ndt_...`; siehe [API-Tokens](https://docs.neode.sk/de/command-line/api-tokens.md). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

Pairing codes for NeoDesk Desktop and NeoDesk Companion.

## POST /api/companion-pairing/activate

Approve a waiting NeoDesk Companion under a name.

A Companion that waits for approval is approved under the name; a device the server knows already gets the name. With folder_id the device goes into that folder, which must be open to the account. A known device must be one the account sees. A refusal of the server API is answered with 502 and its answer.

Needs `enrollment.approve`. `neodesk pairing activate` calls it.

Request body, `application/json`:

| Field | Type | Required | What it is |
|---|---|---|---|
| `device_id` | string | yes | Letters, digits and _ . : -, 3 to 128 of them |
| `display_name` | string |  | Cut to 120 characters |
| `folder_id` | integer or string |  | Put the device into this folder |

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `device_id` | string | yes |

| Error | When |
|---|---|
| 400 | invalid_device_id |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 500 | The device scope could not be read |
| 502 | The server API refused, or the folder could not be assigned |

## GET /api/panel/pairing/codes

List pairing codes for NeoDesk Desktop and NeoDesk Companion.

Oldest first, without the codes themselves.

Needs `enrollment.approve`. `neodesk pairing list` calls it.

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `codes` | array of [PairingCode](https://docs.neode.sk/de/development/api-reference/schemas.md#pairingcode) | yes |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 502 | The server API did not answer or refused |

## POST /api/panel/pairing/codes

Make a pairing code.

A code is 6 characters, works once and expires after 10 minutes. The answer holds the code, the only time it is shown.

Needs `enrollment.approve`. `neodesk pairing create` calls it.

Request body, `application/json`:

| Field | Type | What it is |
|---|---|---|
| `label` | string | What it is for, cut to 64 characters |

**201**: Created (`application/json`)

[NewPairingCode](https://docs.neode.sk/de/development/api-reference/schemas.md#newpairingcode).

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 413 | The body is larger than 4 kB |
| 502 | The server API did not answer or refused |

## DELETE /api/panel/pairing/codes/{id}

Delete a pairing code.

Needs `enrollment.approve`. `neodesk pairing delete` calls it. It cannot be undone.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The code ID (see pairing list): 8 to 32 hex digits |

**200**: Done (`application/json`)

| Field | Type |
|---|---|
| `success` | `true` |
| `id` | string |

| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
| 404 | There is no such item, or the account does not see it |
| 502 | The server API did not answer or refused |

## GET /api/panel/pairing/host

Show the address NeoDesk Desktop and NeoDesk Companion pair with.

Needs `enrollment.approve`. `neodesk pairing host` calls it.

**200**: Done (`application/json`)

| Field | Type | Required |
|---|---|---|
| `success` | `true` | yes |
| `host` | string | yes |

| Error | When |
|---|---|
| 401 | No session or API token, or one that is not valid (code session_required or token_invalid) |
| 403 | The account or the token may not do this, or a write from a browser came without a good CSRF token |
