Create rotate
POST
/api-keys/{id}/rotate
const url = 'https://api.testzilla.ai/v1/api-keys/example/rotate';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{}'};
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.testzilla.ai/v1/api-keys/example/rotate \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{}'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” id
required
string
Id identifier
Request Body
Section titled “Request Body ”No request body. The key to rotate is identified by the id path parameter.
Media type application/json
object
Example generated
{}Responses
Section titled “ Responses ”Key rotated. The new raw apiKey is returned here once; the previous secret is now invalid.
Media type application/json
One-time response carrying the raw secret API key. Returned ONLY on create and rotate, and never again — the raw key is not stored and cannot be retrieved later.
object
success
required
boolean
id
required
Key identifier (Firestore doc id).
string
label
required
The key label.
string
prefix
required
Non-secret display prefix, e.g. “tz_a1b2c3d4”.
string
apiKey
required
The raw secret API key. Shown EXACTLY ONCE. Store it immediately; it cannot be recovered afterwards.
string
warning
required
Human-readable reminder that the key will not be shown again.
string
Example
{ "success": true}Unauthorized (missing or invalid API key)
API key not found.
Media type application/json
object
error
required
Human-readable error message.
string
Example generated
{ "error": "example"}Cannot rotate a revoked key.
Media type application/json
object
error
required
Human-readable error message.
string
Example generated
{ "error": "example"}