Authentication
Secure your API requests using API keys
The DataGuru API uses API key authentication via the Api-Key scheme. You must include a valid API key in the headers of all requests to authenticate successfully.
Passing the API Key
Your API key should be passed in the Authorization HTTP header using the Api-Key scheme.
Authorization Header Example
Authorization: Api-Key dg_live_9f82b7c4a1e9382d...Key Environments
DataGuru provides two types of API keys. Use the appropriate key depending on your environment: • **Live Environment Keys (`dg_live_*`)**: Used for production traffic. Live keys deduct the endpoint cost from your deposited USD balance. • **Test Environment Keys (`dg_test_*`)**: Used for testing integration. Returns mock data and does not deduct any funds ($0.00).
Security Best Practice
Never commit your API keys to version control or expose them in client-side code. Use server-side environment variables to keep your keys secure.
Authentication Errors
If authentication fails, the API will return one of the following error codes along with a JSON error envelope.
Authentication Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | No API key was provided or the key format is invalid. |
| 403 | FORBIDDEN | The API key exists but is revoked or lacks permissions for this endpoint. |
| 429 | RATE_LIMITED | The key has exceeded its rate limit. Retry after the indicated period. |