---
title: "Policy as code: POST a crawlcheck-policy document (defaults, per-action rules, tests). Returns lint errors, or its id (pol1:<sha256 of the canonical normalised document>) and stores it; ?dry=1 checks without storing. Preflight then takes policy_id, and every receipt names it. Schema: /schemas/policy.json"
method: POST
path: "/api/v1/policy"
---

# Policy as code: POST a crawlcheck-policy document (defaults, per-action rules, tests). Returns lint errors, or its id (pol1:<sha256 of the canonical normalised document>) and stores it; ?dry=1 checks without storing. Preflight then takes policy_id, and every receipt names it. Schema: /schemas/policy.json

`POST /api/v1/policy`

## Request

- Base URL: `https://crawlcheck.io`
- URL: `https://crawlcheck.io/api/v1/policy`
- Auth: none required

## Request body

- PolicyJson (unresolved $ref)

## Response `200`

id and normalised document

- object, nullable
  - `ok` boolean, nullable
  - `stored` boolean, nullable
  - `policy` object, nullable
    - `id` unknown
    - `document` object, nullable
      - `kind` string, nullable
      - `v` number, nullable
      - `name` string, nullable
      - `actions` object, nullable
        - `read` object, nullable
          - `max_age_hours` number, nullable
          - `on_warn` string, nullable
          - `require_entity` boolean, nullable
          - `human_approval` unknown[], nullable
            - unknown
          - `allow` unknown[], nullable
            - unknown
          - `deny` unknown[], nullable
            - unknown
        - `transact` object, nullable
          - `max_age_hours` number, nullable
          - `on_warn` string, nullable
          - `require_entity` boolean, nullable
          - `human_approval` string[], nullable
          - `allow` unknown[], nullable
            - unknown
          - `deny` unknown[], nullable
            - unknown
      - `tests` object[], nullable
        - `domain` string, nullable
        - `action` string, nullable
        - `expect` string[], nullable
    - `url` unknown
  - `use` object, nullable
    - `preflight` object, nullable
      - `domain` string, nullable
      - `action` string, nullable
      - `policy_id` unknown

## Other responses

- `422`: lint errors

---

[API](https://skmtc.dev/crawlcheck/apis/crawlcheck-api.md) · [All operations](https://skmtc.dev/crawlcheck/apis/crawlcheck-api/llms.txt) · [OpenAPI document](https://skmtc.dev/crawlcheck/apis/crawlcheck-api/revisions/57acbd6d4489?raw)
