ドキュメント
Error codes and how to handle them
FlowAPI returns 16 error codes, each with an HTTP status, an action that tells your code what to do next and a retryable flag.
Error format
json
{
"error": {
"code": "FLOW_INSUFFICIENT_BALANCE",
"message": "Your balance does not cover this job",
"action": "add_funds",
"retryable": false,
"request_id": "req_…"
}
}
Branch on code or action, never on message: messages are for humans and can change. Quote request_id when you contact support.
All codes
| Code | HTTP | Action | Retryable | Meaning |
|---|---|---|---|---|
FLOW_INVALID_REQUEST |
400 | fix_request |
No | The body, a header or a parameter is malformed. |
FLOW_UNAUTHORIZED |
401 | fix_request |
No | Missing, invalid, revoked or expired API key. |
FLOW_INSUFFICIENT_BALANCE |
402 | add_funds |
No | The balance does not cover the quoted price. |
FLOW_SPEND_LIMIT_EXCEEDED |
403 | fix_request |
No | The job would pass this key's monthly limit. |
FLOW_ACCOUNT_RESTRICTED |
403 | contact_support |
No | The account is restricted. |
FLOW_MODEL_NOT_FOUND |
404 | fix_request |
No | No active model has this id. |
FLOW_JOB_NOT_FOUND |
404 | fix_request |
No | No job with this id belongs to your account. |
FLOW_FILE_NOT_FOUND |
404 | fix_request |
No | The uploaded file does not exist or has expired. |
FLOW_IDEMPOTENCY_CONFLICT |
409 | fix_request |
No | The Idempotency-Key was already used with a different body. |
FLOW_CONTENT_REJECTED |
422 | modify_input |
No | The model refused the input or output content. |
FLOW_UNSUPPORTED_PARAMETER |
422 | modify_input |
No | A parameter value has no price rule or is out of range. |
FLOW_RATE_LIMITED |
429 | retry_later |
Yes | Too many requests this minute. |
FLOW_TOO_MANY_RUNNING_JOBS |
429 | retry_later |
Yes | Too many jobs are running at once. |
FLOW_MODEL_UNAVAILABLE |
503 | retry_later |
Yes | The model is temporarily unavailable. |
FLOW_TEMPORARILY_UNAVAILABLE |
503 | retry_later |
Yes | The service is temporarily unavailable. |
FLOW_GENERATION_FAILED |
500 | retry_later |
Yes | Job-level only: the generation itself failed. |
Actions
fix_request: change the request; sending it again unchanged fails again.add_funds: top up the balance, then retry.modify_input: change the prompt, files or parameters.retry_later: retry with backoff.429responses carry aRetry-Afterheader in seconds.contact_support: write to support with therequest_id.
A job that fails after it was accepted keeps the same error object inside the job, and its price is refunded in full ("refunded": true).
FAQ
- Which errors should I retry?
- Retry only errors with retryable: true: FLOW_RATE_LIMITED, FLOW_TOO_MANY_RUNNING_JOBS, FLOW_MODEL_UNAVAILABLE and FLOW_TEMPORARILY_UNAVAILABLE, with backoff and the same Idempotency-Key.
- Am I charged when a request returns an error?
- No. Requests rejected with an error are not charged, and jobs that fail later are refunded in full.
- What does FLOW_UNSUPPORTED_PARAMETER mean?
- It means a parameter value has no price rule for that model or is out of range, for example n above 4 or a resolution the model does not sell.