PhotoGPT Developers

Understand common API errors and recovery steps.

Error Codes

The API uses standard HTTP status codes and returns structured JSON for most failures.

CodeMeaningResolution
400Bad RequestCheck the request payload and required fields.
401UnauthorizedCheck the API key and Authorization header.
404Not FoundCheck the model, image, video, or job ID.
409ConflictRetry the request later.
429Rate LimitApply backoff before retrying generation jobs.
5xxServer ErrorRetry later or contact support.

Error response

Error responses may include:

{
  "status": "NOK",
  "message": "Human-readable error message",
  "err": "Internal or validation error detail",
  "result": null
}

Not every field is guaranteed on every error. Prefer message for user-facing handling and log err for debugging when it is present.

Basic error handling

const response = await fetch(`${BASE_URL}/models`, {
  headers,
})

if (response.status === 401) {
  throw new Error('Invalid or missing API key.')
}

if (response.status === 429) {
  throw new Error('Rate limit reached. Retry with backoff.')
}

if (!response.ok) {
  throw new Error(await response.text())
}
response = requests.get(f"{BASE_URL}/models", headers=headers)

if response.status_code == 401:
    raise Exception("Invalid or missing API key.")

if response.status_code == 429:
    raise Exception("Rate limit reached. Retry with backoff.")

response.raise_for_status()

Retry guidance

Retry only requests that are safe for your integration to repeat.

StatusRetry?Notes
400NoFix the request payload first.
401NoRefresh or replace the API key.
404NoConfirm the model, image, video, or job ID.
409MaybeRetry after the conflicting operation finishes.
429YesUse exponential backoff and avoid starting too many active jobs.
5xxYesRetry with backoff; contact support if the issue keeps happening.

For unresolved API issues, contact support@photogptai.com.

On this page