Skip to main content
POST
API-Token erstellen

Authorizations

Authorization
string
header
required

Access-Token aus POST /auth/login (E-Mail und Passwort), gesendet als Authorization: Bearer <token>.

Das Token ist zeitlich begrenzt gültig. Mit dem refresh_token aus derselben Antwort holt POST /auth/token/refresh ein neues Token-Paar, ohne das Passwort erneut zu senden; POST /auth/token/invalidate macht den Refresh-Token beim Abmelden ungültig.

Ist für das Konto ein zweiter Faktor aktiv oder vorgeschrieben, liefert der Login statt des Token-Paars mfaRequired: true bzw. mfaEnrollmentRequired: true und ein kurzlebiges preAuthToken. Mit diesem Token (ebenfalls als Bearer) wird der zweite Faktor über POST /auth/2fa/verify bestätigt; erst danach gibt es das volle Token-Paar.

Headers

X-Customer-Id
string

Optionaler Kundenkontext. Ohne Header arbeitet die Anfrage im Standard-Kunden des angemeldeten Benutzers. Mit der ID eines anderen Kunden handelt die Anfrage in dessen Kontext: Listen, Lese- und Schreibzugriffe beziehen sich dann auf diesen Kunden.

Erlaubt sind der eigene Kunde, jeder Unterkunde im eigenen Teilbaum (Reseller handelt für seinen Endkunden) sowie Kunden, in denen der Benutzer selbst Mitglied ist. Übergeordnete oder fremde Kunden werden mit 403 Forbidden abgewiesen, eine unbekannte ID ebenfalls.

Die IDs der erreichbaren Kunden liefern GET /user/customers und GET /customers/{id}/children.

Example:

"01JD4Q8W3N6Y2K5T7R9V0B1C2D"

Body

application/json

The new ApiToken resource

description
string | null

Description of the API token

Required string length: 3 - 255
Example:

"My API token"

expiresAt
string<date-time> | null

Date and time when the API token expires (at most 365 days in the future). If null, the token never expires.

Example:

"2021-01-01T00:00:00+00:00"

scope
enum<string>

Scope of the token: "read" allows only GET/HEAD/OPTIONS, "write" additionally allows modifying requests. Defaults to "read".

Available options:
read,
write
Example:

"read"

Response

ApiToken resource created

id
string
Example:

"A1B2C3D4E5F6G7H8I9J0"

token
string

The secret. Shown only once; store it securely. Send it in the X-API-TOKEN header.

Example:

"api_1a2b3c4d…"

tokenPrefix
string

First characters of the secret, shown in token lists.

Example:

"api_1a2b3c4d"

scope
string

Scope of the token: read or write.

Example:

"read"

customerId
string

Customer the token is bound to.

customerName
string
Example:

"Acme GmbH"

description
string | null
Example:

"My API token"

expiresAt
string<date-time> | null
Example:

"2021-01-01T00:00:00+00:00"