---
title: "Create policy"
method: POST
path: "/api/policy-engine/policies/{id}"
tags: ["Policy"]
---

# Create policy

`POST /api/policy-engine/policies/{id}`

Creates a new policy from scratch.

## Permissions

Any user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:

| **Product** | **Category** | **Resource** |
| --------------- | ----------------- | ----------------- |
| Promotions Policy Engine | Policies | **Create or Update Policy** |

There are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint.To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).

>❗ To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.

## Path parameters

- `id` string, required

## Headers

- `Content-Type` string, required
- `Accept` string, required

## Request body

- PolicySaveRequest
  - `name` string, required — Policy name.
  - `description` string, required — Policy description, only for internal use.
  - `statements` StatementGetResponse[], required — Requirements for the the policy to be applied.
    - `effect` string, required — This field is not functional at the moment. To create a correct request, fill the field with `Allow`.
    - `actions` object[] — Actions that the policy will execute.
      - `id` 'SendSlackMessage' | 'SendEmail' | 'DeactivatePromotions' — Action ID.
      - `metadata` object — Data inside of the actions.
    - `resource` string — Scope on which this policy must be evaluated.
    - `condition` object — Condition to activate this policy. This object can have a maximum of ten recursive conditions.
      - `conditions` object[] — List of conditions that will activate the policy.
        - `conditions` string[] — List of conditions the actions can have. It can be an empty array `[]`.
        - `operation` 'None' | 'stringEquals' | 'stringEqualsIgnoreCase' | 'numericEquals' | 'numericLessThan' | 'numericLessThanEquals' | 'numericGreaterThan' | 'numericGreaterThanEquals' | 'bool' | 'not' | 'or' | 'and' | 'dateTimeUtcGreaterThan' | 'dateTimeUtcLessThan' | 'between' — The action of the condition.
        - `key` 'skuId' | 'brandId' | 'discountPercentage' — The element that will define what the policy will influence.
        - `values` string[] — Array with values of the key.
    - `operation` 'None' | 'stringEquals' | 'stringEqualsIgnoreCase' | 'numericEquals' | 'numericLessThan' | 'numericLessThanEquals' | 'numericGreaterThan' | 'numericGreaterThanEquals' | 'bool' | 'not' | 'or' | 'and' | 'dateTimeUtcGreaterThan' | 'dateTimeUtcLessThan' | 'between' — This operation will determine if all the conditions need to be valid or at least one of them, if the conditions array is not empty.

## Response `200`

OK

## Changes

- **2023-11-13** `93a502eef693` — 4 warning
  - removed the request property `statements/items/actions/id`
  - removed the request property `statements/items/actions/metadata`
  - removed the optional property `items/statements/items/actions/id` from the response with the `200` status
  - removed the optional property `items/statements/items/actions/metadata` from the response with the `200` status
- **2023-11-13** `d03c6f9386df` — 5 breaking, 39 warning, 39 info
  - request property `statements/items/actions/id` was restricted to a list of enum values
  - request property `statements/items/condition/conditions/items/conditions` was restricted to a list of enum values
  - request property `statements/items/condition/conditions/items/key` was restricted to a list of enum values
  - request property `statements/items/condition/conditions/items/operation` was restricted to a list of enum values
  - …79 more
- **2023-11-13** `f1d3994cfb1f` — 2 info
  - request property `statements/items/effect` deprecated
  - response property `items/statements/items/effect` deprecated

[Change history](https://skmtc.dev/vtex/apis/policies-system-api/changes/api/policy-engine/policies/:id/post.md)

---

[API](https://skmtc.dev/vtex/apis/policies-system-api.md) · [All operations](https://skmtc.dev/vtex/apis/policies-system-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vtex/policies-system-api/revisions/2527e252ffdf/schema)
