All articles

DocsDevelopers

REST API

Create an API key, read a member's balance, add or remove points with an idempotency key, list and redeem rewards, within 120 requests a minute.

The Thrice REST API lets your own systems read a member's points, add or remove points, list your rewards and redeem a reward for a member. Use it from a server, for example a helpdesk integration, a POS add-on or a back-office script.

Base URL

https://app.thriceloyalty.com/api/v1

Every request and response body is JSON. Responses carry Cache-Control: no-store.

API keys

Keys belong to one store and can do everything the API allows for that store.

  1. Open Developers.
  2. Under API keys, enter a Key name (up to 60 characters, for example "Helpdesk") and choose Create key.
  3. Copy the key from the banner. It starts with thr_live_ and is shown only once. Thrice stores only a hash of it.

The key list shows each key's name, its first characters, when it was created and when it was last used (updated at most once a minute). To stop a key, choose Revoke. Anything that uses it stops working right away, and a revoked key can't be turned back on. There is no limit on the number of keys, so give each integration its own.

Keys stop working if Thrice is uninstalled from the store.

Warning: A key is a password for your store's loyalty data. Keep it on your server. Never put it in theme code, custom blocks or anything that runs in a browser.

Authentication

Send the key as a Bearer token in the Authorization header:

curl https://app.thriceloyalty.com/api/v1/rewards \
  -H "Authorization: Bearer thr_live_YOUR_KEY"

A missing, malformed, revoked or unknown key returns 401 with the code unauthorized.

Rate limit

Each key can make 120 requests per minute. The minute starts with the key's first request and resets 60 seconds later.

Once the key is accepted, every response includes these headers, errors included. 401 and 405 responses don't.

Header Meaning
X-RateLimit-Limit Requests allowed per minute (120)
X-RateLimit-Remaining Requests left in the current minute

Over the limit, the API returns 429 with the code rate_limited, the two headers above and Retry-After, the number of seconds until the minute resets.

Errors

Errors use an HTTP status of 400 or higher and this body:

{
  "error": {
    "code": "member_not_found",
    "message": "No loyalty member for this customer"
  }
}

Use code in your logic. The message is for people and can change.

Status Code When
400 invalid_json The body isn't a JSON object
400 invalid_customer_id The customer ID in the path isn't a Shopify customer ID
401 unauthorized The key is missing, malformed, revoked or unknown
404 member_not_found The customer isn't a loyalty member of this store
404 reward_not_found The reward doesn't exist or isn't active
405 method_not_allowed Wrong HTTP method for this path
409 idempotency_conflict The idempotency_key was already used for a different request
422 invalid_points points isn't a non-zero whole number between -1,000,000 and 1,000,000
422 invalid_reason reason isn't a string of up to 200 characters
422 invalid_idempotency_key idempotency_key is missing or invalid
422 insufficient_points The member doesn't have enough points
422 invalid_reward_id reward_id is missing
422 variant_required The reward lists several products and variant_id isn't one of them
422 tier_required The reward needs a higher VIP tier than the member has
422 member_blocked The member is blocked from the program
429 rate_limited Too many requests this minute
500 internal_error Something went wrong on our side
502 discount_rejected Shopify refused to create the discount code; the points were returned
502 discount_pending Shopify didn't confirm the discount code; the redemption is pending review

Customer IDs

Endpoints under /members take the member's Shopify customer ID, either as the number (7012345678901) or as the full ID (gid://shopify/Customer/7012345678901, URL-encoded). The customer must already be a loyalty member.

Get a member

GET /members/{customerId}

Returns the member's balance, VIP tier, referral code and their 20 most recent points entries, newest first.

curl https://app.thriceloyalty.com/api/v1/members/7012345678901 \
  -H "Authorization: Bearer thr_live_YOUR_KEY"
{
  "customer_id": "7012345678901",
  "email": "ana@example.com",
  "first_name": "Ana",
  "last_name": "Silva",
  "points_balance": 450,
  "tier": { "id": "cm3k9x2f80004qz0h7d1e5b2a", "name": "Gold" },
  "enrolled_at": "2026-09-14T10:22:31.000Z",
  "referral_code": "K7QD2MXP",
  "history": [
    {
      "id": "cm3m1a7c20019qz0hb4f8e6d1",
      "type": "EARN",
      "points": 200,
      "note": null,
      "order_id": "5809123456789",
      "created_at": "2026-11-02T15:04:10.000Z"
    },
    {
      "id": "cm3l7b2d4000kqz0h2c9a1f3e",
      "type": "REDEEM",
      "points": -500,
      "note": null,
      "order_id": null,
      "created_at": "2026-10-20T09:31:55.000Z"
    }
  ]
}
Field Notes
customer_id Shopify customer ID, as a string
email, first_name, last_name Can be null
points_balance Current balance
tier { "id", "name" }, or null when the member has no tier
history[].type EARN, REDEEM, EXPIRE, ADJUST, REFUND or IMPORT
history[].points Positive when points were added, negative when they were taken
history[].order_id Shopify order ID for order points, otherwise null

There is no paging: older history isn't available through the API.

Add or remove points

POST /members/{customerId}/points
Parameter Type Required Rules
points integer Yes Not zero, from -1,000,000 to 1,000,000. Negative removes points.
idempotency_key string Yes 1 to 100 characters: letters, digits, _, ., : or -
reason string No Up to 200 characters, shown in the points history
curl -X POST https://app.thriceloyalty.com/api/v1/members/7012345678901/points \
  -H "Authorization: Bearer thr_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points": 100, "reason": "Helpdesk goodwill", "idempotency_key": "ticket-4821"}'

Response 201:

{
  "entry": {
    "id": "cm3n4d8e6002aqz0h9e2b7c4f",
    "type": "ADJUST",
    "points": 100,
    "note": "API: Helpdesk goodwill",
    "created_at": "2026-11-23T11:12:40.000Z"
  },
  "points_balance": 550,
  "created": true
}
  • The entry is an adjustment. Its note is API: followed by your reason, or API adjustment without one.
  • Removing points can't take the balance below zero. If the member has fewer points than you remove, you get insufficient_points and nothing changes.
  • Adjustments don't count towards VIP tiers and don't reset the points-expiry clock. They are accepted for blocked members too.
  • A successful call sends the points.earned or points.spent webhook. See Webhooks.

Idempotency

The idempotency_key makes retries safe. Use one key per intended change, for example your ticket or order number.

  • Sending the same key again for the same customer and the same points changes nothing. It returns 200 with the original entry, "created": false and the member's current balance.
  • Sending a key that was already used with a different customer or a different points value returns 409 idempotency_conflict.
  • Keys are unique per store, across all of the store's API keys, and don't expire. The reason isn't compared.

List rewards

GET /rewards

Returns the store's active rewards, in the order set on the Rewards page.

curl https://app.thriceloyalty.com/api/v1/rewards \
  -H "Authorization: Bearer thr_live_YOUR_KEY"
{
  "rewards": [
    {
      "id": "cm3k9w1b20001qz0h3a7c9d2e",
      "kind": "AMOUNT_OFF",
      "title": "$5 off",
      "points_cost": 500,
      "value": 5,
      "min_subtotal": null,
      "expires_after_days": 30,
      "min_tier_id": null,
      "product_variant_ids": []
    },
    {
      "id": "cm3k9w4f60002qz0h8b1d4e7a",
      "kind": "FREE_SHIPPING",
      "title": "Free shipping",
      "points_cost": 800,
      "value": null,
      "min_subtotal": 40,
      "expires_after_days": null,
      "min_tier_id": "cm3k9x2f80004qz0h7d1e5b2a",
      "product_variant_ids": []
    }
  ]
}
Field Notes
kind AMOUNT_OFF, PERCENT_OFF, FREE_SHIPPING, FREE_PRODUCT or STORE_CREDIT
value Amount in the store's currency for AMOUNT_OFF and STORE_CREDIT, percentage (1 to 100) for PERCENT_OFF, otherwise null
min_subtotal Minimum order subtotal for the code, or null
expires_after_days Days the code is valid after redeeming, or null for no expiry
min_tier_id The lowest VIP tier that can redeem it, or null for everyone
product_variant_ids FREE_PRODUCT: the product variants (Shopify IDs) the member picks one unit of; empty for other kinds

Redeem a reward

POST /members/{customerId}/redemptions
Parameter Type Required Rules
reward_id string Yes The id of an active reward from GET /rewards
variant_id string For a FREE_PRODUCT reward with several products One of the reward's product_variant_ids: the product the member gets one unit of
curl -X POST https://app.thriceloyalty.com/api/v1/members/7012345678901/redemptions \
  -H "Authorization: Bearer thr_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reward_id": "cm3k9w1b20001qz0h3a7c9d2e"}'

Response 201:

{
  "redemption": {
    "id": "cm3n4f2a8002cqz0h5d3e8b1c",
    "reward_id": "cm3k9w1b20001qz0h3a7c9d2e",
    "code": "THRICE-7KD2QX9M",
    "status": "ISSUED",
    "points_spent": 500,
    "expires_at": "2026-12-23T11:15:02.000Z",
    "created_at": "2026-11-23T11:15:02.000Z"
  }
}

This works the same way as a member redeeming in your store. The points are spent and Thrice creates a real Shopify discount code that only this customer can use, once. Give the code to the customer. expires_at is null when the reward has no expiry. A STORE_CREDIT reward has no code: code is null, the amount goes to the customer's Shopify store credit, and expires_at is when that credit expires.

  • If Shopify refuses the discount, you get 502 discount_rejected and the points are returned.
  • If Shopify doesn't answer clearly, you get 502 discount_pending. The points stay spent while the redemption waits to be settled. Don't retry straight away: a second call is a second redemption. The same code is returned for an unexpected failure before any points were taken, so read the member's balance before you assume they were spent.
  • A successful call sends the points.spent and reward.redeemed webhooks.

This endpoint has no idempotency key.

Access log

Every successful request under /members is recorded in the access log under Settings > Data & privacy, with the key's first characters as "who". Requests that end in an error are not recorded. See Settings.

What the API doesn't do

  • It can't list or search members. You need the Shopify customer ID of a member you already know.
  • It can't create members. A customer becomes a member the usual ways; see How points work.
  • It can't change rules, rewards, tiers, settings or webhooks. To manage those from an AI assistant, use the MCP server.
  • It returns only the 20 most recent history entries.

To get notified when something happens instead of polling, use webhooks. To move data in bulk, use Import and export. To change points from Shopify Flow, use the Add loyalty points and Remove loyalty points actions; see Klaviyo and Shopify Flow.