Skip to main content
Errors use standard HTTP status codes and a consistent JSON body:
Build your error handling around error.code. Codes are stable and will not change meaning. New codes may be added, so treat unknown codes by their HTTP status.

Error codes

Fix the request (4xx, not charged)

Wait and retry (429)

Every 429 includes a Retry-After header in seconds.

Something went wrong on our side (5xx)

gender/batch can also return 502 with a full batch body, when every item failed. Check for a data array before treating it as a plain error. See Predict in batch.

Validation rules that cause 400

invalid_input is deliberately general. These are the most common causes:
  • A field name is misspelled or not supported by that endpoint, such as country on a breach endpoint.
  • A field is null. Omit optional fields instead of sending null.
  • email is not a plain address. Display names such as "Alice <alice@example.com>" are rejected.
  • country is not exactly two letters.
  • forceToGenderize: true is combined with ai_mode off or always.
  • A batch has 0 or more than 50 items, a duplicate id, an id over 100 characters, or an unknown type.
  • A value is empty after trimming, or longer than the endpoint’s maximum.

Handling errors in code

Then decide what to do by code, as described in Retries.