Handling results
Poll generation status or use webhooks to receive try-on outcomes.
Handling results
Generations are asynchronous. After POST /v1/generations returns 202, wait for a terminal status before showing a result to a shopper.
Customer-facing statuses
| Status | Client action |
|---|---|
submitted | In progress — wait |
queued | In progress — wait |
processing | In progress — wait |
succeeded | Use output_url |
failed | Read error.code / error.message; do not use output_url |
Option A — Polling
curl -sS "https://api.drapeiton.com/v1/generations/JOB_ID" \
-H "X-API-Key: YOUR_API_KEY"Poll on an interval appropriate for your UX (for example every few seconds) until status is succeeded or failed. Back off if you poll aggressively; the API is rate-limited per API key (see Errors and retries).
On success, fields of interest include output_url, category, and timestamps. On failure, error is present.
Option B — Webhooks
If a webhook is configured for the account, the platform POSTs when a job finishes:
generation.completed— success (data.statusissucceeded, includesoutput_url)generation.failed— failure (data.statusisfailed, includeserror)
Verify signatures and return 2xx quickly. Full payload schemas and delivery behavior: Webhooks and API Reference — Webhooks.
Combining both
Common pattern: register a webhook for production, and use polling as a fallback (e.g. timeout if no webhook, or for tools/scripts).