Deployments.ai Docs
Tenancy

Rotate an API key

POST /v1/api-keys/{id}/rotate · SDK rotateApiCredential · CLI deployments api-key rotate

POST
/v1/api-keys/{id}/rotate

Authorization

platformBearer
headerAuthorizationBearer <token>

Platform bearer credential accepted as an opaque API key or JWT.

Path Parameters

id*string
Match^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Header Parameters

x-deployments-environment*string
Match^[0-7][0-9A-HJKMNP-TV-Z]{25}$
idempotency-key*string
Length1 <= length <= 512

Request Body

application/json
  1. body
reason?string
Lengthlength <= 2000

Response Body

IssuedApiCredentialResponse

application/json
  1. response
createdAt*string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
updatedAt*string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
version*integer
Range1 <= value
environmentId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
organizationId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
projectId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
expiresAt?string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
id*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
keyPrefix*string
lastUsedAt?string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
name*string
Match^\S[\s\S]*\S$|^\S$|^$
Length1 <= length <= 120
revokedAt?string
Match^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
Formatdate-time
scopes*array<>
serviceAccountId*string
Match^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$
status*string
Value in"active""expired""revoked"
secret*string
secretVisibleOnce*true
Value intrue
curl -X POST "https://example.com/v1/api-keys/string/rotate" \  -H "x-deployments-environment: string" \  -H "idempotency-key: string" \  -H "Content-Type: application/json" \  -d '{}'
{  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "version": 1,  "environmentId": "string",  "organizationId": "string",  "projectId": "string",  "expiresAt": "2019-08-24T14:15:22Z",  "id": "string",  "keyPrefix": "string",  "lastUsedAt": "2019-08-24T14:15:22Z",  "name": "string",  "revokedAt": "2019-08-24T14:15:22Z",  "scopes": [    "string"  ],  "serviceAccountId": "string",  "status": "active",  "secret": "string",  "secretVisibleOnce": true}