API Keys
Create and manage API keys with granular permissions
/api-keys/api-keys/api-keys/{id}/api-keys/{id}/api-keys/{id}/api-keys/{id}/rotateThe API Key Object
| Field | Type | Description |
|---|---|---|
| id | string | Unique API key identifier |
| name | string | Display name for the key |
| key | string | Full API key (only shown on creation) |
| keyPrefix | string | First 12 characters for identification |
| scopes | array | Permissions granted to this key |
| createdAt | string | ISO 8601 creation timestamp |
| expiresAt | string | Expiration date (null = never expires) |
| lastUsedAt | string | Last time key was used |
Available Scopes
API keys use scopes to limit what actions they can perform. Always use the minimum required scopes.
orders:readRead order dataorders:writeCreate and update ordersproducts:readRead product catalogproducts:writeManage productsinventory:readRead inventory levelsinventory:writeUpdate inventorycommissions:readView commissionswebhooks:readList webhookswebhooks:writeManage webhooksCreate an API Key
/api-keysCreate a new API key with specific scopes and optional expiration date.
Store your key securely
The full API key is only shown once when created. Store it securely - you cannot retrieve it later.
curl -X POST "https://gateway.regentherapy.com/api/v1/api-keys" \
-H "X-API-Key: rg_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Integration",
"scopes": ["orders:read", "orders:write", "products:read", "inventory:read"],
"expiresAt": "2025-01-20T00:00:00Z"
}'List API Keys
/api-keysRetrieve all API keys for your account. Note: The full key value is never returned in list operations.
curl -X GET "https://gateway.regentherapy.com/api/v1/api-keys" \
-H "X-API-Key: rg_your_api_key" \
-H "Content-Type: application/json"Rotate API Key
/api-keys/{id}/rotateGenerate a new key value while keeping the same configuration. The old key remains valid for 5 minutes to allow for graceful migration.
curl -X POST "https://gateway.regentherapy.com/api/v1/api-keys/key_abc123/rotate" \
-H "X-API-Key: rg_your_api_key" \
-H "Content-Type: application/json"Minimum scopes: Only request the scopes your integration actually needs.
Set expiration: Use expiration dates for keys that don't need to be permanent.
Rotate regularly: Rotate keys periodically, especially if team members leave.
Environment variables: Never commit API keys to source control.
Monitor usage: Check lastUsedAt to identify unused keys for cleanup.