# Server API: pairing codes

Source: https://docs.neode.sk/development/api-reference/server-pairing-codes/
Last updated: 2026-12-03

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

These routes are on the server API, port 21114 (21121 in Docker). They take an API key in `X-API-Key` or a sign-in token; see [The HTTP API](https://docs.neode.sk/development/api.md#signing-in).

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/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/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 |
