Credentials
4 operations in the Tolvi API, version 1. Paths are relative to https://api.tolvi.co.uk. Every amount is integer pence.
List API credentials
GET/api/v1/credentials
- Access
- A signed-in Tolvi session only, never an API token.
Firm admins see every personal access token and API client in the firm; everyone else sees their own tokens.
Responses
200 OK, application/json
Body: array of ApiCredential.
A personal access token or API client. The secret is never returned again.
| Field | Type | Description |
|---|---|---|
[].idrequired | string (uuid) | |
[].kindrequired | string (CredentialKind) | One of: |
[].namerequired | string | |
[].userIdrequired | string (uuid)nullable | Owner of a personal token. |
[].clientIdrequired | stringnullable | Public id of an API client. example "twc_0123456789abcdef01234567" |
[].prefixrequired | string | First characters of the secret. example "twp_AbCd" |
[].scopesrequired | array of Scope | One of: |
[].rolerequired | string (MembershipRole)nullable | Role ceiling of an API client. One of: |
[].staffRolerequired | string (StaffRole)nullable | One of: |
[].createdAtrequired | string (date-time) | |
[].lastUsedAtrequired | string (date-time)nullable | |
[].expiresAtrequired | string (date-time)nullable | |
[].revokedAtrequired | string (date-time)nullable |
Errors: 400 Bad request, 401 Unauthorised, 403 Forbidden, 429 Too many requests, as problem details (application/problem+json).
Create a personal access token
POST/api/v1/credentials/personal
- Access
- A signed-in Tolvi session only, never an API token.
For scripts and tools acting as you. Scopes are capped by your role, now and whenever it changes.
Request body
Required. application/json: object (CreatePersonalTokenRequest).
| Field | Type | Description |
|---|---|---|
namerequired | string | 1 to 100 characters |
scopesrequired | array of Scope | At most what your role allows. One of: at least 1 items |
expiresInDays | integer | 1 to 366; default 90 |
Responses
201 Created, application/json
Body: object (CreatedCredential).
| Field | Type | Description |
|---|---|---|
credentialrequired | object (ApiCredential) | A personal access token or API client. The secret is never returned again. |
credential.idrequired | string (uuid) | |
credential.kindrequired | string (CredentialKind) | One of: |
credential.namerequired | string | |
credential.userIdrequired | string (uuid)nullable | Owner of a personal token. |
credential.clientIdrequired | stringnullable | Public id of an API client. example "twc_0123456789abcdef01234567" |
credential.prefixrequired | string | First characters of the secret. example "twp_AbCd" |
credential.scopesrequired | array of Scope | One of: |
credential.rolerequired | string (MembershipRole)nullable | Role ceiling of an API client. One of: |
credential.staffRolerequired | string (StaffRole)nullable | One of: |
credential.createdAtrequired | string (date-time) | |
credential.lastUsedAtrequired | string (date-time)nullable | |
credential.expiresAtrequired | string (date-time)nullable | |
credential.revokedAtrequired | string (date-time)nullable | |
secretrequired | string | The secret. Shown once: store it now. |
Errors: 400 Bad request, 401 Unauthorised, 403 Forbidden, 429 Too many requests, as problem details (application/problem+json).
Create an API client (client credentials)
POST/api/v1/credentials/clients
- Role
- Firm admin
- Access
- A signed-in Tolvi session only, never an API token.
For server-to-server integrations. Exchange the client id and secret at POST /api/v1/oauth/token.
Request body
Required. application/json: object (CreateApiClientRequest).
| Field | Type | Description |
|---|---|---|
namerequired | string | 1 to 100 characters |
scopesrequired | array of Scope | One of: at least 1 items |
staffRolerequired | string (StaffRole) | Role ceiling for the client; never above your own. One of: |
Responses
Errors: 400 Bad request, 401 Unauthorised, 403 Forbidden, 429 Too many requests, as problem details (application/problem+json).
Revoke a personal access token or API client
POST/api/v1/credentials/{id}/revoke
- Access
- A signed-in Tolvi session only, never an API token.
Owners revoke their own tokens; firm admins revoke anything in the firm. Takes effect at once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
200 OK, application/json
Body: object (ApiCredential).
A personal access token or API client. The secret is never returned again.
| Field | Type | Description |
|---|---|---|
idrequired | string (uuid) | |
kindrequired | string (CredentialKind) | One of: |
namerequired | string | |
userIdrequired | string (uuid)nullable | Owner of a personal token. |
clientIdrequired | stringnullable | Public id of an API client. example "twc_0123456789abcdef01234567" |
prefixrequired | string | First characters of the secret. example "twp_AbCd" |
scopesrequired | array of Scope | One of: |
rolerequired | string (MembershipRole)nullable | Role ceiling of an API client. One of: |
staffRolerequired | string (StaffRole)nullable | One of: |
createdAtrequired | string (date-time) | |
lastUsedAtrequired | string (date-time)nullable | |
expiresAtrequired | string (date-time)nullable | |
revokedAtrequired | string (date-time)nullable |
Errors: 400 Bad request, 401 Unauthorised, 403 Forbidden, 404 Not found, 429 Too many requests, as problem details (application/problem+json).