Guides

Errors

The API returns conventional HTTP status codes with a consistent JSON envelope. Codes are stable strings — branch on error.code, not on the human-readable error.message.

Response envelope

{
  "error": {
    "code": "insufficient_credits",
    "message": "Balance 12 credits, need 45. Top up at https://app.dessert.dev/billing",
    "doc_url": "https://docs.dessert.dev/credits-balance"
  }
}
FieldDescription
error.codestringStable machine-readable code. Use this for control flow.
error.messagestringHuman-readable explanation. Safe to log or surface in dev tools; don't show end users.
error.doc_urlstringDeep link into these docs for the most relevant section. May be omitted.

HTTP status codes

StatusMeaning
200Success.
202Accepted. Used by /v1/ads/generate and /v1/brands — work continues in the background.
400Bad request. Schema validation failed. Fix the request before retrying.
401Unauthorized. Missing, malformed, or revoked API key.
402Payment required. Out of credits and auto-recharge couldn't cover the gap.
403Forbidden. Account is suspended or the brand isn't yours.
404Resource not found, or not visible from this account.
425Too early. The brand is still onboarding — retry after the scrape window.
429Rate limited. Back off and retry.
500Internal error. Bug on our side. Safe to retry with an Idempotency-Key.
502Upstream error. A downstream service (orchestrator, scraper) failed. Safe to retry.
503Service unavailable. The embedding index or another component is warming up. Retry in 30s.

Error codes

Authentication

CodeStatusFix
missing_authorization401Send the Authorization: Bearer … header.
invalid_authorization_scheme401Header must start with Bearer (with a space).
invalid_key_format401API keys start with dsrt_live_.
invalid_api_key401The key is unknown or has been rotated. Issue a new one in app.dessert.dev.

Account & onboarding

CodeStatusFix
brand_onboarding_in_progress425Wait 15–60 minutes, then poll GET /v1/brands.
account_suspended403Email support@dessert.dev.
account_not_ready403Account is in an unexpected state. Contact support.

Generate ads

CodeStatusFix
invalid_count400Set count to a positive integer.
invalid_format400Use "full" or "static".
no_brand_selected400Create a brand with POST /v1/brands, or pass brand_id.
brand_not_found404The brand_id doesn't belong to this account.
insufficient_credits402Top up at app.dessert.dev/billing or enable auto-recharge.
orchestration_failed502Retry — the orchestrator was momentarily unreachable.

Deliveries

CodeStatusFix
delivery_not_found404Bad ID, or the delivery belongs to a different account.
upstream_error502Retry. Persistent failures are an outage — check our status page.

Brands

CodeStatusFix
invalid_website400Pass a valid http(s):// URL.
scraper_failed502Retry; if it persists, the website may be blocking our crawler.

Styles

CodeStatusFix
missing_query400Provide a non-empty ?q= parameter.
style_search_unavailable503The embedding index is warming up. Retry in 30s.

Retry guidance

  • 4xx (except 425, 429): the request is wrong. Don't retry — fix the request first.
  • 425, 429: retry with backoff. The error message will hint at the wait time.
  • 5xx: retry with exponential backoff. Use an Idempotency-Key on /v1/ads/generate to avoid double-charging.