Authentication and scopes
Every call except the logins carries an auth token as bearer credential; a token grants scopes, and each operation names the scope it needs.
Bearer token#
All calls except the login calls require Authorization: Bearer <auth token>. The auth token is the Base64 serialisation of the api/schemas#Auth object every login and token-creation call returns; pass "response_format": "base64" to receive only that string. Obtain it by logging in with an API token (LoginWithApiToken) or, for testing, with a username and password (LoginWithUsernamePassword). The API token itself never goes into any other request.
An auth token is valid for at most the instance's api_token_validity (90 days by default) and never longer than the API token it was made from; when it expires, log in again.
Delegated tokens#
A login with a username and password has every scope; a login with an API token has the scopes the API token was created with. Narrower tokens, for browsers and third parties, come from CreateVersionsToken (named versions), CreateNodesToken (named nodes) and CreateRecursiveNodeToken (a node and everything below it), each with its own scopes (never more than the credential that creates it has), a required expiry in seconds (expires_seconds) and an optional IP restriction. Anonymous access is the pair CreateAnonymousToken and LoginWithAnonymousToken. A path in a request is always relative to the token's root node. Tokens and delegation explains how they relate.
Scopes#
Each operation declares the Scope a token needs (x-required-scopes in the document; the Scope box on every operation page), and a call outside the token's scopes is refused with 403. The OpenAPI uses fs:read, fs:write, model:read, model:write, model:upload, geometry:read, query:run, checks:run, gis:read, gis:write, actions:read, actions:write, workspaces:read, workspaces:write, links:read, links:write, ai:use, tokens:issue, account:read, account:write, admin:read and admin:write; the closed catalogue, shared with the task API, is api/schemas#Scope.