Search the docs
Menu
Updated Edit on GitHub

Console: api-tokens

Copy as Markdown

These routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.

API tokens for scripts, this command line and AI agents.

GET /api/openapi.json

Get the OpenAPI description of the console's routes for API tokens and of the server API.

The OpenAPI 3.1 description of this server's version, with info.version set to the build. Anyone may read it: the same file is on neode.sk.

Answers without a sign-in. neodesk api-tokens spec calls it.

200: The description (application/json)

An OpenAPI 3.1 document

Field Type Required
openapi "3.1.0" yes
info object yes
paths object yes
Error When
500 The description could not be read

GET /api/panel/api-tokens

List your API tokens: name, access, expiry, last use.

Newest first. Tokens are made in the console (account menu, API tokens): a token never makes another one. Only the admin roles (super_admin, admin, server_admin, global_admin) may list them.

neodesk api-tokens list calls it.

Parameter In Type What it is
all query boolean true: every account's tokens (super admins; a token only when it is full); default false

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.tokens array of ApiToken and object
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

GET /api/panel/api-tokens/current

Show the token this command line uses, its account and what it may do now.

Answers 404 with code no_token to a request without an API token.

neodesk api-tokens current calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.api_token ApiToken
data.account object
data.account.id integer
data.account.username string
data.account.role string
data.permissions array of string What it may do now: its permissions that the account still holds
data.full boolean It is full: made with every permission of its account, it may do what the account may do now
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
404 There is no such item, or the account does not see it

GET /api/panel/api-tokens/permissions

List the permissions a new token of yours could get.

Only the admin roles may call it.

neodesk api-tokens permissions calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.permissions array of string The ones you hold, which a new token may get
data.all array of string Every permission, sorted
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

DELETE /api/panel/api-tokens/{id}

Revoke an API token at once. Scripts that use it stop working.

Your own token, or any for a super admin (a token of a super admin only when it is full); another account's answers 404. What was made with the token ends with it: guest links, device tokens, support sessions, invites, pairing codes, share links and organization invitations, counted under ended. The computers it let in stay. A token revoked before answers as it is.

neodesk api-tokens revoke calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The token's id, its hint (ndt_<id>_…) or the whole token

200: Done (application/json)

Field Type Required
success true yes
data ApiToken and object 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
404 There is no such item, or the account does not see it

Type to search pages, sections, commands and settings.