Errors

Error response format and common HTTP status codes.


Error Response Shape

All error responses follow a consistent JSON structure with a human-readable message and a machine-readable code.

{
  "error": {
    "message": "Human-readable error message",
    "code": "machine_readable_code"
  }
}

HTTP Status Codes

HTTP StatusCodeMeaning
400validation_errorInvalid request body or parameters
401unauthorizedMissing or invalid API key
402payment_requiredPayment required
402insufficient_creditsNot enough credits to complete the request
403forbiddenForbidden (e.g., Instagram publish permission not granted)
404not_foundResource not found or API not enabled for account
429rate_limit_exceededToo many requests
500internal_server_errorInternal server error

The code field is always present in error responses. A 400 from request validation uses validation_error; other 400 errors use bad_request. A 402 uses insufficient_credits when the error message mentions insufficient credits, and payment_required otherwise.

Example

400 Bad Request

{
  "error": {
    "message": "'model' is required",
    "code": "validation_error"
  }
}