> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch validate responses using NSR-L rules + text signals.

> **Required scope:** write

**Required scope:** `write`

### Request body

`NSRValidateBatchRequest`

<ParamField body="cases" type="NSRValidateBatchItem[]" required>
  Items to validate.
</ParamField>

<ParamField body="include_neural_signals" type="boolean">
  Include NSR Machine neural signals in the response.
</ParamField>

<ParamField body="max_ngram" type="integer">
  Max n-gram length used for contains\_text assertions.
</ParamField>

<ParamField body="max_phrases" type="integer">
  Cap on total phrases asserted per text.
</ParamField>

<ParamField body="persist" type="boolean">
  Persist validation runs for history/auditing.
</ParamField>

### Response

`NSRValidateBatchResponse`

<ResponseField name="invalid" type="integer" required />

<ResponseField name="results" type="NSRValidateBatchItemResult[]" required>
  <Expandable title="NSRValidateBatchItemResult">
    <ResponseField name="case_id" type="string" />

    <ResponseField name="index" type="integer" required />

    <ResponseField name="inquiry" type="string" required />

    <ResponseField name="response" type="string" required />

    <ResponseField name="result" type="NSRValidateResponse" required>
      <Expandable title="NSRValidateResponse">
        <ResponseField name="escalations" type="string[]" required>
          Escalation topics detected.
        </ResponseField>

        <ResponseField name="execution_time_ms" type="integer (int64)" required>
          Execution time in milliseconds.
        </ResponseField>

        <ResponseField name="missing_links" type="string[]" required>
          Missing required links.
        </ResponseField>

        <ResponseField name="neural" type="object" />

        <ResponseField name="program_version_id" type="string">
          Optional NSR-L program version id used for this validation.
        </ResponseField>

        <ResponseField name="response_invalid" type="boolean" required>
          Response is explicitly invalid (response\_invalid/1).
        </ResponseField>

        <ResponseField name="run_id" type="string">
          Optional persisted run id when stored.
        </ResponseField>

        <ResponseField name="topics" type="string[]" required>
          Topics detected in the inquiry.
        </ResponseField>

        <ResponseField name="valid" type="boolean" required>
          Overall validity (no violations/missing links/escalations and not response\_invalid).
        </ResponseField>

        <ResponseField name="violations" type="string[]" required>
          Prohibited phrases detected.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer" required />

<ResponseField name="valid" type="integer" required />

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Batch validation result                            |
| `400` | Invalid request                                    |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/nsr/validate/batch' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "cases": [
      {
        "case_id": "string",
        "inquiry": "string",
        "response": "string"
      }
    ],
    "include_neural_signals": true,
    "max_ngram": 1,
    "max_phrases": 1,
    "persist": true
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "invalid": 1,
    "results": [
      {
        "case_id": "string",
        "index": 1,
        "inquiry": "string",
        "response": "string",
        "result": {
          "escalations": null,
          "execution_time_ms": null,
          "missing_links": null,
          "neural": null,
          "program_version_id": null,
          "response_invalid": null,
          "run_id": null,
          "topics": null,
          "valid": null,
          "violations": null
        }
      }
    ],
    "total": 1,
    "valid": 1
  }
  ```
</ResponseExample>
