Base URL
All Admin API endpoints share the same base:/api/external/.
With a valid API key, a
GET to a path under /api/external/ that has no GET endpoint returns 404, whether the path is mistyped or the endpoint takes another method. A POST, PUT or DELETE to a path that doesn’t take that method returns 405 with Request method 'PUT' not supported (or 'POST', 'DELETE'). If you get either, check the path and the method against the API reference.Authentication
- Merchant API key
- Partner integration (recommended)
Direct integrations pass the merchant’s API key in the
X-API-Key header. Merchants create keys under More → API Integrations in the Appstle admin. Each key is scoped to a single store, and up to 10 active keys are allowed per store.Direct API access requires an active API plan. Contact support@appstle.com for details.
Point management
Orders earn points automatically
Appstle credits points for orders on its own, from Shopify’s order events and the merchant’s earning rules, so you don’t call the API for it. That includes orders placed on a custom or headless storefront, as long as the order belongs to a Shopify customer. One setting has to be on for this to work: the Appstle Loyalty app embed in the store’s live theme, even when customers never see that theme. In the Shopify admin, go to Online Store → Themes → Customize → App embeds, turn on Appstle Loyalty and click Save. Then open the Appstle Loyalty app in the Shopify admin once, so Appstle picks up the change.Look up a customer’s loyalty data
Retrieve a complete loyalty profile by Shopify customer ID or email.Add points
Credit points to a customer’s account. Include anote so the transaction is labeled clearly in the customer’s history.
customerId or customerEmail, and a points value greater than 0. When you send both customer fields, Appstle uses customerId. The call returns the customer’s loyalty details with the new balance.
The customer has to be in the store’s loyalty customer list, but Appstle doesn’t check their customerStatus. A customer the merchant excluded (EXCLUDED) or who opted out (EXCLUDED_BY_CUSTOMER) still gets the points, and the call returns 200. To skip those customers, read customerStatus with Get customer loyalty details first. Remove points doesn’t check customerStatus either.
A refused request returns 400 with the reason in title, and adds no points. message is always error., so read title:
The titles
Customer info missing and Points missing end with a space, so trim title before you compare it.
add-points has no idempotency key, so sending the same call twice adds the points twice. After a timeout or a 5xx error, check the customer’s balance or transaction history before you send the call again. HTTP status codes lists the other status codes.
Redeem points for a reward
Convert a customer’s points into a reward, such as a discount code or store credit, using a configured redemption rule.redeemRuleId values, call GET /api/external/point-redeem-rules (see Program configuration below).
Most rules have a fixed cost and a fixed reward: the call spends the rule’s redeemPoints and ignores any points you send, store credit rules included. A DYNAMIC_DISCOUNT rule is the exception. For it, send the number of points to spend as points. It’s required, it must be positive, and the customer must have that many available. The rule’s minimum and maximum points limits apply too. The customer gets a discount code worth the rule’s discount for every redeemPoints points.
Get transaction history
Retrieve a customer’s full point transaction log.Approve pending transactions
For programs where points require approval before becoming available, use this endpoint to move pending points to available. Send the transactions to approve as an array. Pending transactions have the statusPENDING in the transaction history.
?approveAllPendingTransactions=true instead. The approval runs in the background, and the endpoint returns 204 No Content.
Customer management
Enroll a customer
Add a customer to the loyalty program. Call this before attempting to add points to a customer who has not yet joined. Pass the Shopify customer ID in thecustomer_id query parameter.
Appstle Loyalty Member, to their Shopify customer profile. See Enrollment tags.
Referral links and tokens
Every enrolled customer has areferralLink in Get customer loyalty details. It’s a short link in the form https://referral.appstle.com/{token}, or on the merchant’s own domain when they’ve set one up under Custom Referral Domain in the Referrals settings. The last part of the link is the customer’s referral token.
When a friend opens the link, it redirects to the store’s primary domain in Shopify, with the token in the query string:
/apps/loyalty by default). The redirect never goes to another domain.
How the friend’s acceptance reaches Appstle depends on where your code runs:
- A theme with the app embed on. The Appstle Loyalty widget reads
appstle_referral_codeand accepts the referral itself, with the signed-in customer’s email or one the friend enters. - Your own page on the merchant’s Shopify storefront. Read
appstle_referral_codeand send it astokento Accept referral offer. That’s a Storefront API endpoint: call it from the shopper’s browser through the App Proxy, without your API key. - A headless storefront, or any server. There’s no App Proxy to call, so use the Admin API: accept the referral from your server and read the referral history.
Accept a referral from your server
Call Accept a referral invite when a friend arrives through a referral link and gives you their email. Send the referral token astoken and the friend’s email as email. The call needs a Read & write API key (Key permissions), so make it from your server and never put the key in browser code. The call doesn’t check that email is a valid address, so validate it before you call.
The referral link lands on the store’s primary domain in Shopify, so open one to see where it lands. If that’s your storefront, read appstle_referral_code from the landing URL. If it isn’t, or it lands on a path your storefront doesn’t serve, share a link of your own: the token is the last part of referralLink, so put it in a URL on your site, such as https://www.example.com/?ref={token}, and read it from there. Either way, keep the token in a cookie or the session until the friend gives you their email.
- Creates the referral with the status
PENDING, and issues any reward the merchant set to be given on acceptance. When the program rewards both customers on acceptance, the referral is alreadyCLAIMEDwhen the call returns. - Creates a Shopify customer for the friend’s email when the store has none. Appstle enrolls that customer in the loyalty program shortly after, the way it enrolls every new Shopify customer, so only while the app embed is on.
existingCustomeristruewhen the email already belonged to a customer. - Tags both customers:
referral:{friend's customer ID}on the referrer andreferred:{referrer's customer ID}on the friend (see Referral tags).
discountCode is null unless the merchant has asked Appstle support to return the friend’s reward code and the friend got a discount code on acceptance. Then it holds the friend’s own code, never the referrer’s. id is always null: to find the referral record, read the referral history. To show the friend their reward on your site, call Get customer loyalty details with customerEmail once they’re enrolled: a discount code reward is in rewards. Appstle also emails both customers, with the discount code when the reward has one, but only while the Appstle Loyalty app embed is on in the store’s live theme.
A friend who qualifies through a purchase is rewarded when they place a qualifying order with the same email, and you make no further call. Like order points, these rewards need the app embed on, even on a headless store that never shows the theme: see Orders earn points automatically.
The call can take several seconds, because Appstle creates the friend’s customer and issues any reward before it answers, so give it a generous timeout. If it times out anyway, send it again: when the first call went through, the retry returns ALREADY_REFERRED and the referral shows in the referrer’s history.
Refused referrals
A refused referral and a request Appstle can’t process both return400, with different bodies. A refusal has "status": "FAILED" and the reason in message. A request with an empty token or email gets a problem response instead (Content-Type: application/problem+json), with the reason in title. Appstle trims spaces around email, then checks the address before the token, so a malformed address returns INVALID_EMAIL even when the token is also wrong. To check an address before you call, match Appstle’s rule: a name, @, then a domain with at least one dot whose last part is two or more letters, such as nora@example.com.
token or email returns this problem response:
FAILED response, errorKey is INVALID_EMAIL, SELF_REFERRAL or ALREADY_REFERRED for those three causes and null for the rest, so match on it rather than on the English message. Read errorKey only when status is FAILED: the problem response has the string "null" there. A FAILED response is Appstle’s answer to that request, so show the friend a message instead of retrying it. The one exception is the store’s daily limit: every accept with a valid token and a well-formed email counts toward it, refused ones and retries included, and once the store reaches it, every accept returns An error occurred while processing the request. until 00:00 UTC. If you accept many referrals for one store, for example in an import, spread them over several days. An invalid key returns 401, and a Read only key returns 403 (see Authentication errors).
Show referral history for a customer
Call Get a customer’s referral history from your server with the referrer’s Shopify customer ID to list the referrals they’ve sent. A Read only key is enough.statusisPENDINGuntil the referral is rewarded, andCLAIMEDonce every reward the program gives for it has been issued. On a subscription referral program with Give rewards for recurring order turned on, the referral becomesRECURRINGinstead, as soon as either customer is rewarded.referralRewardedandreferredRewardedsay whether the referrer and the friend have received their reward.claimAtis empty until the referral isCLAIMED.referredEmailIdis masked (***when the stored value isn’t an email address), because the list is meant to be shown to the referrer. Keep the friend’s real email from your ownreferral-acceptcall if you need it.description,referralRuleId,referralNote,referredNote,orderCountandpixelDataare alwaysnullin this response.- Page through the list with
page(from0) andsize, and sendsort=createAt,descfor the newest first. Withoutsort, the order isn’t guaranteed. Name a property the referral has, in camelCase: asortthat names no such property, such ascreate_at, returns400witherrorKeyinvalidSort. Omitpageandsizeto get the first 20. - The total count is in the
X-Total-Countresponse header, and theLinkheader has the URLs of the first and last pages, and of the next and previous pages when they exist. - A call without
customerIdreturns400. A customer ID with no referrals returns an empty list.
Update a customer’s birthday
Set a date of birth indob to enable birthday reward automation. Date format is YYYY-MM-DD. If you only know the month and day, send any year and set dobYearProvided to false.
Get top customers
Retrieve your loyalty members ranked by points earned, most first. Page through the list withpage (from 0) and size. The order is fixed, so leave out sort. A loyalty customer property such as createAt is ignored, and any other name returns 400 with errorKey invalidSort, including the list’s own pointsEarned.
Rewards and discounts
Check a discount code
Look up a loyalty discount code that belongs to a customer, for example before applying it at checkout. The response is the reward record, including itsstatus (such as UNUSED or USED). If the code doesn’t belong to that customer, the API returns 400.
Change a reward’s status
Appstle sets a reward toUSED by itself shortly after a Shopify order uses up its code (after one use, unless the redeem rule allows more), and saves the order’s orderId and orderName and the time in usedAt. You don’t need to call the API for orders placed through Shopify. To set a status yourself, for example to mark a code used in a sale outside Shopify or to cancel a reward without giving its points back, call PUT /api/external/update-discount:
customerId, discountCode and status are all required. The call returns 200 with the reward in its new status (trimmed):
UNUSED: the code applies at checkout. IfSUBSCRIPTION_ACTIVEtook the code off its redeem rule’s discount in Shopify, Appstle asks Shopify to add it back.usedAtis cleared if the code was never used.USED,EXPIRED,REFUNDEDandCANCELED: the code stops applying at checkout, although it stays on the discount in Shopify.USEDset this way setsusedAtto the time of the call. This call never changesorderIdororderName.SUBSCRIPTION_ACTIVE: Appstle asks Shopify to delete the code from its redeem rule’s discount, and returns200even if Shopify refuses. Appstle Subscriptions sets this status when a Loyalty reward code is applied to a subscription. Don’t send it yourself: sendUNUSEDto undo it.
discountCodeId starts with gid://shopify/DiscountRedeemCodeBulkCreation/. A code that is a Shopify discount of its own (gid://shopify/DiscountCodeNode/...) keeps working whatever its status. No status gives points back, and no webhook event reports a status change.
A reward that is already USED can’t be changed with this call: every request for it returns 400 with the title Discount is already used., a second USED included. If you get that 400 when you retry a timed-out USED request, call check-discount: a reward that shows USED was marked by your first request or by an order. If no reward matches customerId and discountCode, nothing changes and the call returns 400 with the title Discount is not found. A request without status, or with a status that isn’t one of the six values, also returns 400. Appstle matches the code without regard to case, and the reward keeps the spelling you send, so send the code exactly as issued.
The older PUT /api/external/update-discount-code-status takes the same body and also accepts customerEmail instead of customerId. If you send both, Appstle uses customerId. It returns the customer’s loyalty details instead of the reward. Like update-discount, it sets usedAt to the time of the call for USED and clears it for UNUSED on a code that was never used. Checkout follows the new status as it does for update-discount, whether you send customerId or customerEmail. It never adds or deletes the code in Shopify. A reward that is already USED can’t be changed (400 with the title Discount is already used.), except that a request for USED again returns 200 and changes nothing, so you can retry a timed-out call. A code that isn’t found returns 400 with the title Discount is not found. A request without discountCode or status, with a status that isn’t one of the six values, with neither customerId nor customerEmail, or for a customer who isn’t enrolled also returns 400, with the reason in title.
No Admin API call gives a reward’s points back:
CANCELED and REFUNDED change only the status. A signed-in customer can return an unused reward for its points through the Storefront API, and that call has no API-key version.Store credits
Add store credits
Credit a monetary amount to a customer’s store credit balance. Credits are applied at checkout and are separate from loyalty points.200 with the same body as Get customer loyalty details, including the new storeCreditBalance.
If Shopify refuses the credit, for example because it would take the balance over Shopify’s store credit limit, the credit isn’t added and the call still returns 200. To confirm the credit, check that storeCreditBalance in the response went up by the credits you sent.
Program configuration
Get point earn rules
Retrieve all active point earn rules for your store. Use the returnedid values when calling add-points with a specific rule.
Get point redeem rules
Retrieve all active redemption options. Use the returnedid values as redeemRuleId when redeeming points. A rule’s ruleStartDate and ruleEndDate are ISO 8601 date-times, or null when the reward has no dates. Outside them, a redeem returns 400 with the title UserGeneratedError:This reward isn't available yet. or UserGeneratedError:This reward has ended., so offer a reward only between the two. The list can include a FREE_SHIPPING rule whose maximumShippingRate is 0 or less. That rule can’t be redeemed, so skip it.
Rate limits
The Admin API returns429 Too Many Requests in three cases:
- Per-minute rate limit. Each store gets 600 calls a minute, Admin API and Storefront API calls together, and 60 calls a minute to any one endpoint. Paths that differ only in a numeric ID count as one endpoint, and the query string doesn’t count, so every
customer-loyaltylookup for the store shares one limit. Once an endpoint has returned five errors (status400or higher) for the store within a minute, its limit drops to 10. Treat these numbers as the most you should send. Over a limit, the body is{"error":"Rate limit exceeded. Try again later."}and there’s noRetry-Afterheader. Retry with exponential backoff, never immediately. - Too many
PUTcalls at once. Send no more than fivePUTcalls at a time for one store. Above that, the body is{"error":"Too many concurrent mutation requests. Please wait for existing requests to complete."}and there’s noRetry-Afterheader. Wait for your otherPUTcalls to finish, then retry with exponential backoff. - Daily call allowance. This applies only to stores that have one. The response has a
Retry-Afterheader with the seconds left until 00:00 UTC, when the allowance resets. Stop calling until then, because retrying sooner can’t succeed. Calls made with a partner token don’t count toward it.
400 with "status": "FAILED" instead of 429: see Refused referrals.
Common integration patterns
Review platform (Judge.me, Okendo, Yotpo)
Review platform (Judge.me, Okendo, Yotpo)
- Customer submits a review on your platform.
- Your platform calls
POST /api/external/add-pointsto credit points. - Optionally, use the Shopify Flow
reward-points-for-reviewsaction for a no-code setup that does not require API calls.
CRM or helpdesk (Gorgias, Zendesk)
CRM or helpdesk (Gorgias, Zendesk)
- Call
GET /api/external/customer-loyaltyby customer email or ID to display loyalty status alongside the ticket. - Call
POST /api/external/add-pointsorPOST /api/external/add-creditsto issue goodwill adjustments. - Call
GET /api/external/point-transaction-history/{customer_id}to show recent activity in context.
Email or SMS platform (Klaviyo, Omnisend)
Email or SMS platform (Klaviyo, Omnisend)
- For Klaviyo, connect it in the Appstle Loyalty admin. Appstle then sends its loyalty emails to Klaviyo as events that you build flows on (see Klaviyo events). For other platforms, use webhooks to receive real-time point and tier events for trigger-based campaigns.
- Call
GET /api/external/customer-loyaltyto enrich customer profiles with points balance, VIP tier, and referral link. - Segment customers by
currentVipTieroravailablePointsrange for targeted sends.
Headless storefront (referrals)
Headless storefront (referrals)
- From your server, call
GET /api/external/customer-loyaltyand show the customer’sreferralLink, or a link to your own site with the token from the end ofreferralLink. - When a friend lands with the token, keep it until they give you their email. Then call
POST /api/external/referral-acceptfrom your server with both. - From your server, call
GET /api/external/customer-referralswithsort=createAt,descto show the referrer their referrals and each one’s status.
Mobile app (native rewards screen)
Mobile app (native rewards screen)
- The customer signs in to your app, and your server works out which Shopify customer they are from that sign-in. Never look up a customer ID or email the app sends without checking it.
- From your server, call
GET /api/external/customer-loyaltywith theircustomerIdorcustomerEmail, and send the points, VIP tier and rewards to the app. Call it when the customer opens the rewards screen, not on every app launch: all of the store’s lookups share one per-minute limit (see Rate limits). - A customer who isn’t in the program yet gets
400with the titleCustomer not found using this customerID, orCustomer not found using this emailfor a lookup by email. Don’t retry the lookup, because each400counts toward the errors that lower the limit. Show a way to join instead, and enroll them with Enroll a customer. - To redeem, call
POST /api/external/redeem-pointsfrom your server. It returns the customer’s updated loyalty data, the same ascustomer-loyalty, so you don’t need another lookup. - Keep the API key or partner token on your server, never in the app. Don’t call the Storefront API from the app: it works only for a customer signed in to the store in a browser. To show the store’s loyalty page inside the app instead, see Mobile apps and in-app browsers.
Becoming a partner
If your product integrates with loyalty programs, Appstle offers a formal partner program:- Zero-friction merchant onboarding via the Partner Integration Framework
- Scoped API tokens per merchant — no manual key exchange
- Merchants are never charged for partner API usage
- Technical support, co-marketing opportunities, and directory listing
Next steps
Webhooks
Receive an event on your server when a customer joins, earns or redeems points, reaches a VIP tier or gets a referral reward.
Shopify Flow
Award points, assign VIP tiers and issue store credits without API code.
Klaviyo events
The events Appstle Loyalty sends to Klaviyo, when each is sent and the properties it carries.
Partner integration
Connect your platform and receive scoped API tokens for merchants.