API Keys Management

Manage and rotate your API keys securely.

Get API Key Information

GET
https://api.example.com/orgs/{org_uuid}/api/key

Retrieve information about the API key currently in use.

curl -X GET "https://api.example.com/orgs/{org_uuid}/api/key" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response Example

{
  "key_id": "key_abc123",
  "name": "Production API Key",
  "created_at": "2025-01-01T00:00:00Z",
  "last_used_at": "2025-01-10T12:00:00Z",
  "scopes": ["instances:read", "instances:write"]
}

Rotate API Key

POST
https://api.example.com/orgs/{org_uuid}/api/key/rotate

Rotate the API key, invalidating the previous key and generating a new one.

⚠️ Important

After rotation, your old API key will be immediately invalidated. Update your applications with the new key to avoid service interruptions.

curl -X POST "https://api.example.com/orgs/{org_uuid}/api/key/rotate" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response Example

{
  "key": "legba_new_api_key_xyz789",
  "key_id": "key_xyz789",
  "created_at": "2025-01-10T12:30:00Z"
}