{"openapi":"3.1.0","info":{"title":"Loyalty Program API","version":"1.0.0","description":"The loyalty program's public API. Every request sends an OAuth access token (`Authorization: Bearer cxl_at_…`); the token decides the store. Third-party apps use the authorization code grant with PKCE; a store's own systems use a private client (Settings → Developers) with client credentials. Access tokens last an hour. Requests are limited to 10 a second per token (`RateLimit-*` headers). Lists are newest first with cursor pagination. Errors are `{ error, message }`. The store needs the Advanced plan."},"servers":[{"url":"https://loyalty-program.cxsnippets.com/public/v1"}],"security":[{"privateClient":[]},{"thirdPartyApp":[]}],"paths":{"/me":{"get":{"operationId":"getMe","summary":"Who am I","description":"The store, its plan, the client and the scopes this token holds. Zapier and Make use it as the connection test.\n\nAny token.","x-required-scopes":[],"responses":{"200":{"description":"The connection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers":{"get":{"operationId":"listCustomers","summary":"List customers","description":"Customers in the program, newest first. Filter by `email` (exact, case-insensitive) to find one.\n\nNeeds the `read:customers` scope.","x-required-scopes":["read:customers"],"parameters":[{"name":"email","in":"query","schema":{"type":"string","format":"email"}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of customers","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last one."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"enrolCustomer","summary":"Enrol a customer","description":"Adds a Shopify customer to the program, found by `id`, else by `email`. Answers 200 with the customer when they are already in the program, 201 when enrolled now, 404 when no Shopify customer matches.\n\nNeeds the `write:customers` scope.","x-required-scopes":["write:customers"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Shopify customer id or GID."},"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Already in the program","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"201":{"description":"Enrolled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}":{"get":{"operationId":"getCustomer","summary":"Get a customer","description":"Needs the `read:customers` scope.","x-required-scopes":["read:customers"],"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"responses":{"200":{"description":"The customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/points":{"get":{"operationId":"getCustomerPoints","summary":"Get a point balance","description":"Needs the `read:points` scope.","x-required-scopes":["read:points"],"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"responses":{"200":{"description":"The balance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PointsBalance"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/points-adjustments":{"post":{"operationId":"adjustCustomerPoints","summary":"Add or remove points","description":"Positive `points` adds, negative removes; removing more than the balance answers 422 `insufficient_points`. The customer gets the adjustment email as from the admin, and the activity notes the API client.\n\nNeeds the `write:points` scope.","x-required-scopes":["write:points"],"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["points"],"properties":{"points":{"type":"integer","minimum":-1000000,"maximum":1000000,"not":{"const":0}},"reason":{"type":"string","maxLength":200}}}}}},"responses":{"201":{"description":"Adjusted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PointsAdjustment"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/activities":{"get":{"operationId":"listCustomerActivities","summary":"List a customer's activity","description":"Needs the `read:activities` scope.","x-required-scopes":["read:activities"],"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/ActivityType"},{"$ref":"#/components/parameters/Since"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of activity","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last one."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/activities":{"get":{"operationId":"listActivities","summary":"List activity","description":"Every customer's activity, newest first. Use `since` and `type` to poll for new rows.\n\nNeeds the `read:activities` scope.","x-required-scopes":["read:activities"],"parameters":[{"$ref":"#/components/parameters/ActivityType"},{"$ref":"#/components/parameters/Since"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of activity","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last one."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/rewards":{"get":{"operationId":"listRewards","summary":"List rewards","description":"Active rewards the store's plan offers, on every channel and for every audience.\n\nNeeds the `read:rewards` scope.","x-required-scopes":["read:rewards"],"responses":{"200":{"description":"The rewards","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Reward"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/rewards":{"get":{"operationId":"listCustomerRewards","summary":"List a customer's rewards","description":"The rewards this customer sees online, for their audience and tier, each `available` or with the reason it isn't. Empty for a customer excluded from the program.\n\nNeeds the `read:rewards` scope.","x-required-scopes":["read:rewards"],"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"responses":{"200":{"description":"The rewards","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomerReward"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/redemptions":{"get":{"operationId":"listCustomerRedemptions","summary":"List a customer's redemptions","description":"Needs the `read:rewards` or `write:redemptions` scope.","x-required-scopes":["read:rewards","write:redemptions"],"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of redemptions","content":{"application/json":{"schema":{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Redemption"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last one."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"redeemCustomerReward","summary":"Redeem a reward","description":"Spends the customer's points on a reward, as the customer account page does: discount codes are not tied to a cart, gift cards and store credit are issued at once. A variable reward takes `points`. Refusals keep the reward's own code (`insufficient_points`, `tier_required`, `account_under_review`, `points_owed`, `reward_unavailable`, `in_store_only`…).\n\nNeeds the `write:redemptions` scope.","x-required-scopes":["write:redemptions"],"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reward_id"],"properties":{"reward_id":{"type":"integer"},"points":{"type":"integer","minimum":1}}}}}},"responses":{"201":{"description":"Redeemed","content":{"application/json":{"schema":{"type":"object","properties":{"redemption":{"$ref":"#/components/schemas/Redemption"},"points":{"type":"integer","description":"Balance after."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/vip-tiers":{"get":{"operationId":"listVipTiers","summary":"List VIP tiers","description":"Active tiers, lowest first. `enabled` is false (and `data` empty) while VIP tiers are off or not on the plan.\n\nNeeds the `read:tiers` scope.","x-required-scopes":["read:tiers"],"responses":{"200":{"description":"The tiers","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"basis":{"type":"string","enum":["points","spend","orders"]},"period":{"type":"string"},"data":{"type":"array","items":{"$ref":"#/components/schemas/VipTier"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/tier":{"get":{"operationId":"getCustomerTier","summary":"Get a customer's tier progress","description":"Needs the `read:tiers` scope.","x-required-scopes":["read:tiers"],"parameters":[{"$ref":"#/components/parameters/CustomerId"}],"responses":{"200":{"description":"The progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TierProgress"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}/referrals":{"get":{"operationId":"listCustomerReferrals","summary":"List a customer's referrals","description":"The customer's referral link and stats, and a page of the friends they referred.\n\nNeeds the `read:referrals` scope.","x-required-scopes":["read:referrals"],"parameters":[{"$ref":"#/components/parameters/CustomerId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"The referrals","content":{"application/json":{"schema":{"allOf":[{"type":"object","required":["data","has_more","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Referral"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last one."}}},{"type":"object","properties":{"customer_id":{"type":"string"},"referral_code":{"type":["string","null"]},"referral_link":{"type":["string","null"]},"stats":{"type":"object","properties":{"total":{"type":"integer"},"pending":{"type":"integer"},"completed":{"type":"integer"}}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook endpoints","description":"The endpoints this client created. Endpoints made in the store's admin aren't listed.\n\nNeeds the `manage:webhooks` scope.","x-required-scopes":["manage:webhooks"],"responses":{"200":{"description":"The endpoints","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createWebhook","summary":"Subscribe to webhooks","description":"Creates an endpoint that gets the listed topics (`topic` for one, as Zapier's REST hooks send it). The URL must be HTTPS on a public address. The answer holds the signing `secret`, shown only here.\n\nNeeds the `manage:webhooks` scope.","x-required-scopes":["manage:webhooks"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","maxLength":2048},"topics":{"type":"array","items":{"type":"string","enum":["customer.enrolled","points.earned","points.adjusted","points.redeemed","redemption.cancelled","points.expiring","points.expired","tier.changed","referral.completed"]},"minItems":1},"topic":{"type":"string","enum":["customer.enrolled","points.earned","points.adjusted","points.redeemed","redemption.cancelled","points.expiring","points.expired","tier.changed","referral.completed"]},"description":{"type":"string","maxLength":200}}}}}},"responses":{"201":{"description":"Subscribed","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","example":"whsec_…"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","summary":"Unsubscribe","description":"Deletes one of this client's endpoints and its delivery log.\n\nNeeds the `manage:webhooks` scope.","x-required-scopes":["manage:webhooks"],"parameters":[{"$ref":"#/components/parameters/WebhookId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"const":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/WebhookNotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/webhooks/{id}/test":{"post":{"operationId":"testWebhook","summary":"Send a test webhook","description":"Sends sample data for `topic` (the endpoint's first topic by default) with `test: true` in the body, signed like any message, even while the endpoint is off.\n\nNeeds the `manage:webhooks` scope.","x-required-scopes":["manage:webhooks"],"parameters":[{"$ref":"#/components/parameters/WebhookId"},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string","enum":["customer.enrolled","points.earned","points.adjusted","points.redeemed","redemption.cancelled","points.expiring","points.expired","tier.changed","referral.completed"]}}}}}},"responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"delivery_id":{"type":"integer"},"status":{"const":"queued"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/WebhookNotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"webhooks":{"customer.enrolled":{"post":{"summary":"customer.enrolled","description":"A customer joined the program (their loyalty record was created).\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"customer.enrolled"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":["string","null"]},"name":{"type":["string","null"]},"referral_code":{"type":["string","null"]},"referred_by":{"type":["string","null"],"description":"The referrer's referral code."},"created_at":{"type":"string","format":"date-time"}}}}},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"points.earned":{"post":{"summary":"points.earned","description":"Points became spendable: from an order, a way to earn, a campaign bonus, a reward or a referral. Points held as pending are sent when released. Past-order imports send nothing.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"points.earned"},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/ActivityEvent"},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"points.adjusted":{"post":{"summary":"points.adjusted","description":"Points added or removed by hand: the admin, this API, Shopify Flow, a CSV upload or a reversed review reward.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"points.adjusted"},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/ActivityEvent"},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"points.redeemed":{"post":{"summary":"points.redeemed","description":"Points spent on a reward.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"points.redeemed"},"timestamp":{"type":"string","format":"date-time"},"data":{"allOf":[{"$ref":"#/components/schemas/ActivityEvent"},{"type":"object","properties":{"redemption":{"$ref":"#/components/schemas/Redemption"}}}]},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"redemption.cancelled":{"post":{"summary":"redemption.cancelled","description":"A redemption cancelled or deleted in the admin; its points go back to the customer.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"redemption.cancelled"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/CustomerBalance"},"redemption":{"$ref":"#/components/schemas/Redemption"},"points_refunded":{"type":"integer"},"reason":{"type":"string","enum":["cancelled","deleted"]}}},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"points.expiring":{"post":{"summary":"points.expiring","description":"A reminder that points expire soon: the first warning, then the last chance.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"points.expiring"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/CustomerBalance"},"points":{"type":"integer"},"expires_at":{"type":"string","format":"date-time"},"reminder":{"type":"string","enum":["warning","last_chance"]}}},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"points.expired":{"post":{"summary":"points.expired","description":"Points expired.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"points.expired"},"timestamp":{"type":"string","format":"date-time"},"data":{"$ref":"#/components/schemas/ActivityEvent"},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"tier.changed":{"post":{"summary":"tier.changed","description":"A customer moved to another VIP tier, or out of every tier (`to` null).\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"tier.changed"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/CustomerBalance"},"from":{"$ref":"#/components/schemas/TierRef"},"to":{"$ref":"#/components/schemas/TierRef"},"direction":{"type":"string","enum":["up","down"]},"pinned":{"type":"boolean","description":"Set by Shopify Flow or a CSV upload rather than earned."}}},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}},"referral.completed":{"post":{"summary":"referral.completed","description":"A referral completed: the friend placed a qualifying order, or signed up when rewards pay at signup.\n\nSigned per [Standard Webhooks](https://www.standardwebhooks.com). Answer 2xx; anything else is retried (10 attempts over about 3 days). 410 deletes a subscription made through this API (an endpoint made in the store's admin is turned off); 429 `Retry-After` is honoured.","parameters":[{"name":"webhook-id","in":"header","required":true,"description":"The message id; the same on every retry and replay.","schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"description":"Unix seconds when this attempt was sent.","schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"description":"Space-separated `v1,<base64 HMAC-SHA256 of \"id.timestamp.body\">`, keyed with the base64 part of the `whsec_` secret. During the 24 hours after a rotation, the old secret signs too.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","timestamp","data"],"properties":{"type":{"const":"referral.completed"},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"referral":{"type":"object","properties":{"id":{"type":"integer"},"referrer_customer_id":{"type":"string"},"referred_customer_id":{"type":["string","null"]},"referred_email":{"type":["string","null"]},"order_id":{"type":["string","null"]},"completed_at":{"type":"string","format":"date-time"}}}}},"test":{"type":"boolean","description":"Present and true on a test message."}}}}}},"responses":{"2XX":{"description":"Received."}}}}},"components":{"schemas":{"Error":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string","description":"A stable code, e.g. `customer_not_found`, `insufficient_points`."},"message":{"type":"string","description":"English text for people; may change."},"details":{"type":"object","additionalProperties":{"type":"string"},"description":"Per field, on `validation_failed`."}}},"Me":{"type":"object","properties":{"shop":{"type":"object","properties":{"domain":{"type":"string","example":"my-store.myshopify.com"}}},"plan":{"type":"object","properties":{"id":{"type":"string","example":"advanced"},"name":{"type":"string"}}},"client":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["private","third_party"]}}},"scopes":{"type":"array","items":{"type":"string","enum":["read:customers","write:customers","read:points","write:points","read:activities","read:rewards","write:redemptions","read:tiers","read:referrals","manage:webhooks"]}},"token_expires_at":{"type":"string","format":"date-time"}}},"Customer":{"type":"object","properties":{"id":{"type":"string","description":"The Shopify customer id.","example":"7208143519852"},"email":{"type":["string","null"]},"name":{"type":["string","null"]},"status":{"type":"string","enum":["member","guest","excluded","blocked"],"description":"member: has a store account; guest: none; excluded: left out of the program; blocked: under fraud review."},"points":{"type":"integer","description":"Spendable balance."},"pending_points":{"type":"integer","description":"Earned but not yet spendable."},"points_owed":{"type":"integer","description":"Owed after a refund took more than the balance; redeeming is blocked until repaid."},"lifetime_points":{"type":"integer"},"vip_tier":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"referral_code":{"type":["string","null"]},"birthday":{"type":["string","null"],"description":"MM-DD","example":"04-17"},"b2b":{"type":"boolean","description":"Seen buying for a company."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PointsBalance":{"type":"object","properties":{"customer_id":{"type":"string"},"points":{"type":"integer"},"pending_points":{"type":"integer"},"points_owed":{"type":"integer"},"lifetime_points":{"type":"integer"},"next_release_at":{"type":["string","null"],"format":"date-time","description":"When the next pending points become spendable, if dated."},"awaiting_renewal_points":{"type":"integer","description":"Pending until the customer's next subscription order."}}},"PointsAdjustment":{"type":"object","properties":{"customer_id":{"type":"string"},"points_change":{"type":"integer"},"reason":{"type":["string","null"]},"points":{"type":"integer","description":"The balance after the change."}}},"Activity":{"type":"object","properties":{"id":{"type":"integer"},"customer_id":{"type":"string"},"type":{"type":"string","description":"earn, redeem, adjustment, referral, refund, expiry, cashback…","example":"earn"},"status":{"type":"string","enum":["available","pending","reversed"]},"points":{"type":"integer","description":"Signed: below 0 for points taken."},"points_reversed":{"type":"integer"},"credits":{"type":"number"},"credits_currency":{"type":["string","null"]},"description":{"type":"string"},"source":{"type":"string","enum":["online","pos"]},"order_id":{"type":["string","null"]},"earn_rule_id":{"type":["integer","null"]},"redeem_rule_id":{"type":["integer","null"]},"bonus_campaign_id":{"type":["integer","null"]},"reward_kind":{"type":["string","null"],"description":"challenge, streak or badge payouts."},"release_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"VariableAmount":{"type":["object","null"],"description":"Set when the customer picks how many points to spend.","properties":{"min_points":{"type":"integer"},"max_points":{"type":["integer","null"]},"points_step":{"type":["integer","null"]}}},"Reward":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string","example":"discount"},"points_cost":{"type":"integer","description":"For a variable reward, the least points it takes."},"discount_type":{"type":["string","null"]},"discount_value":{"type":["number","null"]},"minimum_purchase":{"type":"number"},"credit_amount":{"type":["number","null"]},"expiry_days":{"type":["integer","null"]},"variable":{"$ref":"#/components/schemas/VariableAmount"},"channel":{"type":"string","enum":["online","pos","both"]},"audience":{"type":"string","enum":["all","retail","b2b"]},"vip_tier_ids":{"type":"array","items":{"type":"string"},"description":"Empty: every customer."}}},"CustomerReward":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"},"points_cost":{"type":"integer"},"discount_type":{"type":["string","null"]},"discount_value":{"type":["number","null"]},"minimum_purchase":{"type":"number"},"variable":{"$ref":"#/components/schemas/VariableAmount"},"vip_tier_ids":{"type":"array","items":{"type":"string"}},"available":{"type":"boolean"},"unavailable_reason":{"type":["string","null"],"enum":["account_under_review","points_owed","tier_required","insufficient_points",null]}}},"Redemption":{"type":"object","properties":{"id":{"type":"integer"},"customer_id":{"type":"string"},"reward_id":{"type":["integer","null"]},"title":{"type":["string","null"]},"points_spent":{"type":"integer"},"code":{"type":["string","null"],"description":"The discount code or gift card code."},"discount_type":{"type":["string","null"]},"discount_value":{"type":["number","null"]},"status":{"type":"string","example":"active"},"source":{"type":"string"},"order_number":{"type":["string","null"]},"used_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"VipTier":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"threshold":{"type":"number","description":"In the tiers' basis unit."},"multiplier":{"type":"number"},"audience":{"type":"string","enum":["all","retail","b2b"]},"entry_reward_points":{"type":"integer"}}},"TierProgress":{"type":"object","properties":{"customer_id":{"type":"string"},"enabled":{"type":"boolean"},"basis":{"type":"string","enum":["points","spend","orders"]},"period":{"type":"string","enum":["lifetime","rolling_12_months","calendar_year"]},"current_tier":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"threshold":{"type":"number"},"multiplier":{"type":"number"}}},"next_tier":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"threshold":{"type":"number"}}},"amount_to_next_tier":{"type":["number","null"]},"progress_value":{"type":["number","null"]},"progress_percent":{"type":["integer","null"]},"downgrade_at":{"type":["string","null"],"format":"date-time","description":"End of the grace period when a move down is due."}}},"Referral":{"type":"object","properties":{"id":{"type":"integer"},"status":{"type":"string","enum":["pending","completed","reversed"]},"referred_email":{"type":"string"},"referred_customer_id":{"type":["string","null"]},"referrer_points":{"type":["integer","null"]},"referred_points":{"type":["integer","null"]},"completed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"topics":{"type":"array","items":{"type":"string","enum":["customer.enrolled","points.earned","points.adjusted","points.redeemed","redemption.cancelled","points.expiring","points.expired","tier.changed","referral.completed"]}},"status":{"type":"string","enum":["active","disabled"]},"disabled_reason":{"type":["string","null"],"enum":["manual","gone","failing","access_revoked",null],"description":"gone: the URL answered 410; failing: every delivery failed for 5 days; access_revoked: the app that created it lost access."},"failing_since":{"type":["string","null"],"format":"date-time","description":"The first failure since the last success."},"last_success_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"CustomerBalance":{"type":"object","description":"The customer's balance right after the event.","properties":{"id":{"type":"string"},"email":{"type":["string","null"]},"points":{"type":"integer"},"pending_points":{"type":"integer"},"points_owed":{"type":"integer"},"lifetime_points":{"type":"integer"}}},"TierRef":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"threshold":{"type":"number"}}},"ActivityEvent":{"allOf":[{"$ref":"#/components/schemas/Activity"},{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/CustomerBalance"}}}]}},"parameters":{"CustomerId":{"name":"id","in":"path","required":true,"description":"The Shopify customer id, or its GID (URL-encoded).","schema":{"type":"string"}},"Limit":{"name":"limit","in":"query","description":"Rows per page, 1 to 250 (default 50).","schema":{"type":"integer","minimum":1,"maximum":250,"default":50}},"Cursor":{"name":"cursor","in":"query","description":"`next_cursor` from the previous page. Lists are newest first.","schema":{"type":"string"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","description":"Optional, up to 255 printable characters. A retry with the same key and body within 24 hours gets the first successful answer (header `Idempotent-Replayed: true`) instead of running again. The same key with another body answers 422 `idempotency_key_reused`; while the first request runs, 409 `idempotency_key_in_use`. A refused or failed request frees the key.","schema":{"type":"string","maxLength":255}},"ActivityType":{"name":"type","in":"query","description":"Comma-separated activity types, e.g. `earn,redeem`.","schema":{"type":"string"}},"WebhookId":{"name":"id","in":"path","required":true,"description":"The webhook endpoint's id.","schema":{"type":"string"}},"Since":{"name":"since","in":"query","description":"Only activity recorded at or after this ISO 8601 date-time.","schema":{"type":"string","format":"date-time"}}},"responses":{"Unauthorized":{"description":"`unauthorized` (no token) or `invalid_token` (unknown, expired or revoked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"`insufficient_scope`, or `plan_required` when the store's plan no longer includes the API.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"`customer_not_found`: no customer in the program has this id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"WebhookNotFound":{"description":"`webhook_not_found`: this client has no webhook endpoint with this id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadRequest":{"description":"`invalid_parameter`, `invalid_cursor` or `invalid_json`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationFailed":{"description":"`validation_failed` with `details` per field, or a refusal such as `insufficient_points`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"More than 10 requests in a second on this token. Wait `Retry-After` seconds.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"securitySchemes":{"privateClient":{"type":"oauth2","description":"A private client from Settings → Developers, for the store's own systems. Send no scope to get every permission the client has (asking for one it lacks is refused).","flows":{"clientCredentials":{"tokenUrl":"https://loyalty-program.cxsnippets.com/oauth/token","scopes":{}}}},"thirdPartyApp":{"type":"oauth2","description":"A registered app (Zapier, Make, agencies): authorization code with PKCE (S256), approved by a staff member in the Shopify admin. Add `shop=<store>.myshopify.com` to skip the store question.","flows":{"authorizationCode":{"authorizationUrl":"https://loyalty-program.cxsnippets.com/oauth/authorize","tokenUrl":"https://loyalty-program.cxsnippets.com/oauth/token","refreshUrl":"https://loyalty-program.cxsnippets.com/oauth/token","scopes":{"read:customers":"Read customers, their status, balance and tier","write:customers":"Enrol Shopify customers in the program","read:points":"Read point balances","write:points":"Add and remove points","read:activities":"Read point history","read:rewards":"Read rewards and redemptions","write:redemptions":"Redeem rewards for customers","read:tiers":"Read VIP tiers and customers' progress","read:referrals":"Read referral links and referrals","manage:webhooks":"Manage webhook endpoints"}}}}}}}