Rotate an API key
POST
/api/v1/api-keys/{id}/rotate
const url = 'https://api.deploybase.eu/api/v1/api/v1/api-keys/example/rotate';const options = {method: 'POST', headers: {Authorization: '<Authorization>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.deploybase.eu/api/v1/api/v1/api-keys/example/rotate \ --header 'Authorization: <Authorization>'Replaces the secret of one of the current team’s API keys and returns the key with the new raw secret in raw_key, shown only in this response. The old secret stops working immediately. The key keeps its id, name and kind; last_used_at is cleared. An agent key gets a fresh 90-day lifetime, which also revives an expired agent key (refused with QUOTA_EXCEEDED if the team already holds 25 usable keys). A revoked key cannot be rotated. Requires the admin role and a verified email.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” id
required
string
API key ID (UUID)
Responses
Section titled “ Responses ”OK
Media type application/json
object
data
meta
object
request_id
string
timestamp
string
trace_id
string
data
object
created_at
string
expires_at
string
id
string
key_prefix
string
kind
string
last_used_at
string
name
string
raw_key
Only returned on create and rotate
string
revoked_at
string
rotated_at
string
scopes
Array<string>
team_id
string
updated_at
string
Example
{ "data": { "kind": "standard" }}INVALID_INPUT
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Unauthorized
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}FORBIDDEN or EMAIL_NOT_VERIFIED
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}RESOURCE_NOT_FOUND
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}CONFLICT (key is revoked) or QUOTA_EXCEEDED
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Internal Server Error
Media type application/json
object
code
string
details
error
string
meta
object
request_id
string
timestamp
string
trace_id
string
Example generated
{ "code": "example", "details": "example", "error": "example", "meta": { "request_id": "example", "timestamp": "example", "trace_id": "example" }}Live 174db30c built