v7

latestOpenAPI 3.0.3raw.githubusercontent.com2026-08-013764062.2 MB
Service Accounts

Create a service account.

Enterprise feature

Creates a new service account.

post/api/admin/service-account

Request body

usernamestring required

The username of the service account

namestring required

The name of the service account

rootRoleinteger required

The id of the root role for the service account

Example request

{
  "username": "service-account-1",
  "name": "Service Account 1",
  "rootRole": 1
}

Response

The resource was successfully created.

idnumber required

The service account id

isAPIboolean

Deprecated: for internal use only, should not be exposed through the API

namestring

The name of the service account

emailstring

Deprecated: service accounts don't have emails associated with them

usernamestring

The service account username

imageUrlstring

The service account image url

inviteLinkstring

Deprecated: service accounts cannot be invited via an invitation link

loginAttemptsnumber

Deprecated: service accounts cannot log in to Unleash

emailSentboolean

Deprecated: internal use only

rootRoleinteger

The root role id associated with the service account

seenAtstring date-time nullable

Deprecated. This property is always null. To find out when a service account was last seen, check its tokens list and refer to each token's lastSeen property instead.

createdAtstring date-time

The service account creation date

Example response

{
  "id": 54321,
  "name": "My Service Account",
  "email": "noemail@getunleash.io",
  "username": "my-service-account",
  "imageUrl": "https://example.com/my-service-account.png",
  "inviteLink": "https://example.com/invite-link",
  "rootRole": 1,
  "createdAt": "2021-01-01T00:00:00.000Z",
  "tokens": [
    {
      "id": 1,
      "secret": "user:xyzrandomstring",
      "createdAt": "2023-04-19T08:15:14.000Z",
      "seenAt": "2023-04-19T08:15:14.000Z",
      "userId": 1337,
      "description": "user:xyzrandomstring",
      "expiresAt": "2023-04-19T08:15:14.000Z"
    }
  ]
}