---
title: "Create New Cookie Consent Rules"
method: POST
path: "/v1/cookie-consent/rules"
tags: ["cmpRules"]
---

# Create New Cookie Consent Rules

`POST /v1/cookie-consent/rules`

## Request

- Base URL: `https://api.osano.com`
- URL: `https://api.osano.com/v1/cookie-consent/rules`
- Auth: API key in header `x-osano-api-key`
- TypeScript: <https://skmtc.dev/osano/apis/osano-api-reference/docs/v1/cookie-consent/rules/post.ts> (a function with typed inputs; its response is checked against the schema)

Create one or more Cookie Consent Rules. The maximum number of rules that may be created in a single call is 100.  If the request is successful, the response will contain a list of the created rules.

## Request body

- object
  - `configIds` string[], required
  - `cookies` CmpCookieRuleRequiredProps[]
    - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION', required
    - `rule` string, required: The type of the rule.
    - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
    - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
    - `vendorName` string, nullable: The value of the rule.
    - `description` string, nullable: A description of the cookie to be used in disclosures.
    - `expiry` string, nullable: The length of time that must elapse before the cookie expires.
  - `iframes` CmpRuleRequiredProps[]
    - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION', required
    - `rule` string, required: The type of the rule.
    - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
    - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
    - `vendorName` string, nullable: The value of the rule.
  - `scripts` CmpRuleRequiredProps[]
    - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION', required
    - `rule` string, required: The type of the rule.
    - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
    - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
    - `vendorName` string, nullable: The value of the rule.
  - `localStorage` CmpRuleRequiredProps[]
    - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION', required
    - `rule` string, required: The type of the rule.
    - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
    - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
    - `vendorName` string, nullable: The value of the rule.

## Response `200`

Success

- object
  - `items` union[]
    - union
      - object
        - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION'
        - `rule` string: The type of the rule.
        - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
        - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
        - `vendorName` string, nullable: The value of the rule.
        - `type` 'cookie' | 'script' | 'iframe'
        - `ruleId` integer
        - `configId` string, uuid
        - `vendorId` string
        - `created` string, date-time
        - `updated` string, date-time
      - object
        - `classification` 'ANALYTICS' | 'BLACKLISTED' | 'ESSENTIAL' | 'HIDDEN' | 'MARKETING' | 'PERSONALIZATION'
        - `rule` string: The type of the rule.
        - `disclosure` boolean: Whether the rule should be disclosed. If omitted, this property will default to `false`.
        - `title` string, nullable: The title of the rule. This is used in the consent disclosure in place of the rule when defined.
        - `vendorName` string, nullable: The value of the rule.
        - `description` string, nullable: A description of the cookie to be used in disclosures.
        - `expiry` string, nullable: The length of time that must elapse before the cookie expires.
        - `type` 'cookie' | 'script' | 'iframe'
        - `ruleId` integer
        - `configId` string, uuid
        - `vendorId` string
        - `created` string, date-time
        - `updated` string, date-time

## Other responses

- `400`: Bad Request
- `409`: Conflict
- `429`: Too Many Requests

## Changes

- **2026-11-06** `ac31099cf83e`: 1 breaking, 4 warning, 1 info
  - added `subschema #1, subschema #2` to the `items/items/` response property `oneOf` list for the response status `200`
  - removed the request property `cookies/items/allOf[#/components/schemas/CmpCookieRule]/allOf[#/components/schemas/CmpRule]/ruleType`
  - removed the request property `iframes/items/allOf[#/components/schemas/CmpRule]/ruleType`
  - removed the request property `localStorage/items/allOf[#/components/schemas/CmpRule]/ruleType`
  - …2 more
- **2026-05-12** `4fc37598750d`: 1 breaking, 5 info
  - added `subschema #1, subschema #2` to the `items/items/` response property `oneOf` list for the response status `200`
  - added the new optional request property `cookies/items/allOf[#/components/schemas/CmpCookieRule]/allOf[#/components/schemas/CmpRule]/ruleType`
  - added the new optional request property `iframes/items/allOf[#/components/schemas/CmpRule]/ruleType`
  - added the new optional request property `localStorage`
  - …2 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/osano/apis/osano-api-reference/changes/v1/cookie-consent/rules/post.md)

---

[API](https://skmtc.dev/osano/apis/osano-api-reference.md) - [All operations](https://skmtc.dev/osano/apis/osano-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/osano/apis/osano-api-reference/revisions/ac31099cf83e?raw)
