API Keys

Create and manage API keys with granular permissions

Endpoints
API key management endpoints
GET/api-keys
POST/api-keys
GET/api-keys/{id}
PUT/api-keys/{id}
DELETE/api-keys/{id}
POST/api-keys/{id}/rotate

The API Key Object

FieldTypeDescription
idstringUnique API key identifier
namestringDisplay name for the key
keystringFull API key (only shown on creation)
keyPrefixstringFirst 12 characters for identification
scopesarrayPermissions granted to this key
createdAtstringISO 8601 creation timestamp
expiresAtstringExpiration date (null = never expires)
lastUsedAtstringLast 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 data
orders:writeCreate and update orders
products:readRead product catalog
products:writeManage products
inventory:readRead inventory levels
inventory:writeUpdate inventory
commissions:readView commissions
webhooks:readList webhooks
webhooks:writeManage webhooks

Create an API Key

POST/api-keys

Create 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

GET/api-keys

Retrieve 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

POST/api-keys/{id}/rotate

Generate 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"
Security Best Practices
1

Minimum scopes: Only request the scopes your integration actually needs.

2

Set expiration: Use expiration dates for keys that don't need to be permanent.

3

Rotate regularly: Rotate keys periodically, especially if team members leave.

4

Environment variables: Never commit API keys to source control.

5

Monitor usage: Check lastUsedAt to identify unused keys for cleanup.