OAuth
2 operations in the Tolvi API, version 1. Paths are relative to https://api.tolvi.co.uk. Every amount is integer pence.
OAuth protected-resource metadata
GET/.well-known/oauth-protected-resource
- Access
- No authentication.
Where OAuth 2.1 and MCP clients find the authorization server.
Responses
200 OK, application/json
Body: object (ProtectedResourceMetadata).
RFC 9728 protected-resource metadata.
| Field | Type | Description |
|---|---|---|
resourcerequired | string (uri) | |
authorization_serversrequired | array of string | |
scopes_supportedrequired | array of string | |
bearer_methods_supportedrequired | array of string | |
resource_namerequired | string |
Errors: 429 Too many requests, as problem details (application/problem+json).
Get an access token (client credentials)
POST/api/v1/oauth/token
- Access
- No authentication.
Authenticate with HTTP Basic (client_id:client_secret) or client_id and client_secret in the body. The token acts as the API client: its scopes, capped by the client’s role.
Request body
Required. application/x-www-form-urlencoded or application/json: object (ClientCredentialsTokenRequest).
| Field | Type | Description |
|---|---|---|
grant_typerequired | string (GrantType) | One of: |
client_id | string | Or send HTTP Basic authentication. |
client_secret | string | |
scope | string | Space-separated subset of the client’s scopes (default: all of them). |
Responses
200 OK, application/json
Body: object (TokenResponse).
| Field | Type | Description |
|---|---|---|
access_tokenrequired | string | example "twat_…" |
token_typerequired | string (TokenType) | One of: |
expires_inrequired | integer | example 3600 |
scoperequired | string | example "work:read clients:read" |
400 Bad request, application/json
invalid_request, unsupported_grant_type or invalid_scope.
Body: object (OAuthError).
RFC 6749 §5.2 error response.
| Field | Type | Description |
|---|---|---|
errorrequired | string (OAuthErrorCode) | One of: |
error_description | string |
401 Unauthorised, application/json
invalid_client.
Body: object (OAuthError).
RFC 6749 §5.2 error response.
| Field | Type | Description |
|---|---|---|
errorrequired | string (OAuthErrorCode) | One of: |
error_description | string |
Errors: 429 Too many requests, as problem details (application/problem+json).