Limits and retries
Limits
Section titled “Limits”| What | Limit | If you exceed it |
|---|---|---|
| Request body (a batch is one body) | 1 MiB | 413 payload_too_large |
| Items per batch | 1 to 500 | 422 empty_batch / too_many_items at /items |
| Messages per conversation, per write | 2,000 | 422 too_many_items at /messages |
tags per conversation |
1,000 | 422 too_many_items at /tags |
| Characters per text | 20,000 | 422 text_too_long |
Record key (user_id, conversation_id, booking_id, order_id, ticket_id) |
255 characters | 422 text_too_long |
limit on lists |
1 to 1000, default 100 | 400 invalid_query |
| JSON nesting | 64 levels | 400 invalid_json |
A transcript larger than 1 MiB is sent in several calls with the same conversation_id: messages are only added, and those already stored are skipped.
Request rate
Section titled “Request rate”Requests may be rate limited per key. If you go over the limit, the response is 429 with code: "rate_limited" and a Retry-After header with the seconds to wait. A batch counts as one request, so grouping writes helps.
What to retry
Section titled “What to retry”| Response | Retry? |
|---|---|
| No response (timeout, network error) | Yes, with increasing backoff |
429 |
Yes, after Retry-After |
500, 502, 503, 504 |
Yes, with increasing backoff |
400, 401, 403, 404, 405, 413, 415, 422 |
No. It will fail the same way until you change the body, the URL or the key |
200 with result: "stale" |
No. It is not an error: a newer version is already stored |
Retrying a write is safe: each record is identified by its key, and the same body answers unchanged. The same holds for a whole batch.
Retries in a batch
Section titled “Retries in a batch”A batch answers 200 even when some items fail. Compare succeeded with total, or check each item’s status:
- Resend only the items that failed with
5xx(by theirindex), or the whole batch. - Do not resend an item that failed with
422without fixing it.
More in Examples: several writes in one call.