Skip to main content
POST
/
service_accounts
/
{clientId}
/
api_keys
Create service account API key
curl --request POST \
  --url https://api.blaxel.ai/v0/service_accounts/{clientId}/api_keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "expires_in": "<string>",
  "name": "<string>"
}
'
{
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "createdBy": "<string>",
  "updatedBy": "<string>",
  "apiKey": "<string>",
  "expires_in": "30d",
  "id": "ak_abc123def456",
  "name": "CI/CD Pipeline Key",
  "sub": "<string>",
  "sub_type": "user"
}

Authorizations

Authorization
string
header
required

OAuth2 authentication with JWT tokens

Path Parameters

clientId
string
required

Service account client ID

Body

application/json
expires_in
string

Expiration period for the API key. Supports formats like '30d' (30 days), '24h' (24 hours), '1w' (1 week). If not set, the API key never expires.

name
string

Name for the API key

Response

200 - application/json

successful operation

Long-lived API key for accessing Blaxel

createdAt
string

The date and time when the resource was created

updatedAt
string

The date and time when the resource was updated

createdBy
string

The user or service account who created the resource

updatedBy
string

The user or service account who updated the resource

apiKey
string

Api key

expires_in
string

Duration until expiration. Supports formats like '30d' (30 days), '24h' (24 hours), '1w' (1 week). If not set, the API key never expires.

Example:

"30d"

id
string

Api key id, to retrieve it from the API

Example:

"ak_abc123def456"

name
string

Name for the API key

Example:

"CI/CD Pipeline Key"

sub
string

User subject identifier

sub_type
string

Subject type (user or service_account)

Example:

"user"