LogoPhotopurr Docs
LogoPhotopurr Docs
HomepageWhat is PhotopurrGenerating imagesCreditsAPI reference
Developer Center
Quick startKey managementScopesImage downloadError formatRate limitsImage pack pulling
Developer Center

Error format

The shared error body, every error code and retry advice

When anything under /api/v1/** fails, the HTTP status is not 2xx and the body always has the same shape:

{
  "error": {
    "code": "insufficient_scope",
    "message": "This API key does not have the generate:write permission.",
    "request_id": "req_xxxxxxxxxxxxxxxxxxxx"
  }
}
FieldDescription
codeMachine-readable error code. Branch on it. Stable, never changes
messageHuman-readable explanation. It follows the language: the website uses the interface language, the API uses Accept-Language, and the default is Chinese. May change; don't match on it
request_idUnique id of this request, identical to the X-Request-Id response header and the Developer Center logs. Include it when reporting a problem

Successful responses carry the X-Request-Id header too.

GET /api/file/<filename> is not under /api/v1 and returns plain-text errors, see image download.

Status codes

StatuscodeMeaningWhat to do
400invalid_request and sub-codesInvalid parametersFix the parameters; don't retry
401unauthorizedNo Authorization headerAdd it
401invalid_api_keyKey invalid, revoked or expired; message says whichCreate a new key
402insufficient_creditsNot enough credits; message states how much is needed and how to top upTop up
403insufficient_scopeKey lacks the required scopeCreate a key with that scope
403bannedAccount bannedContact support
404session_not_foundsession_id doesn't exist or isn't yoursOmit it, or pass one of your own
404not_foundImage pack publication doesn't exist or isn't yours—
429rate_limitedKey over its 24-hour limitWait for the window to pass, see rate limits
429new_user_daily_limitNew account over its 24-hour spend capCome back tomorrow
500internal_errorGeneration failed or server error. Reserved credits have been refundedRetry once; if it keeps failing, report with request_id
503auth_unavailableAuthentication service temporarily unavailableRetry in a few seconds

400 sub-codes

Parameter errors on POST /api/v1/generate come with a specific sub-code:

codeMeaning
invalid_requestBody is not JSON, or both prompt and ref_image_ids are missing
prompt_too_longprompt exceeds 4000 characters
invalid_modelmodel is not in the model table
invalid_ratioratio is invalid, or unsupported by this model; message lists the allowed values
invalid_resolutionresolution is not 1K / 2K / 4K
invalid_qualityquality is not low / medium / high
invalid_image_countn is not 1 / 2 / 4
invalid_reference_imagesref_image_ids is not an array of strings
too_many_reference_imagesMore reference images than the model allows
reference_image_missingA reference image is no longer in the Library (deleted or cleaned up)
prompt_or_reference_requiredPrompt and reference images can't both be empty

Retry advice

  • 400 / 401 / 402 / 403 / 404: retrying gives the same answer. Fix the request first
  • 429 rate_limited: 24-hour rolling window. Back off exponentially; never retry immediately
  • 500: credits are refunded, so retry once as-is. If it keeps failing, stop and report with request_id
  • 503: retry after a few seconds
  • Network timeout: generation can take up to 5 minutes. After a timeout, don't blindly resend. Check "Recent conversations" on the website first to see whether that run produced images, so you don't pay twice

Image download

Originals, thumbnails, download parameters and retention

Rate limits

Per-key request limits and new-account limits

Table of Contents

Status codes400 sub-codesRetry advice