scope-enforcement

2 endpoints.

GET/api/scope-enforcement Bearer token
Scopesettings:read

Read the scope enforcement and who still lacks scopes

Whether a token missing a scope an endpoint requires is refused (`enforce`) or let through and recorded (`report`), and the record of the last week: the requests whose token lacked a scope, by the client the tokens came from — people's browser sign-ins, agents, or a program — with the accounts, the scopes they lacked and how many were refused. Superusers only.

Responses

StatusDescriptionBody
200The setting and the readout.ScopeEnforcement
401The access token is missing or invalid.ErrorResponse
403The access token's subject is not a superuser. Also when the access token lacks `settings:read` (`insufficient_scope`).ErrorResponse
500The setting could not be read.ErrorResponse
PATCH/api/scope-enforcement Bearer token
Scopesettings:write

Switch scope enforcement

Sets whether tokens missing a scope are refused (`enforce`) or only recorded (`report`). Takes effect on every server instance within 15 seconds. The `API_SCOPE_ENFORCEMENT` environment variable, when set, overrides it. Superusers only.

Request body

application/jsonrequiredUpdateScopeEnforcementRequest
FieldTypeRequiredDescription
modestringyes

one of "report" | "enforce"

Responses

StatusDescriptionBody
200The setting as now stored, and the readout.ScopeEnforcement
400The request body failed validation.ErrorResponse
401The access token is missing or invalid.ErrorResponse
403The access token's subject is not a superuser. Also when the access token lacks `settings:write` (`insufficient_scope`).ErrorResponse
500The setting could not be changed.ErrorResponse