curl -X POST https://api.sabaothcloud.com/api/v1/api-keys \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "CI deploy key",
"scopes": ["clusters:read", "clusters:write"],
"expires_in_days": 90,
"organization_id": "YOUR_ORG_ID"
}'
{
"id": "6f1c2a7e-8a1d-4f53-9b0e-3c1d2e4f5a6b",
"name": "CI deploy key",
"key": "mpg_Qw8Rt2Lm9xT4cEa7Hq7Lm2XaPm9xT4cERa41vNq8Zt07kBw3Yd6Uf1Gh5Jk2Np4Sv",
"key_prefix": "Qw8Rt2Lm",
"scopes": ["clusters:read", "clusters:write"],
"expires_at": "2027-01-11T10:00:00Z",
"created_at": "2026-10-13T10:00:00Z",
"warning": "Save this key securely! You won't be able to see it again."
}
{
"error": "Forbidden",
"message": "Viewers can't create API keys. Ask an Owner or Admin for a Developer role."
}
API Keys
Create an API Key
Create a new API key for an organization
POST
/
api
/
v1
/
api-keys
curl -X POST https://api.sabaothcloud.com/api/v1/api-keys \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "CI deploy key",
"scopes": ["clusters:read", "clusters:write"],
"expires_in_days": 90,
"organization_id": "YOUR_ORG_ID"
}'
{
"id": "6f1c2a7e-8a1d-4f53-9b0e-3c1d2e4f5a6b",
"name": "CI deploy key",
"key": "mpg_Qw8Rt2Lm9xT4cEa7Hq7Lm2XaPm9xT4cERa41vNq8Zt07kBw3Yd6Uf1Gh5Jk2Np4Sv",
"key_prefix": "Qw8Rt2Lm",
"scopes": ["clusters:read", "clusters:write"],
"expires_at": "2027-01-11T10:00:00Z",
"created_at": "2026-10-13T10:00:00Z",
"warning": "Save this key securely! You won't be able to see it again."
}
{
"error": "Forbidden",
"message": "Viewers can't create API keys. Ask an Owner or Admin for a Developer role."
}
Creates an API key. The full key is returned only in this response.
Owners, Admins and Developers can create keys. Viewers can’t.
Request body
string
required
A name for the key, 3 to 100 characters. Use something that says what the key is for, such as
CI deploy key.string[]
required
At least one scope:
clusters:read: view services, including their backups, poolers and database usersclusters:write: create and change services, backups, poolers and database users. Includes read.clusters:delete: delete services and backups. Includes read and write.organizations:read: view organization detailsbilling:read: view billing details and spending capsbilling:write: manage spending caps. Includes read.*: everything your role allows
integer
Days until the key expires. Leave it out for a key that never expires.
string
The organization the key belongs to. Defaults to your current organization.
Response
201 Created
string
The key’s ID.
string
The key’s name.
string
The full key, starting with
mpg_. Store it now, because it is never shown again.string
The 8 characters after
mpg_, used to identify the key.string[]
The scopes granted to the key.
string | null
When the key expires, or
null if it never does.string
When the key was created.
string
A reminder that the key is shown only once.
curl -X POST https://api.sabaothcloud.com/api/v1/api-keys \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "CI deploy key",
"scopes": ["clusters:read", "clusters:write"],
"expires_in_days": 90,
"organization_id": "YOUR_ORG_ID"
}'
{
"id": "6f1c2a7e-8a1d-4f53-9b0e-3c1d2e4f5a6b",
"name": "CI deploy key",
"key": "mpg_Qw8Rt2Lm9xT4cEa7Hq7Lm2XaPm9xT4cERa41vNq8Zt07kBw3Yd6Uf1Gh5Jk2Np4Sv",
"key_prefix": "Qw8Rt2Lm",
"scopes": ["clusters:read", "clusters:write"],
"expires_at": "2027-01-11T10:00:00Z",
"created_at": "2026-10-13T10:00:00Z",
"warning": "Save this key securely! You won't be able to see it again."
}
{
"error": "Forbidden",
"message": "Viewers can't create API keys. Ask an Owner or Admin for a Developer role."
}