Rotate an API key
Issues a replacement with the same owner, name, and access, then deactivates the existing key. Returns the new key, including the plaintext secret.
POST
Issues a replacement with the same owner, name, and access, then deactivates the existing key. Returns the new key, including the plaintext secret.
apiKeyheader
x-api-key<token>id*stringMatch
^key_[0-9a-hjkmnp-tv-z]{16,24}$ApiKeyWithSecret
application/json- response
id*stringname*stringkey*stringstart*string|nullend*string|nulldescription?string|nullcreatedAt*stringexpiresAt*string|nulllastUsedAt*string|nullisActive*booleanaccess*|owner*|nullimport { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const result = await samva.apiKeys.rotate({
"id": "example"
});Example Response
{
"id": "string",
"name": "string",
"key": "string",
"start": "string",
"end": "string",
"description": "string",
"createdAt": "string",
"expiresAt": "string",
"lastUsedAt": "string",
"isActive": true,
"access": {
"mode": "full"
},
"owner": {
"id": "string",
"name": "string",
"email": "string"
}
}