curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.example.com/api/cart-attribution' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"conversionId": "string",
"sessionId": "string",
"action": "add_to_cart",
"threadId": "string",
"cartToken": "YOUR_API_KEY",
"productId": "string",
"productTitle": "string",
"variantId": "string",
"source": "response-chat-widget",
"landingPage": "string",
"referrer": "string",
"occurredAt": "2026-08-31T14:22:05Z",
"orgId": "string",
"agentId": "string"
}'
{
"ok": true,
"duplicate": true,
"eventId": "string"
}
Record a Shopify cart receipt attributed to a chat conversion
Writes a cart_attribution_confirmed widget analytics event keyed by cart_attribution:<conversionId>:<action>:<variantId|productId|cartToken|cart> so retries…
POST
/
api
/
cart-attribution
curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.example.com/api/cart-attribution' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"conversionId": "string",
"sessionId": "string",
"action": "add_to_cart",
"threadId": "string",
"cartToken": "YOUR_API_KEY",
"productId": "string",
"productTitle": "string",
"variantId": "string",
"source": "response-chat-widget",
"landingPage": "string",
"referrer": "string",
"occurredAt": "2026-08-31T14:22:05Z",
"orgId": "string",
"agentId": "string"
}'
{
"ok": true,
"duplicate": true,
"eventId": "string"
}
Writes a
cart_attribution_confirmed widget analytics event keyed by
cart_attribution:<conversionId>:<action>:<variantId|productId|cartToken|cart> so
retries are idempotent (duplicate: true).
Widget identity is verified when signing is configured; tokenless compatibility does not establish tenant ownership. See the authentication and recovery guide for credential and retry rules.
Request body
CartAttributionReceipt
Response
object
Status codes
| Code | Meaning |
|---|---|
200 | Receipt stored (or already stored) |
400 | Missing conversionId, sessionId, action or org id |
401 | Widget token missing, malformed, expired, from the future, or badly signed |
403 | Request org/agent disagrees with the widget token claims |
429 | Too many requests for this IP (scoped by verified org/agent) |
500 | Unhandled error |
502 | Analytics store unavailable or rejected the write |
Using this contract
Read the source OpenAPI document for declared schemas and alternatives. This page also includes documented corrections from the spec overlays. Example IDs and values are illustrative; replace them with records from your workspace.curl --silent --show-error --fail-with-body --request POST \
--url 'https://api.example.com/api/cart-attribution' \
--header 'x-widget-token: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"conversionId": "string",
"sessionId": "string",
"action": "add_to_cart",
"threadId": "string",
"cartToken": "YOUR_API_KEY",
"productId": "string",
"productTitle": "string",
"variantId": "string",
"source": "response-chat-widget",
"landingPage": "string",
"referrer": "string",
"occurredAt": "2026-08-31T14:22:05Z",
"orgId": "string",
"agentId": "string"
}'
{
"ok": true,
"duplicate": true,
"eventId": "string"
}
Last modified on November 13, 2026