---
title: "Run Rule Test Batch"
method: POST
path: "/api/v1/custom-rules/test-batch"
tags: ["custom-rules"]
---

# Run Rule Test Batch

`POST /api/v1/custom-rules/test-batch`

## Request

- Base URL: `https://app.kaminari.ad`
- URL: `https://app.kaminari.ad/api/v1/custom-rules/test-batch`
- Auth: HTTP bearer

Test up to 20 unsaved rules against up to 50 stored scans in one call.

The reply always arrives within the request deadline. A cell the
deadline cut off carries ``error_code=deadline_exceeded``; send just
those again. A bad rule rejects the request with 422. A missing scan
or a failed evaluation is reported on its cell; the rest of the matrix
still returns. One batch per organization runs at a time: a second
one gets 429 ``checking.rule_test_batch_in_progress``.

## Request body

- RuleTestBatchRequest: Body for POST /api/v1/custom-rules/test-batch. Up to 20 rules against up to 50 stored scans. A request over either cap, or with any invalid rule, is rejected before a scan is loaded.
  - `rules` RuleTestBatchRule[], required
    - `id` string, uuid, nullable
    - `rule_type` string, required
    - `config` object, required
    - `target` string
    - `name` string
  - `scan_ids` string[], required

## Response `200`

Successful Response

- RuleTestBatchResponse: Response from POST /api/v1/custom-rules/test-batch.
  - `results` RuleTestBatchCell[], required
    - `index` integer, required
    - `rule_id` string, uuid, nullable
    - `scan_id` string, uuid, required
    - `matched` boolean, required
    - `tags` RuleTestTagResult[], required
      - `tag_slug` string, required
      - `detail` string
    - `elapsed_ms` integer, required
    - `error` string, nullable
    - `error_code` string, nullable
  - `summary` RuleTestBatchSummary, required: Counts over the flat cell list. ``matched`` counts cells that matched and have no ``error``. ``failed`` counts cells whose ``error`` is set; ``deadline_exceeded`` is the part of them the batch deadline cut off.
    - `total` integer, required
    - `matched` integer, required
    - `failed` integer, required
    - `deadline_exceeded` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kaminari/apis/kaminari-ad-api.md) · [All operations](https://skmtc.dev/kaminari/apis/kaminari-ad-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kaminari/apis/kaminari-ad-api/revisions/013f86e2fd32?raw)
