Exchange a username and password for a bearer token.
const url = 'https://example.com/api/v1/auth/login';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"password":"example","username":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/auth/login \ --header 'Content-Type: application/json' \ --data '{ "password": "example", "username": "example" }'Takes Admin with no permission guard in front of it — unlike every other handler — because
there is nothing to authenticate yet. A skeleton deployment answering 503 here is correct and
not a disclosure: “there is no user store” is exactly what a would-be logger-in needs to know.
Authorizations
Section titled “Authorizations”- None
Request Bodyrequired
Section titled “Request Bodyrequired”Login request body. Never logged, never echoed.
object
Examplegenerated
{ "password": "example", "username": "example"}Responses
Section titled “Responses”A bearer token and the role it carries
A freshly issued session.
object
The role it carries, so the UI can render the right navigation immediately.
The bearer token for subsequent requests.
Example
{ "role": "viewer"}Incorrect username or password — one code for both, so the endpoint is not an account-enumeration oracle
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Too many attempts; Retry-After carries the wait in seconds
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Skeleton mode has no user store, so there is nothing to log in to
The ADR-019 envelope every failure renders as. pub(crate) and schema-bearing so the OpenAPI
document can name one error shape for every endpoint (ADR-035) instead of leaving 4xx/5xx bodies
undescribed — a client that has to guess the failure shape ends up parsing the success shape and
reading undefined.
object
object
Stable machine-readable code. Clients branch on this, never on the message.
Operator-facing sentence. Safe to display; never carries an internal error’s own text.
Examplegenerated
{ "error": { "code": "example", "message": "example" }}