> ## Documentation Index
> Fetch the complete documentation index at: https://developer.onetrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Cookie

Use this API to update an existing cookie.
> 🗒 Things to Know
> 
> - There are two types of IDs for cookies: Cookie ID and Domain Cookie ID. The **Cookies Results All Domains** export can be downloaded from the Categorizations screen in the OneTrust application to select the ID for the `cookieId` parameter.
> - For manually created cookies, only `cookieName`, `lifespan`, an `host` will be updated.
> - Values must be passed in all the parameters within `descriptionTranslations` for a cookie translation to be updated.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0",
    "title": "Consent & Preferences - Cookie Consent (Swagger)"
  },
  "tags": [
    {
      "name": "Cookies"
    }
  ],
  "paths": {
    "/v1/cookies": {
      "put": {
        "responses": {
          "200": {
            "description": "Update completed. Response may include error messages indicating what changes were not complete.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "description": "Status of the API."
                    },
                    "errorMessages": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request.\n\n**Possible reason**: Invalid cookieid, please check if cookieId passed is correct."
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Forbidden.\n\n**Possible reasons**:\nYou do not have enough permissions to invoke this endpoint. "
          },
          "404": {
            "description": "Not Found."
          },
          "409": {
            "description": ""
          },
          "429": {
            "description": "Too Many Requests\nFor more information, see [API Rate Limits](https://developer.onetrust.com/onetrust/reference/rate-limits-overview).",
            "headers": {
              "Retry-After": {
                "description": "The number of seconds after which requests will be allowed again.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "ot-ratelimit-event-id": {
                "description": "The unique identifier for the rate-limiting event.",
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "ot-requests-allowed": {
                "description": "The number of requests allowed within the specified period.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              },
              "ot-period": {
                "description": "The unit of time for which the rate limit applies.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "HOUR",
                    "MINUTE"
                  ]
                }
              },
              "ot-request-made": {
                "description": "The number of requests made within the specified period.",
                "schema": {
                  "type": "integer",
                  "format": "int32"
                }
              }
            }
          }
        },
        "summary": "Update Cookie",
        "operationId": "updateCookie",
        "tags": [
          "Cookies"
        ],
        "security": [
          {
            "oauth2": [
              "COOKIE"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "cookieId": {
                    "type": "string",
                    "description": "ID of the cookie. This value is obtained from [Create Cookie](/onetrust/reference/createnewcookie) API."
                  },
                  "cookieName": {
                    "type": "string",
                    "description": "Name of the cookie."
                  },
                  "lifespan": {
                    "type": "string",
                    "enum": [
                      "PERSISTENT",
                      "SESSION"
                    ],
                    "description": "Lifespan of the cookie."
                  },
                  "host": {
                    "type": "string",
                    "description": "Host of the cookie."
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of the cookie. or less",
                    "default": "\"\""
                  },
                  "thirdPartyDescription": {
                    "type": "string",
                    "description": "Short text describing the host’s purpose or description of the cookie. It should be 1075 characters or less.",
                    "default": "\"\""
                  },
                  "customCategoryName": {
                    "type": "string",
                    "description": "Unique identifier of a cookie category (Cookie Category ID).",
                    "example": "C0001"
                  },
                  "length": {
                    "type": "integer",
                    "description": "Length of the cookie lifespan, enter a number greater than 0 if this is a persistent cookie, otherwise leave as 0.",
                    "default": 0
                  },
                  "durationType": {
                    "type": "integer",
                    "enum": [
                      1,
                      7,
                      30,
                      365
                    ],
                    "description": "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.",
                    "example": "1, 7, 30, 365"
                  },
                  "domainCookieCategoryList": {
                    "type": "array",
                    "default": [],
                    "description": "A list of domain level categorizations for the cookie.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "domainId": {
                          "type": "string",
                          "description": "ID of a domain."
                        },
                        "customCategoryName": {
                          "type": "string",
                          "description": "Unique identifier of a cookie category (cookie category ID)."
                        },
                        "thirdParty": {
                          "type": "boolean",
                          "description": "Flag indicating if the cookie is third-party or first-party, use false if the cookie is first-party."
                        }
                      }
                    }
                  },
                  "domainToDeleteIds": {
                    "default": [],
                    "description": "A list of domain IDs to be unassigned from cookie.",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "domainCookieSource": {
                    "type": "array",
                    "description": "Domain Cookie Source to be added.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "domainId": {
                          "type": "string",
                          "description": "Unique Identifier of a domain."
                        },
                        "domainCookieSourceRequestDtoList": {
                          "type": "array",
                          "default": [],
                          "items": {
                            "type": "object",
                            "properties": {
                              "ResourceUrl": {
                                "type": "string",
                                "example": "testUrl"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "domainCookieSourceToDelete": {
                    "type": "array",
                    "description": "Domain Cookie Source to be removed.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique Identifier of a domain cookie source."
                        }
                      }
                    }
                  },
                  "descriptionTranslations": {
                    "type": "array",
                    "description": "Description translations",
                    "items": {
                      "type": "object",
                      "properties": {
                        "langCode": {
                          "type": "string",
                          "description": "Language code.",
                          "example": "EN"
                        },
                        "defaultDescription": {
                          "type": "string",
                          "description": "Short text describing what is the purpose of the cookie."
                        },
                        "thirdPartyDescription": {
                          "type": "string",
                          "description": "Short text describing the host’s purpose or description. of the cookie"
                        }
                      }
                    }
                  }
                },
                "required": [
                  "cookieId"
                ]
              }
            }
          },
          "x-examples": {
            "application/json": {
              "cookieId": "5dd32a8b-de66-42d1-a4d8-0000b6a10b1a",
              "cookieName": "testing",
              "host": "test_host",
              "description": "this is for testing",
              "customCategoryName": "C0001",
              "lifespan": "1",
              "length": "12",
              "domainToDeleteIds": [
                "25699e98-dc06-4d1f-b7b7-8c528f768eb0"
              ],
              "domainCookieCategoryList": [
                {
                  "domainId": "c9e7cd88-1a25-4fff-b18b-000ec335782d",
                  "customCategoryName": "12312312312312321"
                },
                {
                  "domainId": "3bac22c5-b790-4dc5-9acf-00d7ad485c93"
                }
              ],
              "domainCookieSource": [
                {
                  "domainId": "c9e7cd88-1a25-4fff-b18b-000ec335782d",
                  "domainCookieSourceRequestDtoList": [
                    {
                      "ResourceUrl": "testResourceUrl"
                    }
                  ]
                }
              ],
              "domainCookieSourceToDelete": [
                {
                  "id": "c9e7cd88-1a25-4fff-b18b-000ec335782d"
                }
              ],
              "descriptionTranslations": [
                {
                  "langCode": "IT"
                },
                {
                  "langCode": "ES",
                  "defaultDescription": "defaultDescription",
                  "thirdPartyDescription": "thirdPartyDescription"
                }
              ]
            }
          }
        },
        "description": "Use this API to update an existing cookie.\n> 🗒 Things to Know\n> \n> - There are two types of IDs for cookies: Cookie ID and Domain Cookie ID. The **Cookies Results All Domains** export can be downloaded from the Categorizations screen in the OneTrust application to select the ID for the `cookieId` parameter.\n> - For manually created cookies, only `cookieName`, `lifespan`, an `host` will be updated.\n> - Values must be passed in all the parameters within `descriptionTranslations` for a cookie translation to be updated."
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "x-readme": {
    "explorer-enabled": false,
    "metrics-enabled": false,
    "proxy-enabled": true
  },
  "x-onetrust": {
    "spec-label": "Swagger 2",
    "links": {
      "Cookie Consent Knowledge Base": "https://my.onetrust.com/s/topic/0TO1Q000000ItRyWAK/cookie-compliance"
    }
  },
  "servers": [
    {
      "url": "https://customer.my.onetrust.com/api/cookiemanager"
    }
  ],
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://{$$.env.host}/api/access/v1/oauth/token",
            "scopes": {
              "COOKIE": "Cookie Scope gives the user access to read/write operations inside the Cookie Consent module.",
              "COOKIE_READ": "Cookie Read Scope gives the user read-only access to the Cookie Consent module.",
              "COOKIE_FREE": "Cookie free Scope gives free users access to apis having free scope associated to them inside the Cookie Consent module."
            }
          }
        }
      }
    }
  }
}
```