Authentication

Every API request requires an API key. Get yours from the Dashboard.

Passing the API Key

Add it as a query parameter to any request:

Query Parameter
?apikey=YOUR_API_KEY
💡 Best practice: You can also pass the key in the Authorization: Bearer YOUR_API_KEY header (recommended for production).

Domain Restriction

You can restrict your API key to specific domains. Set allowed domains in your app details page. Requests from other domains will be rejected.

Allowed Domains
example.com, app.example.com

Request Signing (Optional)

For POST requests (and optionally GET requests), you can sign the request body using your signing secret and HMAC-SHA256. Include the signature in the X-Signature header as a hex string.

Header
X-Signature: a1b2c3d4e5f6...

Error Responses

All errors return a JSON object with an error message, a machine-readable code, and links to documentation.

Error Body
{
  "error": "Invalid API key",
  "code": "UNAUTHORIZED",
  "docs": "https://docs.divct.workers.dev",
  "dashboard": "https://www.divct.workers.dev"
}
StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
403DOMAIN_NOT_ALLOWEDAPI key restricted to specific domains
403INVALID_SIGNATURERequest signature verification failed
403FORBIDDENRequest blocked (e.g., restricted key usage)
403ACCOUNT_SUSPENDEDAccount has been suspended
429RATE_LIMITEDToo many requests
429QUOTA_EXCEEDEDPoints quota exhausted (includes Retry-After header)
400INVALID_TYPEUnknown chart type
400INVALID_DATAMalformed data
404NOT_FOUNDResource not found
500INTERNAL_ERRORInternal server error
503SERVICE_UNAVAILABLEChart generation service down

Rate Limiting

All API keys are subject to rate limits. Each API key can send up to 60 requests per 60 seconds. If you exceed the limit, you will receive a 429 RATE_LIMITED error.

Points

1 point = 1 data point. For example, a chart with 10 values consumes 10 points.

Beta gives 7,000 points per day, renewed at 00:00 Cairo time. Free gives 2,500 points per month, renewed on the 1st at 00:00 Cairo time. If a Beta account uses up its daily points, requests continue on the Free monthly points. When both are used up, requests are rejected with 429 QUOTA_EXCEEDED and a Retry-After header.