Skip to main content

Authentication

The Docyard API uses Bearer token authentication. Include your API key in the Authorization header of every request.

Making Authenticated Requests

curl https://api.docyard.io/v1/docks \
  -H "Authorization: Bearer dk_live_a1b2c3d4e5f6..."

API Key Types

Key TypePrefixUsage
Livedk_live_Production environment
Testdk_test_Sandbox environment
API keys carry full access to your account. Never expose them in client-side code, public repositories, or logs. Use environment variables or a secrets manager.

Key Management

API keys are managed from the Docyard Dashboard. You can:
  • Create keys with optional expiration dates
  • Rotate keys without downtime (both old and new keys work during a grace period)
  • Revoke keys immediately if compromised

Institutional Recipients (STS Token Exchange)

For machine-to-machine integrations, institutional recipients authenticate via STS token exchange rather than API keys:
  1. The institution presents credentials to the token endpoint
  2. Docyard returns a short-lived access token
  3. The token is used for retrieval API calls
# Step 1: Exchange credentials for a token
curl -X POST https://api.docyard.io/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "inst_01HQ3K...",
    "client_secret": "sk_live_..."
  }'
Response
{
  "access_token": "eyJhbGciOiJSUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Error Responses

If authentication fails, the API returns a 401 status code:
{
  "statusCode": 401,
  "message": "Invalid or expired API key",
  "error": "Unauthorized"
}
Common causes:
  • Missing Authorization header
  • Malformed token (ensure the Bearer prefix is included)
  • Expired or revoked API key
  • Using a test key against the production environment

Rate Limits

PlanRequests/minuteBurst
Starter6010
Professional600100
EnterpriseCustomCustom
Rate-limited responses return 429 Too Many Requests with a Retry-After header.