Skip to the content
Forge

Service accounts

A project's service accounts and their tokens.

Every path is under /api/v1; see the API for authenticating, errors and rate limits, and the schemas for the bodies.

The project's service accounts (project:read)

GET /api/v1/projects/{project}/service-accounts

Parameter In Description
project path ID

Answers:

  • 200: OK, object with the fields below
Field Type Description
grantable_role_ids array of ID, required Roles the caller may give an account; empty without service_account:manage.
service_accounts array of ServiceAccount, required

Errors: 401, 404 (how errors look).

Create a service account (users with service_account:manage who may grant its role)

POST /api/v1/projects/{project}/service-accounts

Parameter In Description
project path ID

Body (application/json): ServiceAccountInput.

Answers:

Errors: 400, 401, 403, 404, 409, 422 (how errors look).

Change a service account (the right to grant its current and new role)

PUT /api/v1/projects/{project}/service-accounts/{account}

Parameter In Description
project path ID
account path ID

Body (application/json): ServiceAccountInput.

Answers:

Errors: 400, 401, 403, 404, 409, 422 (how errors look).

Delete a service account and revoke its tokens

DELETE /api/v1/projects/{project}/service-accounts/{account}

Parameter In Description
project path ID
account path ID

Answers:

  • 204: Deleted

Errors: 401, 403, 404 (how errors look).

Tokens of a service account that weren't revoked (for those who may manage it)

GET /api/v1/projects/{project}/service-accounts/{account}/tokens

Parameter In Description
project path ID
account path ID

Answers:

  • 200: OK, object with the fields below
Field Type Description
tokens array of ServiceAccountToken, required

Errors: 401, 403, 404 (how errors look).

Issue an fs_ token; the secret is only in this response

POST /api/v1/projects/{project}/service-accounts/{account}/tokens

Parameter In Description
project path ID
account path ID

Body (application/json): CreateServiceAccountToken.

Answers:

Errors: 400, 401, 403, 404, 409, 422 (how errors look).

Revoke a token

DELETE /api/v1/projects/{project}/service-accounts/{account}/tokens/{token}

Parameter In Description
project path ID
account path ID
token path ID

Answers:

  • 204: Revoked

Errors: 401, 403, 404 (how errors look).