Errors

Errors return the matching HTTP status and a JSON body of the shape { "error": { "code", "message" } }. Branch on the stable code rather than the human-readable message.

StatusCodeMeaning
401missing_api_keyNo API key was provided.
401invalid_api_keyThe key is invalid or revoked.
402quota_exceededMonthly PDF quota reached — upgrade your plan.
404template_not_foundNo template with that id exists for your account.
429rate_limitedToo many requests — retry after the Retry-After delay.
422invalid_jsonThe request body was not valid JSON.
422missing_template_idThe 'template_id' field is required.
422data_too_largeThe 'data' payload exceeds 256 KB.
422template_compile_errorThe template has a syntax error.
422template_render_errorThe template failed to render with this data.
502render_failedThe render service returned an error.
504render_timeoutRendering took longer than 20 seconds.

402, 429, 502 and 504 are safe to retry with backoff — for 429, wait for the Retry-After header; 4xx validation errors are not — fix the request first.

Every /v1/generate response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset so you can pace requests before hitting a 429.