Skip to content

Service accounts API ​

5 endpoints. Request and response schemas are described on the schemas page; the other tags are listed in the API index.

Endpoints ​

GET /api/v1/service-accounts ​

List service accounts

List service accounts, by name (admin only).

Parameters

NameInTypeRequiredDescription
pagequeryintegernoMinimum: 1.
per_pagequeryintegernoMinimum: 1. Maximum: 200.

Responses

StatusDescriptionBody
200Service accountsapplication/json: object
400Invalid requestapplication/json: Error
403Admin access required-

Fields of the 200 response (application/json):

FieldTypeRequiredDescription
dataarray of ServiceAccountno-
pageintegerno-
per_pageintegerno-
totalintegerno-

POST /api/v1/service-accounts ​

Create service account

Create a service account: a named non-human principal for automation (admin only). It can hold project roles, group memberships and permission assignments like a user, and own API tokens through /api/v1/users/{id}/tokens, but it cannot sign in.

Request body (required)

application/json: object

FieldTypeRequiredDescription
descriptionstringnoMaximum length: 255.
disabledbooleanno-
namestringyes3-64 letters, digits, dash or underscore; unique among users and service accounts; cannot be changed.

Responses

StatusDescriptionBody
201Service account createdapplication/json: ServiceAccount
400Invalid requestapplication/json: Error
403Admin access required-
409A user or service account with this name existsapplication/json: Error

GET /api/v1/service-accounts/{id} ​

Get service account

Get one service account (admin only).

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Responses

StatusDescriptionBody
200Service accountapplication/json: ServiceAccount
403Admin access required-
404Service account not found-

PATCH /api/v1/service-accounts/{id} ​

Update service account

Change the description or disable or re-enable a service account (admin only). A disabled account's tokens, including those already issued, authenticate nothing.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Request body (required)

application/json: object

FieldTypeRequiredDescription
descriptionstringnoMaximum length: 255.
disabledbooleanno-

Responses

StatusDescriptionBody
200Service account updatedapplication/json: ServiceAccount
400Invalid requestapplication/json: Error
403Admin access required-
404Service account not found-

DELETE /api/v1/service-accounts/{id} ​

Delete service account

Delete a service account with its tokens, group memberships, project roles, permission assignments and trust policies (admin only).

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes-

Responses

StatusDescriptionBody
204Service account deleted-
403Admin access required-
404Service account not found-

Free software under the AGPL-3.0-or-later.