---
title: Authentication and scopes
summary: Every call except the logins carries an auth token as bearer credential; a token grants scopes, and each operation names the scope it needs.
order: 20
terms: [api-token, auth-token, scope]
see-also: [how-to/auth/log-in-with-an-api-token, explanation/tokens-and-delegation, how-to/auth/create-a-versions-token]
---

# Authentication and scopes

## Bearer token {#bearer}

All calls except the login calls require `Authorization: Bearer <auth token>`. The [[term:auth-token|auth token]] is the Base64 serialisation of the [[page: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 [[term:api-token|API token]] ([[openapi:LoginWithApiToken]]) or, for testing, with a username and password ([[openapi: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 {#delegated}

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 [[openapi:CreateVersionsToken]] (named [[term:version|versions]]), [[openapi:CreateNodesToken]] (named [[term:node|nodes]]) and [[openapi: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 [[openapi:CreateAnonymousToken]] and [[openapi:LoginWithAnonymousToken]]. A path in a request is always relative to the token's root node. [[page:explanation/tokens-and-delegation]] explains how they relate.

## Scopes {#scopes}

Each operation declares the [[term: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 [[term:openapi|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 [[page:api/schemas#Scope]].
