scope-enforcement
2 endpoints.
GET
/api/scope-enforcement Bearer tokenScopesettings: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
| Status | Description | Body |
|---|---|---|
| 200 | The setting and the readout. | ScopeEnforcement |
| 401 | The access token is missing or invalid. | ErrorResponse |
| 403 | The access token's subject is not a superuser. Also when the access token lacks `settings:read` (`insufficient_scope`). | ErrorResponse |
| 500 | The setting could not be read. | ErrorResponse |
PATCH
/api/scope-enforcement Bearer tokenScopesettings: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.
| Field | Type | Required | Description |
|---|---|---|---|
| mode | string | yes | one of "report" | "enforce" |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | The setting as now stored, and the readout. | ScopeEnforcement |
| 400 | The request body failed validation. | ErrorResponse |
| 401 | The access token is missing or invalid. | ErrorResponse |
| 403 | The access token's subject is not a superuser. Also when the access token lacks `settings:write` (`insufficient_scope`). | ErrorResponse |
| 500 | The setting could not be changed. | ErrorResponse |