Shopper Consents

GET Get shopper consent preferences

GET /organizations/{organizationId}/subscriptions

Operation ID: getSubscriptions. Security: ShopperToken (sfcc.shopper-consents, sfcc.shopper-consents.rw); ShopperClientContextToken (sfcc.shopper-consents, sfcc.shopper-consents.rw).

Retrieve all subscription preferences for the shopper (authenticated or guest).

Use the 'expand' parameter to include additional fields in the response:

  • expand=["consentStatus"]: Include subscription status information
  • expand=[]: Default behavior, excludes status for privacy and performance

The expand parameter provides privacy benefits by not exposing sensitive status information unless explicitly requested.

Parameters

  • organizationId (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f_ecom_' followed by a 4-character realm identifier and a 3-character instance type identifier.

    Example

    f_ecom_zzxy_prd
  • siteId (query, SiteId, required) The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.

    Example: SiteId

    RefArch
  • locale (query, LocaleCode) A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter Accept-Language following RFC 2616 & RFC 1766. This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.

    Example: LanguageCountry

    en-US

    Example: CountryCode

    US
  • tags (query, array of Tag, style: form, explode: false) Optional parameter of 0 or more query string values which act as a filtering criteria. Multiple values are treated with OR logic, and absence of a value indicates no filtering by tag is desired.
    Minimum items: 0. Maximum items: 10.

    Example: one One tag filter

    [
      "homepage_banner"
    ]

    Example: multiple Multiple tag filters (ORs)

    [
      "homepage_banner",
      "user_profile",
      "checkout",
      "registration"
    ]
  • expand (query, array of string, style: form, explode: false)

    Optional parameter to expand response with additional fields. Accepts an array of field names to include in the response. Currently supports:

    • "consentStatus": Include consent status information in the response

    Future expansions may include additional fields.


    Items: Allowed values: consentStatus. Example: consentStatus. Default: []. Minimum items: 0. Maximum items: 10. Unique items.

    Example: empty No expansion (default behavior)

    []

    Example: consentStatus Include status information

    [
      "consentStatus"
    ]
  • sfdc_usid (header, string (uuid)) A unique shopper identifier (USID) for tracking client context. Used with endpoints secured with ShopperClientContextToken. This header is required for all endpoints secured with ShopperClientContextToken.
    Example: 550e8400-e29b-41d4-a716-446655440000.
  • personalized (query, string) Controls whether personalization is applied to the response. When set to none, the server skips applying personalization to the response.
    Allowed values: none. Example: none.
  • sfdc_shopper_context (header, string) Shopper context information (for example clientIP, sourceCode, and customQualifiers) passed in from a trusted backend application.

Responses

  • 200 Successfully retrieved subscription preferences.

    Media type: application/json. Schema: ConsentSubscriptionResponse.

    Example ConsentSubscriptionResponseGuest: same as GET /organizations/{organizationId}/subscriptions 200 response. GUEST shopper's available consent subscriptions

    Example: ConsentSubscriptionResponseAuthenticated AUTHENTICATED shopper's available consent subscriptions

    {
      "data": [
        {
          "subscriptionId": "weekly-newsletter",
          "channels": [
            "email",
            "whatsapp"
          ],
          "title": "Weekly Newsletter",
          "subtitle": "Get our weekly newsletter with the latest updates. <a href=\"https://example.com/newsletter\">Learn more</a>",
          "consentType": "marketing",
          "consentRequired": false,
          "defaultStatus": "opt_out",
          "tags": [
            "homepage_banner",
            "user_profile"
          ]
        },
        {
          "subscriptionId": "promotional-offers",
          "channels": [
            "sms"
          ],
          "title": "Promotional Offers",
          "subtitle": "Receive special promotional offers. <a href=\"https://example.com/offers\">View terms</a>",
          "consentType": "marketing",
          "consentRequired": false,
          "defaultStatus": "opt_out",
          "tags": [
            "checkout"
          ]
        }
      ]
    }

    Example: ConsentSubscriptionResponseAuthenticatedExpanded AUTHENTICATED shopper's consent subscriptions with expand=["consentStatus"]

    {
      "data": [
        {
          "subscriptionId": "weekly-newsletter",
          "channels": [
            "email",
            "whatsapp"
          ],
          "consentStatus": [
            {
              "channel": "email",
              "contactPointValue": "customer@example.com",
              "status": "opt_in"
            },
            {
              "channel": "whatsapp",
              "contactPointValue": "+1 555 123 4567",
              "status": "opt_out"
            }
          ],
          "title": "Weekly Newsletter",
          "subtitle": "Get our weekly newsletter with the latest updates. <a href=\"https://example.com/newsletter\">Learn more</a>",
          "consentType": "marketing",
          "consentRequired": false,
          "defaultStatus": "opt_out",
          "tags": [
            "homepage_banner",
            "user_profile"
          ]
        },
        {
          "subscriptionId": "promotional-offers",
          "channels": [
            "sms"
          ],
          "consentStatus": [
            {
              "channel": "sms",
              "contactPointValue": "+1 555 987 6543",
              "status": "opt_out"
            }
          ],
          "title": "Promotional Offers",
          "subtitle": "Receive special promotional offers. <a href=\"https://example.com/offers\">View terms</a>",
          "consentType": "marketing",
          "consentRequired": false,
          "defaultStatus": "opt_out",
          "tags": [
            "checkout",
            "user_profile"
          ]
        },
        {
          "subscriptionId": "privacy-policy-updates",
          "channels": [
            "email"
          ],
          "consentStatus": [
            {
              "channel": "email",
              "contactPointValue": "customer@example.com",
              "status": "opt_in"
            }
          ],
          "title": "Privacy Policy Updates",
          "subtitle": "Important updates to our privacy policy. <a href=\"https://example.com/privacy\">Read policy</a>",
          "consentType": "legal",
          "consentRequired": true,
          "defaultStatus": "opt_in",
          "tags": [
            "registration"
          ]
        }
      ]
    }

    Example: ConsentSubscriptionResponseGuest GUEST shopper's available consent subscriptions

  • 400 Error retrieving subscription preferences

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: ConsentSubscriptionError

    {
      "title": "Error Retrieving Consent Subscription",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/bad-request",
      "detail": "Error retrieving consent subscription."
    }