Create a batch
POST/v1/moderations/batchKey scope moderate
Moderates up to 100 objects in one request and returns one result per item, in the order sent. A batch of at most 10 single text objects runs in the request and answers 200; any other batch (more items, a form, an image, or an item with mode set to async) is queued item by item and answers 202. An item that is refused does not fail the batch: its place in data holds an error entry.
Needs a key with the moderate scope. Authentication
Headers
Idempotency-KeyWorks as on
POST /v1/moderations, for the batch as a whole: a repeat of the key with the same body returns the stored response for 24 hours.
Request body
itemsarray of moderation request objectsRequiredThe objects to moderate, 1 to 100 of them, each a single object or a whole form with the same properties as the body of
POST /v1/moderations. The organisation's plan can set a lower maximum. The batch decides how items run:asyncon any item queues the whole batch, andsyncon an item is ignored once the batch is queued. The request body is limited to 2 MB.
Returns
Status 200 when the batch ran in the request, 202 when it was queued. Both carry a list object whose data has one entry per item: a moderation, or an entry with object set to error, the item's index and an error holding code, message and details. Refusals of one item, such as template_not_found or quota_exceeded, appear there and never change the status of the batch. has_more is always false.
- 200 OKA list of moderation objects
- 202 AcceptedA list of moderation objects
Errors
- 400
invalid_requestIdempotency-Keyis longer than 255 characters.- 403
plan_limitThe batch has more items than the organisation's plan allows.
details[0].messageislimit N.- 409
idempotency_key_reusedThe
Idempotency-Keywas already used with a different request body.- 409
idempotency_in_progressA request with the same
Idempotency-Keyis still being processed.- 422
validation_erroritemsis empty or has more than 100 entries, the body has another key, or any item matches neither moderation shape. No item is processed.
Every endpoint can also answer the errors any request can meet: a missing key, a rate limit, a malformed body. Errors
Something missing or unclear on this page? Write to support@useinfrared.com.