# Server-API: pairing codes

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

> 3 Operationen. Short one-time codes a person types into NeoDesk Desktop or NeoDesk Companion to configure it for this server.

Diese Routen liegen auf der Server-API, Port 21114 (21121 in Docker). Sie nehmen einen API-Schlüssel in `X-API-Key` oder ein Anmelde-Token; siehe [Die HTTP-API](https://docs.neode.sk/de/development/api.md#signing-in). Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

Short one-time codes a person types into NeoDesk Desktop or NeoDesk Companion to configure it for this server.

## GET /api/pairing/codes

List pairing codes that can still be redeemed.

Oldest first, without the codes themselves. Only the codes of NeoDesk Desktop and NeoDesk Companion pairing; join and support codes are not in the list.

On the server API, port 21114. Needs `enrollment.approve`.

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

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

| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |

## POST /api/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; the server keeps only its hash.

On the server API, port 21114. Needs `enrollment.approve`.

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 credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 500 | The code could not be made or stored |

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

Delete a pairing code before it is used.

On the server API, port 21114. Needs `enrollment.approve`.

| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
| `id` | path | string | yes | The code ID (see GET /api/pairing/codes) |

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

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

| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
| 404 | pairing code not found |
