Get Consents
GET https://api.firmly.work/api/v2/domains/{domain}/cart/consents
Overview
Retrieves the current consent settings for a buyer’s cart session. This endpoint returns all available consent options along with their current status, including whether they have been signed by the buyer.
How Consent Management Works
- Session-Based: Consents are stored on the cart session and persist until checkout completion.
- Type-Based: Different consent types (marketing, terms, privacy) are supported.
- UI Placement: Each consent carries a
ui_slothint for placement in your checkout UI.
Authentication
x-firmly-authorization(string, required) — Device access token from Browser Session
Path Parameters
domain(string, required) — Domain of the merchant website (e.g.,staging.luma.gift)
Response
Returns a JSON array of consent objects (no top-level wrapper). Each item has the following fields:
-
id(string, required) — Unique identifier for the consent. -
ui_slot(string, required) — UI placement hint. One of:UNDER_EMAIL_INPUT— Display under the email fieldABOVE_PLACE_ORDER_BUTTON— Display above the place-order button
-
text(string, required) — Plain-text version of the consent (use for accessibility and as a fallback). -
html(string) — Optional HTML version with rich formatting and links. Render this when present; fall back totextotherwise. -
type(string, required) — Type of consent. One of:MARKETING— Marketing communicationsTERMS_AND_CONDITIONS— Terms of servicePRIVACY_POLICY— Privacy policyOTHER— Anything that does not fit the above
-
explicit(boolean, required) —truewhen the buyer must take an explicit action (e.g. tick a checkbox);falsewhen the consent is implicitly granted by completing checkout. -
required(boolean, required) — Whether this consent must be accepted for checkout to complete. -
revokable(boolean, required) — Whether the buyer can revoke this consent after signing. -
signed(boolean, required) — Whether this consent is considered signed. Computed server-side assigned = hasSignature OR (explicit === false AND required === true)— so implicit-required consents returnsigned: trueautomatically without the buyer having explicitly accepted them.
Code Examples
curl -X GET https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents \-H "x-firmly-authorization: YOUR_TOKEN"
const response = await fetch('https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents', {method: 'GET',headers: {'x-firmly-authorization': 'YOUR_TOKEN'}});const consents = await response.json();
import requestsresponse = requests.get('https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents',headers={'x-firmly-authorization': 'YOUR_TOKEN'})consents = response.json()
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents');curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-firmly-authorization: YOUR_TOKEN']);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$response = curl_exec($ch);$consents = json_decode($response, true);curl_close($ch);
Response Example
[{"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479","ui_slot": "UNDER_EMAIL_INPUT","text": "I would like to receive marketing emails about special offers and new products.","type": "MARKETING","explicit": true,"required": false,"revokable": true,"signed": false},{"id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8","ui_slot": "ABOVE_PLACE_ORDER_BUTTON","text": "I agree to the Terms of Service and Privacy Policy.","html": "I agree to the <a href='/terms'>Terms of Service</a> and <a href='/privacy'>Privacy Policy</a>.","type": "TERMS_AND_CONDITIONS","explicit": true,"required": true,"revokable": false,"signed": true}]
Default Consent States
If the merchant has not configured explicit consents but has set marketing_consent_text in their Firmly configuration, a single marketing consent is generated:
- It is optional (
required: false) and revokable (revokable: true) - No other consents are created by default
If the merchant has configured neither explicit consents nor marketing_consent_text, the endpoint returns an empty array.
Error Responses
Errors return a JSON body with code, error, and description. Program against the error value — descriptions are human-readable and may change.
400 — MissingAuthHeader
The x-firmly-authorization header is missing or empty.
{ "code": 400, "error": "MissingAuthHeader", "description": "x-firmly-authorization header is missing or invalid." }
400 — InvalidToken
The authorization token is not a valid JWT structure.
{ "code": 400, "error": "InvalidToken", "description": "Jwt token is invalid." }
400 — InvalidAPIToken
The API token (server-to-server secret) is invalid or has been revoked.
{ "code": 400, "error": "InvalidAPIToken", "description": "API token is invalid." }
400 — BadRequest
Server-to-server auth was attempted but required headers are missing or malformed.
{ "code": 400, "error": "BadRequest", "description": "Bad request." }
401 — Unauthorized
The authorization token was rejected.
{ "code": 401, "error": "Unauthorized", "description": "Unauthorized." }
401 — InvalidJWTToken
The device JWT signature does not verify, or required claims are missing.
{ "code": 401, "error": "InvalidJWTToken", "description": "Jwt token is invalid." }
404 — PartnerNotFound
The appid claim on the device JWT does not map to a known partner / tenant.
{ "code": 404, "error": "PartnerNotFound", "description": "Partner not found." }
404 — DomainNotFound
The {domain} path parameter does not match any merchant configured with Firmly, or the merchant has been disabled.
{ "code": 404, "error": "DomainNotFound", "description": "This domain was not found in firmly servers." }
404 — CartNotFound
No cart exists for this device on this domain. Add an item first via Add Line Item.
{ "code": 404, "error": "CartNotFound", "description": "Cart was not found." }
412 — OperationNotSupported
The merchant’s platform does not support this operation.
{ "code": 412, "error": "OperationNotSupported", "description": "This operation is not supported for this store." }