Server-API: API keys
Als Markdown kopierenDiese 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. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.
The API keys of the server API, sent as X-API-Key.
List the API keys of the server API.
Never the key itself, only its first 8 characters.
On the server API, port 21114. Needs server.keys.
200: Done (application/json)
An array of object; each item:
| Field | Type | What it is |
|---|---|---|
[].id |
integer | |
[].key_prefix |
string | |
[].name |
string | |
[].role |
string | |
[].created_at |
string (date-time) | |
[].expires_at |
string (date-time) | UTC, "2006-01-02 15:04:05"; left out for none |
[].last_used |
string (date-time) |
| Error | When |
|---|---|
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
Make an API key of the server API.
The key acts with the role it is given: only a role you may give, and a role that gives no role cannot make keys at all. The key is in the answer this once.
On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Needs server.keys.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
name |
string | yes | |
role |
string, one of super_admin, admin, global_admin, server_admin, operator, viewer, guest_issuer, pro |
Default viewer | |
expires_in_days |
integer | Days until it expires; 0 or none for never; at least 0 |
201: Made (application/json)
| Field | Type | What it is |
|---|---|---|
id |
integer | |
key |
string | The key, shown this once |
prefix |
string | |
name |
string | |
role |
string | |
expires_at |
string or null (date-time) | null for never |
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |
Revoke an API key of the server API.
An ID that names no key answers 200 as well.
On the server API, port 21114. Needs the sign-in token of a person; API keys are refused. Needs server.keys.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The key's ID from GET /api/keys |
200: Done (application/json)
| Field | Type |
|---|---|
status |
"revoked" |
| Error | When |
|---|---|
| 400 | The request is not valid |
| 401 | No credential, or one that is not valid |
| 403 | The credential's role lacks the permission |