Errors
Handle Daily error categories, stable codes, and request IDs safely.
All public API errors use the same JSON shape:
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "A valid API key is required."
},
"request_id": "req_docserrors001"
}Use HTTP status and error.code for program logic. Treat message as safe display text, not a stable parser interface. Record request_id without Authorization data.
Public error catalog
| Status | Type | Code | Message / cause | Recommended action |
|---|---|---|---|---|
| 401 | authentication_error | missing_api_key | A valid API key is required. | Configure the Authorization header; do not retry unchanged. |
| 401 | authentication_error | invalid_api_key | Missing format match, wrong environment, unknown key, or wrong secret. | Replace the configured secret. |
| 401 | authentication_error | expired_api_key | The API key is no longer active. | Create or rotate to a valid key. |
| 401 | authentication_error | revoked_api_key | The API key is no longer active. | Replace the revoked key. |
| 403 | authorization_error | insufficient_permission | The key cannot access the resource. | Add the required permission or use the correct key. |
| 403 | authorization_error | api_access_inactive | Public API access is unavailable for this subscription. | Restore eligible Daily subscription access. |
| 403 | authorization_error | ip_not_allowed | Current source IP is not permitted. | Update the key allowlist or route from an approved address. |
| 400 | invalid_request_error | invalid_filter | Invalid query, cursor, UUID, unsupported filter, unknown parameter, or oversized query. | Correct the request; do not retry unchanged. |
| 404 | not_found_error | resource_not_found | Resource or route not found in the authenticated scope. | Stop or reconcile the local reference. |
| 405 | invalid_request_error | method_not_allowed | Only GET and HEAD are supported. | Change the method. |
| 429 | rate_limit_error | rate_limit_exceeded | Too many requests. | Honor Retry-After: 1 and back off with jitter. |
| 500 | api_error | internal_error | An internal error occurred. | Retry with backoff if safe; escalate with request ID. |
| 503 | api_error | service_unavailable | The API is temporarily unavailable. | Honor Retry-After: 5 and retry with backoff. |
Validation failures intentionally do not expose internal field-validator details. Database and unexpected failures intentionally return a generic message.
Safe client pattern
import os
import requests
api_key = os.environ.get("DAILY_API_KEY")
if not api_key:
raise RuntimeError("DAILY_API_KEY is required")
response = requests.get(
"https://api.godaily.co.il/v1/products",
headers={"Accept": "application/json", "Authorization": f"Bearer {api_key}"},
timeout=30,
)
body = response.json()
if not response.ok:
error = body.get("error", {})
request_id = body.get("request_id", response.headers.get("X-Request-ID", "not-returned"))
code = error.get("code", "unknown_error")
if response.status_code in (429, 503):
retry_after = response.headers.get("Retry-After")
raise RuntimeError(f"Transient Daily API error {code}; retry after {retry_after}s; request {request_id}")
raise RuntimeError(f"Daily API error {code}; request {request_id}")Never include the API key, complete request headers, or a signed PDF URL in error telemetry.

