For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • About Our APIs
  • REST
    • Overview
      • Overview
      • Carts
      • Checkouts
      • Consent
          • POSTSet Cookie Consent Preferences
      • Customers
      • Subscriptions
      • Form Fields
      • Orders
      • Pickup Options
  • GraphQL
    • Overview
  • MCP
    • Overview
Dev Portal
LogoLogo
RESTStorefrontConsent

Set Cookie Consent Preferences

POST
https://your_store.example.com/api/storefront/consent
POST
/api/storefront/consent
$curl -X POST https://your_store.example.com/api/storefront/consent \
> -H "Accept: application/json" \
> -H "Content-Type: application/json" \
> -d '{
> "allow": [
> 1,
> 2
> ],
> "deny": [
> 3
> ]
>}'
1{}
Sets the status of a customer's consent to allow data collection by cookies and scripts according to the following consent categories: 1. Analytics — These cookies provide statistical information on site usage so the store owner can improve the website over time. 2. Functional — These cookies enable enhanced functionality, such as videos and live chat. If a shopper does not allow these, then some or all of these functions may not work properly. 3. Targeting; Advertising — These cookies allow merchants to create profiles or personalize content to enhance users' shopping experience. This endpoint only works if the cookie consent feature is enabled. It is assumed the shopper has not consented to anything until a value is explicitly set. The request body must be populated with a complete set of allowed and denied categories. Once set, consent preferences will be saved as a cookie for guest shoppers. Consent preferences will be persisted to a shopper's account to be used for future sessions once they have logged in. Consent preferences can also be managed using the [Update customer consent](/developer/api-reference/rest/admin/management/customers/v3/consent/update-customer-consent) endpoint. > #### Note > * Substitute your storefront domain for `yourstore.example.com`.
Was this page helpful?
Previous

Storefront Cookie Consent

Next

Storefront Customers

Built with

Sets the status of a customer’s consent to allow data collection by cookies and scripts according to the following consent categories:

  1. Analytics — These cookies provide statistical information on site usage so the store owner can improve the website over time.

  2. Functional — These cookies enable enhanced functionality, such as videos and live chat. If a shopper does not allow these, then some or all of these functions may not work properly.

  3. Targeting; Advertising — These cookies allow merchants to create profiles or personalize content to enhance users’ shopping experience.

This endpoint only works if the cookie consent feature is enabled. It is assumed the shopper has not consented to anything until a value is explicitly set. The request body must be populated with a complete set of allowed and denied categories.

Once set, consent preferences will be saved as a cookie for guest shoppers. Consent preferences will be persisted to a shopper’s account to be used for future sessions once they have logged in. Consent preferences can also be managed using the Update customer consent endpoint.

Note

  • Substitute your storefront domain for yourstore.example.com.

Headers

AcceptstringRequiredDefaults to application/json

The MIME type of the response body.

Request

Data sent to the Update customer consent endpoint when creating a customer during checkout.

allowlist of enumsRequired
Explicitly allowed consent categories. Allowed values are 1, 2, 3.
Allowed values:
denylist of enumsRequired
Denied consent categories. Allowed values are 2, 3, 4.
Allowed values:

Response

Consent Settings Saved

Errors

400
Bad Request Error