Back to Documentation
CLI & API

API Authentication

Learn how to authenticate with the Berican Labs API using API keys and OAuth tokens.

1API Keys

Generate an API key for programmatic access:

  1. Go to Account Settings > API Keys
  2. Click "Create API Key"
  3. Enter a name for the key
  4. Select permissions (scopes)
  5. Click "Create"
  6. Copy the key immediately - it won't be shown again

2Using API Keys

Include your API key in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.bericanlabs.com/v1/sites

Or use the X-API-Key header:

curl -H "X-API-Key: YOUR_API_KEY" \
  https://api.bericanlabs.com/v1/sites

3API Key Scopes

Available permission scopes:

sites:read View sites and deployments
sites:write Create, update, delete sites
domains:read View domains and DNS
domains:write Manage domains
billing:read View billing and invoices

4Rate Limits

API rate limits by plan:

Plan Requests/min Requests/day
Free 60 1,000
Pro 300 10,000
Business 1,000 100,000

Rate limit headers are included in every response.

5Error Handling

Common authentication errors:

// 401 Unauthorized - Invalid or missing API key
{
  "error": "unauthorized",
  "message": "Invalid API key"
}

// 403 Forbidden - Key doesn't have required scope
{
  "error": "forbidden",
  "message": "Missing required scope: sites:write"
}

// 429 Too Many Requests - Rate limited
{
  "error": "rate_limited",
  "message": "Rate limit exceeded",
  "retry_after": 60
}