---
title: "Create Cookie"
method: POST
path: "/v1/cookies"
tags: ["Cookies"]
---

# Create Cookie

`POST /v1/cookies`

## Request

- Base URL: `https://customer.my.onetrust.com/api/cookiemanager`
- URL: `https://customer.my.onetrust.com/api/cookiemanager/v1/cookies`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://{$$.env.host}/api/access/v1/oauth/token`

Use this API to create a new cookie.

## Request body

- object
  - `cookieName` string, required: Name of the cookie.
  - `lifespan` 'PERSISTENT' | 'SESSION', required: Lifespan of the cookie.
  - `host` string, required: Host of the cookie.
  - `description` string: Description of the cookie, It should be 1075 characters or less.
  - `customCategoryName` string, required: Unique identifier of a cookie category (Cookie Category ID).
  - `length` integer: Length of the cookie lifespan, enter a number greater than 0 if this is a persistent cookie, otherwise leave as 0.
  - `durationType` 1 | 7 | 30 | 365, required: Unit of time for the cookie lifespan, enter 1 (for days), 7 (for weeks), 30 (for months), or 365 (for years) based on the time unit the cookie lifespan is measured in.
  - `domainCookieCategoryList` object[]: A list of domain level categorizations for the Cookie.
    - `domainId` string: ID of the domain.
    - `customCategoryName` string: ID of a cookie category (cookie category id).
    - `thirdParty` boolean: Flag indicating if the cookie is third-party or first-party, use False if the cookie is first-Party.

## Response `201`

Created.

- object
  - `id` string: ID of the cookie.
  - `name` string: Name of the cookie.
  - `description` string: Purpose of the cookie.
  - `host` string: Host of the cookie.
  - `path` string: Path of the cookie.
  - `source` string: The source from which the cookie is created.
  - `cookieLifeSpan` string: Lifespan of the cookie.
  - `httpOnly` boolean: Flag indicating the cookie is Http only or not.
  - `secure` boolean: Flag indicating the cookie is secure or not.
  - `length` integer: Length of the cookie lifespan.
  - `durationType` integer: Unit of time for the cookie lifespan.

## Other responses

- `400`: Bad Request. **Possible reason**: Invalid or missing parameter passed.
- `401`: Unauthorized.
- `403`: Forbidden. **Possible reasons**: You do not have enough permissions to invoke this endpoint.
- `404`: Not Found
- `500`: Internal Server Error. **Possible reason**: Cookie with the same name and host already exists.

---

[API](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent-swagger.md) - [All operations](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent-swagger/llms.txt) - [OpenAPI document](https://skmtc.dev/onetrust/apis/consent-preferences-cookie-consent-swagger/revisions/91142c74595f?raw)
