Skip to main content

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.

200 OK response for GET /api/v1/credentials
FieldTypeDescription
[].​idrequiredstring (uuid)
[].​kindrequiredstring (CredentialKind)

One of: personal, client

[].​namerequiredstring
[].​userIdrequiredstring (uuid)nullable

Owner of a personal token.

[].​clientIdrequiredstringnullable

Public id of an API client.

example "twc_0123456789abcdef01234567"

[].​prefixrequiredstring

First characters of the secret.

example "twp_AbCd"

[].​scopesrequiredarray of Scope

One of: work:read, clients:read, clients:write, engagements:read, engagements:write, review:write, integrations:manage, settings:read, settings:admin, webhooks:manage, meetings:read, meetings:write, client_books:read, books:read, books:write, books:admin, self_assessment:read, self_assessment:write, accounts:read, accounts:write, corporation_tax:read, corporation_tax:write

[].​rolerequiredstring (MembershipRole)nullable

Role ceiling of an API client.

One of: owner, admin, staff

[].​staffRolerequiredstring (StaffRole)nullable

One of: partner, manager, reviewer, preparer, admin

[].​createdAtrequiredstring (date-time)
[].​lastUsedAtrequiredstring (date-time)nullable
[].​expiresAtrequiredstring (date-time)nullable
[].​revokedAtrequiredstring (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).

Request body for POST /api/v1/credentials/personal
FieldTypeDescription
namerequiredstring

1 to 100 characters

scopesrequiredarray of Scope

At most what your role allows.

One of: work:read, clients:read, clients:write, engagements:read, engagements:write, review:write, integrations:manage, settings:read, settings:admin, webhooks:manage, meetings:read, meetings:write, client_books:read, books:read, books:write, books:admin, self_assessment:read, self_assessment:write, accounts:read, accounts:write, corporation_tax:read, corporation_tax:write

at least 1 items

expiresInDaysinteger

1 to 366; default 90

Responses

201 Created, application/json

Body: object (CreatedCredential).

201 Created response for POST /api/v1/credentials/personal
FieldTypeDescription
credentialrequiredobject (ApiCredential)

A personal access token or API client. The secret is never returned again.

credential.​idrequiredstring (uuid)
credential.​kindrequiredstring (CredentialKind)

One of: personal, client

credential.​namerequiredstring
credential.​userIdrequiredstring (uuid)nullable

Owner of a personal token.

credential.​clientIdrequiredstringnullable

Public id of an API client.

example "twc_0123456789abcdef01234567"

credential.​prefixrequiredstring

First characters of the secret.

example "twp_AbCd"

credential.​scopesrequiredarray of Scope

One of: work:read, clients:read, clients:write, engagements:read, engagements:write, review:write, integrations:manage, settings:read, settings:admin, webhooks:manage, meetings:read, meetings:write, client_books:read, books:read, books:write, books:admin, self_assessment:read, self_assessment:write, accounts:read, accounts:write, corporation_tax:read, corporation_tax:write

credential.​rolerequiredstring (MembershipRole)nullable

Role ceiling of an API client.

One of: owner, admin, staff

credential.​staffRolerequiredstring (StaffRole)nullable

One of: partner, manager, reviewer, preparer, admin

credential.​createdAtrequiredstring (date-time)
credential.​lastUsedAtrequiredstring (date-time)nullable
credential.​expiresAtrequiredstring (date-time)nullable
credential.​revokedAtrequiredstring (date-time)nullable
secretrequiredstring

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).

Request body for POST /api/v1/credentials/clients
FieldTypeDescription
namerequiredstring

1 to 100 characters

scopesrequiredarray of Scope

One of: work:read, clients:read, clients:write, engagements:read, engagements:write, review:write, integrations:manage, settings:read, settings:admin, webhooks:manage, meetings:read, meetings:write, client_books:read, books:read, books:write, books:admin, self_assessment:read, self_assessment:write, accounts:read, accounts:write, corporation_tax:read, corporation_tax:write

at least 1 items

staffRolerequiredstring (StaffRole)

Role ceiling for the client; never above your own.

One of: partner, manager, reviewer, preparer, admin

Responses

201 Created, application/json

Body: object (CreatedCredential).

The fields are as shown above.

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

Parameters for POST /api/v1/credentials/{id}/revoke
NameInTypeDescription
idrequiredpathstring (uuid)

Responses

200 OK, application/json

Body: object (ApiCredential).

A personal access token or API client. The secret is never returned again.

200 OK response for POST /api/v1/credentials/{id}/revoke
FieldTypeDescription
idrequiredstring (uuid)
kindrequiredstring (CredentialKind)

One of: personal, client

namerequiredstring
userIdrequiredstring (uuid)nullable

Owner of a personal token.

clientIdrequiredstringnullable

Public id of an API client.

example "twc_0123456789abcdef01234567"

prefixrequiredstring

First characters of the secret.

example "twp_AbCd"

scopesrequiredarray of Scope

One of: work:read, clients:read, clients:write, engagements:read, engagements:write, review:write, integrations:manage, settings:read, settings:admin, webhooks:manage, meetings:read, meetings:write, client_books:read, books:read, books:write, books:admin, self_assessment:read, self_assessment:write, accounts:read, accounts:write, corporation_tax:read, corporation_tax:write

rolerequiredstring (MembershipRole)nullable

Role ceiling of an API client.

One of: owner, admin, staff

staffRolerequiredstring (StaffRole)nullable

One of: partner, manager, reviewer, preparer, admin

createdAtrequiredstring (date-time)
lastUsedAtrequiredstring (date-time)nullable
expiresAtrequiredstring (date-time)nullable
revokedAtrequiredstring (date-time)nullable

Errors: 400 Bad request, 401 Unauthorised, 403 Forbidden, 404 Not found, 429 Too many requests, as problem details (application/problem+json).