Error Handling
The Pictify API uses standard HTTP status codes with plain JSON error bodies.Error Response Format
Errors carry a human-readable message under one of two keys —message (most endpoints) or error (some rendering endpoints). Handle both:
code— a stable machine-readable slug on newer endpoints (video, workflows, stock):quota_exceeded,template_limit_reached,ai_unavailable,stock_unavailable,invalid_variable,preview_not_supported.
errors— an array of strings when a template fails to compile (video code templates return422with every compiler error at once):
HTTP Status Codes
Authentication failures return
401 with the body { "message": "Invalid Request" } — deliberately unspecific, so a probing caller cannot distinguish a revoked key from a malformed one.Common Errors
Out of credits
Every render — image, GIF, PDF page, video — consumes monthly credits. When they run out, the video and workflow endpoints return402; the image, GIF, HTML-template and batch endpoints return 429 — both with the same body:
Template not found (404)
Templates are scoped to your team. A valid uid owned by a different team returns404, not 403.
Invalid variables (422)
Rendering with variables that violate the template’s declared definitions:Retries
On a429 check code first: quota_exceeded is a monthly limit that no retry refills. Rate-limit 429s (public rendering, previews) send standard x-ratelimit-* and retry-after headers — honour those. On 5xx, one immediate retry is safe — all generation endpoints are idempotent from your side (a failed request bills nothing).