---
title: "Update Cookie Consent Rule"
method: PATCH
path: "/v1/cookie-consent/rules/{ruleId}"
tags: ["cmpRules"]
---

# Update Cookie Consent Rule

`PATCH /v1/cookie-consent/rules/{ruleId}`

## Request

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

Update an existing Cookie Consent Rule by ID.

## Path parameters

- `ruleId` integer, required

## Request body

- union
  - CmpRule
    - `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.
  - CmpCookieRule
    - `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.

## Response `200`

Success

- 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

## Changes

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

[Operation history](https://skmtc.dev/osano/apis/osano-api-reference/changes/v1/cookie-consent/rules/:ruleId/patch.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)
