Skip to main content
POST
/
v1
/
keys
/
{id}
/
rotate
Rotate Key
curl --request POST \
  --url https://api.example.com/v1/keys/{id}/rotate
{
  "id": "<string>",
  "key": "<string>",
  "name": "<string>",
  "scope": "<string>",
  "message": "<string>"
}

Rotate Key

Generates a new API key with the same name and scope, then revokes the old key in a single transaction. The new key is active immediately.

Path Parameters

id
string
required
The UUID of the key to rotate.

Authentication

Requires an API key with admin scope.

Response

id
string
UUID of the new key.
key
string
The new API key (gf_ + 32 hex characters). Shown once — store it securely.
name
string
Key name (inherited from the old key).
scope
string
Key scope (inherited from the old key).
message
string
Confirmation that the old key has been revoked.

Example

curl -X POST https://api.gimme.fast/v1/keys/550e8400-e29b-41d4-a716-446655440000/rotate \
  -H "X-API-Key: gf_admin_key_here"
Response
{
  "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "key": "gf_f8a3b2c1d4e5f67890abcdef12345678",
  "name": "my-trading-bot",
  "scope": "read",
  "message": "Old key has been revoked. Save the new key."
}

Errors

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENKey doesn’t have admin scope
404NOT_FOUNDKey ID doesn’t exist or is already revoked