Skip to main content
The Doctly API uses API keys for authentication. Every request must include your API key in the Authorization header.

Getting Your API Key

  1. Sign in to your Doctly dashboard
  2. Navigate to Settings then API Keys
  3. Click Create API Key
  4. Copy and securely store your key
API keys grant full access to your account. Never share them publicly or commit them to version control.

Using Your API Key

Include your API key in the Authorization header as a Bearer token:
Authorization: Bearer YOUR_API_KEY

Example Requests

curl https://api.doctly.ai/api/v1/documents \
  -H "Authorization: Bearer dk_live_abc123..."

Environment Variables

Store your API key in an environment variable:
export DOCTLY_API_KEY="dk_live_abc123..."

Authentication Errors

401 Unauthorized

Returned when the API key is missing or invalid:
{
  "detail": "Invalid or missing API key"
}
Common causes:
  • Missing Authorization header
  • Missing Bearer prefix
  • Invalid or revoked API key
  • Using a test key in production or vice versa

403 Forbidden

Returned when the API key does not have permission for the requested resource:
{
  "detail": "Access denied"
}

Security Best Practices

Keep Keys Secret

Never expose API keys in client-side code, public repositories, or logs.

Use Environment Variables

Store keys in environment variables or a secrets manager, not in code.

Rotate Regularly

Create new keys periodically and revoke old ones.

Limit Scope

Create separate keys for different environments like development, staging, production.

Managing API Keys

Revoke a Key

If a key is compromised, revoke it immediately in your dashboard:
  1. Go to Settings then API Keys
  2. Find the key to revoke
  3. Click Revoke
Revoking a key is immediate and cannot be undone. Any applications using that key will stop working.

Testing Your Key

Verify your API key works by listing your documents:
curl https://api.doctly.ai/api/v1/documents \
  -H "Authorization: Bearer YOUR_API_KEY"
A successful response confirms your key is working:
{
  "data": [],
  "count": 0
}