---
title: "Create a policy"
method: POST
path: "/approval/policy"
tags: ["Policy"]
---

# Create a policy

`POST /approval/policy`

Creates a new policy.

## Request body

- PolicyCreate
  - `nrn` string, required — A resource identifier (NRN) specifying where the policy applies.
  - `name` string, required — The name of the policy.
  - `conditions` object, required — A JSON object defining the conditions under which this policy applies.
  - `selector` object — A JSON object that acts as a pre-filter. If the selector does not match the request context, the policy is skipped entirely and its conditions are not evaluated. > **Note:** We recommend using selectors for services, as they allow you to target specific service specifications.

## Response `200`

The operation was successful.

- Policy
  - `id` integer, required — A unique identifier for the policy.
  - `nrn` string, required — A resource identifier (NRN) specifying where the policy applies.
  - `name` string, required — The name of the policy.
  - `slug` string — A URL-friendly identifier derived from the policy name. Generated automatically on creation.
  - `status` 'active' | 'deleted' — The current status of the policy.
  - `conditions` object, required — A JSON object defining the conditions under which this policy applies. Uses MongoDB query syntax.
  - `selector` object — A JSON object that acts as a pre-filter. If the selector does not match the request context, the policy is skipped entirely and its conditions are not evaluated. Useful when multiple policies are attached to the same action and each should apply only to a specific subset of requests.

## Other responses

- `4XX` — Client error responses due to invalid input or missing parameters.
- `5XX` — Server error responses indicating an issue on the API side.

---

[API](https://skmtc.dev/nullplatform/apis/nullplatform-api.md) · [All operations](https://skmtc.dev/nullplatform/apis/nullplatform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nullplatform/nullplatform-api/revisions/1c4ea154b159/schema)
