API reference
The CXS Loyalty REST API (v1) answers in JSON under /public/v1. This page covers the conventions every endpoint shares, then lists each endpoint with the scope it needs.
In short
- Base URL:
https://loyalty-program.cxsnippets.com/public/v1. SendAuthorization: Bearer cxl_at_…on every call. - Each token can make 10 requests a second. Lists use cursor pagination.
- The full OpenAPI 3.1 spec is at
GET /public/v1/openapi.json.
Before you start#
- A private client with the scopes your calls need, created under Settings → Developers.
- An access token from
/oauth/token. See API clients & authentication. - A quick check that the token works:
GET /public/v1/me.
Basics#
| Item | Value |
|---|---|
| Base URL | https://loyalty-program.cxsnippets.com/public/v1 |
| Authentication | Authorization: Bearer cxl_at_… (see API clients & authentication) |
| Store | Decided by the token; no endpoint takes a shop parameter |
| Request bodies | JSON objects (Content-Type: application/json) |
| Customer IDs | The Shopify customer ID, or its GID (URL-encoded) |
| OpenAPI 3.1 spec | GET /public/v1/openapi.json (no token needed) |
Import openapi.json into Postman or Insomnia to get every endpoint, schema and the token setup in one go. It also describes the webhook payloads.
Rate limits#
- Each token can make 10 requests a second.
- Every answer carries
RateLimit-Limit,RateLimit-Remaining,RateLimit-ResetandRateLimit-Policyheaders. - Over the limit you get
429 rate_limitedwith aRetry-Afterheader in seconds.
Pagination#
Lists are newest first and use cursors.
- Pass
limit(1 to 250, default 50). - For the next page, pass
cursorset to the previous answer’snext_cursor.
{
"data": [ … ],
"has_more": true,
"next_cursor": "djE6MTIzNDU"
}
Idempotency#
Every POST and DELETE accepts an optional Idempotency-Key header (up to 255 printable ASCII characters). A retry with the same key and body within 24 hours doesn’t run again. It gets the first successful answer, with Idempotent-Replayed: true.
- The same key with a different body:
422 idempotency_key_reused. - The same key while the first request is still running:
409 idempotency_key_in_use. - A refused or failed request frees the key.
Errors#
Errors are { "error": code, "message": text }, plus details per field on validation_failed. Rely on error. The message is for people and may change.
| Status | Codes |
|---|---|
| 400 | invalid_parameter, invalid_cursor, invalid_json, invalid_idempotency_key |
| 401 | unauthorized (no token), invalid_token (unknown, expired or revoked) |
| 403 | insufficient_scope |
| 404 | not_found (no endpoint at this path), customer_not_found, webhook_not_found |
| 405 | method_not_allowed (see the Allow header) |
| 409 | idempotency_key_in_use |
| 422 | validation_failed, insufficient_points, idempotency_key_reused, webhook_limit_reached, and redemption refusals |
| 429 | rate_limited |
| 500 / 502 | internal_error, shopify_unavailable |
{
"error": "validation_failed",
"message": "The request body is invalid",
"details": { "points": "must be a whole number, not 0, from -1000000 to 1000000" }
}
Endpoints#
Paths are relative to /public/v1. Where two scopes are listed, either one is enough.
Connection#
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /me |
Any token | The store, the client, the token’s scopes and token_expires_at. Use it as a connection test. |
Customers and points#
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /customers |
read:customers |
Customers in the program. Filter with email (exact, case-insensitive). Paginated. |
| POST | /customers |
write:customers |
Enrol a Shopify customer by id, else email. 201 when enrolled now, 200 when already in the program, 404 when no Shopify customer matches. |
| GET | /customers/{id} |
read:customers |
One customer: status, balances, VIP tier, referral code, birthday. |
| GET | /customers/{id}/points |
read:points |
Point balance, pending points, points owed, lifetime points and the next release date. |
| POST | /customers/{id}/points-adjustments |
write:points |
Add (positive points) or remove (negative) points, with an optional reason. |
| GET | /customers/{id}/activities |
read:activities |
A customer’s point history. Filters: type, since. Paginated. |
| GET | /activities |
read:activities |
Every customer’s activity. Use since and type to poll for new rows. Paginated. |
Rewards and redemptions#
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /rewards |
read:rewards |
Active rewards on every channel and for every audience. |
| GET | /customers/{id}/rewards |
read:rewards |
The rewards this customer sees online, each available or with an unavailable_reason. |
| GET | /customers/{id}/redemptions |
read:rewards or write:redemptions |
A customer’s redemptions, with codes. Paginated. |
| POST | /customers/{id}/redemptions |
write:redemptions |
Spend the customer’s points on a reward (reward_id, plus points for a variable reward). |
VIP tiers and referrals#
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /vip-tiers |
read:tiers |
Active tiers, lowest first, with the basis and period. enabled is false and data empty while VIP tiers are off. |
| GET | /customers/{id}/tier |
read:tiers |
Current tier, next tier, amount to the next tier, progress percent and any downgrade date. |
| GET | /customers/{id}/referrals |
read:referrals |
The customer’s referral code, link and stats, plus a page of the friends they referred. |
Webhook subscriptions#
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /webhooks |
manage:webhooks |
The endpoints this client created (not those added in the app). |
| POST | /webhooks |
manage:webhooks |
Subscribe a URL to topics (or one topic). The answer holds the signing secret, shown only here. |
| DELETE | /webhooks/{id} |
manage:webhooks |
Delete one of this client’s endpoints and its delivery log. |
| POST | /webhooks/{id}/test |
manage:webhooks |
Queue a test message for topic (the endpoint’s first topic by default). Answers 202. |
See Webhooks for topics, payloads and signatures.
Examples#
Find a customer by email#
curl "https://loyalty-program.cxsnippets.com/public/v1/customers?email=customer%40example.com" \
-H "Authorization: Bearer $TOKEN"
{
"data": [
{
"id": "7208143519852",
"email": "customer@example.com",
"name": "Sam Sample",
"status": "member",
"points": 1250,
"pending_points": 100,
"points_owed": 0,
"lifetime_points": 3400,
"vip_tier": { "id": "tier_gold", "name": "Gold" },
"referral_code": "SAM123",
"birthday": "04-17",
"b2b": false,
"created_at": "2026-01-12T09:30:00.000Z",
"updated_at": "2026-11-06T10:00:00.000Z"
}
],
"has_more": false,
"next_cursor": null
}
status is member (has a store account), guest (no account), excluded (left out of the program) or blocked (under fraud review).
Add points#
curl -X POST "https://loyalty-program.cxsnippets.com/public/v1/customers/7208143519852/points-adjustments" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: survey-2026-11-13-7208143519852" \
-d '{ "points": 50, "reason": "Completed our survey" }'
{
"customer_id": "7208143519852",
"points_change": 50,
"reason": "Completed our survey",
"points": 1300
}
pointscan be from -1,000,000 to 1,000,000 (not 0).reasoncan be up to 200 characters.- Removing more than the balance answers
422 insufficient_points. - The customer gets the same adjustment email as when you adjust points in the app.
Redeem a reward#
curl -X POST "https://loyalty-program.cxsnippets.com/public/v1/customers/7208143519852/redemptions" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "reward_id": 7 }'
{
"redemption": {
"id": 501,
"customer_id": "7208143519852",
"reward_id": 7,
"title": "$5 off",
"points_spent": 500,
"code": "LOYALTY-5OFF-AB12",
"discount_type": "fixed_amount",
"discount_value": 5,
"status": "active",
"expires_at": null,
"created_at": "2026-11-06T10:00:00.000Z"
},
"points": 800
}
Redeeming works as it does on the customer account page:
- Discount codes aren’t tied to a cart.
- Gift cards and store credit are issued at once.
- Refusals keep the reward’s own code, such as
insufficient_points,tier_required,account_under_review,points_owed,reward_unavailableorin_store_only.
Poll for new activity#
curl "https://loyalty-program.cxsnippets.com/public/v1/activities?type=earn,redeem&since=2026-11-01T00:00:00Z&limit=100" \
-H "Authorization: Bearer $TOKEN"
Each activity has:
- A signed
pointsvalue (below 0 for points taken). - A
typesuch asearn,redeem,adjustment,referral,refund,expiryorcashback. - A
statusofavailable,pendingorreversed. - A
sourceofonlineorpos.
The type filter takes up to 10 comma-separated values. For real-time updates, use webhooks instead of polling.