Unprofane
DocsBatch checks

Batch checks

Up to 100 texts and 30,000 characters in one request, each text with its own id, answered in order. One bad item never fails the batch.

JSON
POST /v1/check/batch
{
  "items": [
    { "id": "a", "text": "Have a lovely day" },
    { "id": "b", "text": "f.u.c.k off", "policy": "kids" }
  ],
  "context": "comment",
  "policy": "standard"
}

Each item carries an id you choose and may override context and policy; mode, mask and engine are set once for the batch. Results come back in the same order:

JSON
{
  "results": [
    { "id": "a", "result": { "allowed": true, "action": "allow", "…": "…" } },
    { "id": "b", "result": { "allowed": false, "action": "block", "…": "…" } }
  ],
  "counted": 2
}

An item that fails validation on its own comes back as { "id", "error": { "type", "title", "detail" } } and the rest are answered. counted is what the batch cost against the allowance.

A batch holds up to 100 items and 30,000 characters of text in all, counted as JavaScript counts a string’s length (an emoji is two): three texts at the 10,000-character limit, or a hundred of 300. A batch over either is refused whole with a 400 invalid-request, before anything is counted; send the rest in another batch. The cap keeps the costliest batch inside the time the API gives one request.

Up to four model calls run at a time inside a batch, so a batch of a hundred comments takes a few seconds in balanced mode, where the model reads every item but a word or two the rules block outright; in fast mode the rules answer a batch of a hundred in one.