Skip to main content
This guide covers everything you need to build a full integration with Appstle Subscriptions. It assumes you already have an API key — if not, see the Authentication page first.

Base URL

All Admin API endpoints share this base URL:
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. Its detail is No API endpoint matches this method and path. Check both against the API docs. 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

Pass your API key in the X-API-Key header on every request:
Five bulk-automation endpoints also need the key in the api_key query parameter (see Deprecated query parameter). For partner integrations that connect on behalf of multiple merchants, use the Partner Integration Framework. After a merchant approves a Nonce Handshake connection, Appstle issues your application a scoped API token for that merchant. Send that token as X-API-Key:
See Authentication for merchant API key management and Partner integration for the complete connection flow.

Looking up customer subscriptions

Get all subscriptions for a customer

The response includes active, paused, and cancelled subscriptions along with their products and next billing date. It has no delivery address or delivery method: see Read the delivery address and method.

List a customer’s contract IDs

Returns the IDs of every subscription contract the customer has, whatever its status. An empty array means the customer has no subscriptions. To know whether one is active, read its status with Get full contract details.

Get full contract details

Filter the contract list by the contract’s ID. The response is an array. The filter matches part of an ID, so take the entry whose subscriptionContractId equals your ID:

List every contract

To read all of a store’s contracts, for a first sync into a CRM or a data warehouse, page through the contract list. Sort by id, which is unique and grows with each new contract, so a contract created while you read joins the last page instead of moving the pages you have already read. A field that several contracts can share, such as created_at, can repeat or skip a contract at a page boundary:
The x-total-count response header holds the number of contracts. Repeat the call with page=1, page=2 and so on until you have read that many, or until the link header has no rel="next" link. size goes up to 2000. sort takes the field’s snake_case name, such as id or next_billing_date: a camelCase name such as nextBillingDate returns 400. After the first full read, ask only for what changed. Add fromUpdatedDate, set to the time your previous read started, to the same call, for example fromUpdatedDate=2026-11-09T00:00:00Z. A contract that changes while you page joins the list where its id sorts and can repeat a contract at a page boundary, so store contracts by id. The status filter takes one full value (active, paused, cancelled, expired or failed, in any letter case) and returns an empty list, not an error, for a value that matches no status.

Find the subscription behind an order

The contract list has no order ID filter. To find the contract or contracts for an order, for example when you handle Shopify’s orders/cancelled webhook, search by the order’s name and then check the order ID. Appstle records a new contract shortly after the order is placed, so a search sent as soon as an orders/create webhook arrives can come back empty. Search again after a short wait, or act on the subscription.created event instead.
1

Search by order name

orderName matches part of a name and ignores case, and it matches the name of a contract’s first order and of its renewal orders. Encode # as %23.
2

Keep the contracts whose orderId matches

Because the match is partial, a search for #100 also returns the contracts of #1001, #1002 and any other order whose name contains it. Compare each result’s orderId with the ID of the order you are handling. One order can create more than one contract, so expect a list:
The example shows only the fields you need: each entry is a full contract. An empty list means no first order or renewal order has a name containing your search. The list is paged: 20 contracts a page unless you set size, up to 2000, and x-total-count holds the number of matches. When it is larger than size, follow the rel="next" URL in the link header as it is, which keeps # as %23, or send the same parameters with page set to the next number.
3

For a renewal order, confirm with past orders

If the search returns contracts but none has your order’s ID, the order may be a renewal order. The contract in the result shows its first order: orderId and orderName belong to the first order, not to the renewal. To confirm a renewal, call Get order history with the contract’s ID and look for the renewal’s orderId. The list also includes the contract’s first order, with id set to null.
Every order a subscription creates also carries the contract in its appstle_subscription / details order metafield: see Order metafields.

Get upcoming orders

With contractId, the call returns up to 10 of the subscription’s queued and skipped orders, earliest first, starting from its nextBillingDate. It returns an empty list for a subscription that isn’t active, such as a paused one.

Subscription management

Cancel a subscription

The optional cancellationFeedback and cancellationNote query parameters store why the subscription was cancelled. A successful call returns 204 No Content. You can retry this call safely. For a subscription that is already cancelled it returns 204 and does nothing, and the customer gets no second cancellation email. If the plan sets a minimum number of billing cycles and the subscription hasn’t reached it, the call returns 400, unless the subscription is in its free trial. The status call below doesn’t apply that rule. title and message hold the store’s minimum-cycles message after a UserGeneratedError: prefix. The default message is shown here, and a store can change it:
A 204 doesn’t prove the contract existed: an ID that isn’t found for your store also returns 204 and does nothing. Read the contract with Get full contract details first when you need to be sure.
The PUT endpoints in this guide read their inputs from the query string, not from a JSON body. A request that sends them in a body returns 400 with Required request parameter 'contractId' for method parameter type Long is not present. The one exception is Update shipping address, which takes the address as a JSON body.

Pause a subscription

Resume a subscription

status is ACTIVE, PAUSED or CANCELLED, in uppercase: status=paused on an active subscription returns 400. A successful call returns 204 No Content.
The call doesn’t check the subscription’s current status. For a cancelled subscription, status=PAUSED and status=ACTIVE return 204 and move it from cancelled to paused or active, in Appstle and in Shopify. ACTIVE also schedules its upcoming orders again, so the customer is charged on the next billing date. Either way, the customer gets the store’s pause or resume email, unless the store has turned that email off. Read status with Get full contract details first, and only pause or resume subscriptions that are "active" or "paused".
Sending the status a subscription already has, such as status=PAUSED for a paused subscription, returns 204 and changes nothing. The exception is status=ACTIVE on an active prepaid subscription that is due to cancel at the end of its term: the call clears that pending cancellation, so the subscription isn’t cancelled when the term ends, and pendingCancellationDate goes back to null. The call doesn’t restore the orders after the term that the cancellation removed, so check Get upcoming orders afterwards. status=CANCELLED cancels at once even when the plan’s minimum number of billing cycles hasn’t been reached, so use Cancel a subscription when you want the minimum enforced. A contract ID that isn’t one of your store’s contracts returns 400 with Contract does not exist.

Resume on a specific date

To resume a paused subscription with its next charge on a date you choose, for example 14 days after its first order is delivered, set the next billing date while the subscription is still paused, then resume it. Make both calls at the moment you resume, and send the second only after the first returns 200:
Here is what happens to the date:
  • Setting the date works on a paused subscription. The first call returns 200 with the contract still PAUSED and nextBillingDate set to your date.
  • Resuming keeps a date that is still in the future. The first upcoming order is on your date, and the rest follow at the plan’s billing interval.
  • Resuming moves a date that has passed. The call moves nextBillingDate forward to the first date after now on the subscription’s billing schedule, so the next charge can be up to one billing interval away. For a monthly plan resumed a few seconds after its date, nextBillingDate came back exactly one month later. In this case status can still read paused for a moment after the 204 before it changes to active.
  • A paused subscription’s date doesn’t wait. When nextBillingDate arrives while the subscription is paused, nothing is charged and Appstle moves nextBillingDate on to the next scheduled order. A date you set when you pause is replaced if it arrives before you resume, so set the date at the moment you resume.
Read nextBillingDate with Get full contract details after the second call to confirm the date. A subscription on a plan with fixed billing dates can’t be rescheduled, so the first call returns 400 for it (see Reschedule the next billing date).

Reschedule the next billing date

nextBillingDate is an ISO 8601 date with a time zone. URL-encode a + in an offset as %2B. The date must be in the future: a past date returns 400. By default Appstle also moves the later orders to follow the new date; send rescheduleFutureOrder=false to change only the next one (see the warning below). A successful call returns 200 with the updated contract as Shopify returns it, including its new nextBillingDate. The call also works on a paused subscription: the date is saved and the subscription stays paused (see Resume on a specific date). A subscription on a plan with fixed billing dates can’t be rescheduled: the call returns 400 with errorKey fixedBillingScheduleRescheduleBlocked and UserGeneratedError:Fixed billing schedule subscriptions cannot be rescheduled. The next order date follows the plan's fixed billing dates. A successful call also sends the customer the store’s Next Order Date Updated email (its default subject is “Your next order date has been updated!”). No request parameter skips it, whether rescheduleFutureOrder is true or false. Two store settings in the Appstle Subscriptions app stop it: the email is turned off under More → Notification Settings, or the subscription is paused and Disable notifications for paused or canceled subscriptions is on under Shop Settings.
Send rescheduleFutureOrder=false only to move the next order to a date before the order that follows it. The later orders keep their dates, so a nextBillingDate past them doesn’t delay them: Appstle still bills each of those orders on its own date, and the moved order stays queued for the new date. After the first of those orders bills, nextBillingDate goes back to the next order still queued. Until then, Get upcoming orders lists only orders on or after nextBillingDate, so the orders before it don’t appear there. To move the next order past the one after it, send true or leave the parameter out, so every later order moves with the date.
Changing the next billing date needs an Appstle plan that includes it, on top of API access (see Plan features some endpoints need). Stores that choose a paid plan today get it, and the Free plan doesn’t include it. A store on a plan without it gets 400 with errorKey permissionDenied and UserGeneratedError:Upgrade your plan to modify next billing date. A store that chose its plan earlier, or is on a custom plan, may not have it: contact support@appstle.com to check. The reschedule-order endpoint (PUT /api/external/v2/subscription-billing-attempts/reschedule-order/{id}) needs the same permission.

Update billing frequency

interval is DAY, WEEK, MONTH or YEAR, and intervalCount is how many of them pass between orders (1 to 365). A successful call returns 200 with the updated contract. Depending on the store’s settings, changing the frequency recalculates the next billing date, so a date you set earlier with Reschedule the next billing date may not be kept. To change both, set the frequency first and the date second, and check nextBillingDate in each response. Changing the billing frequency needs an Appstle plan that includes it (see Plan features some endpoints need). Stores that choose a paid plan today get it, and the Free plan doesn’t include it. A store on a plan without it gets 400 with errorKey permissionDenied and UserGeneratedError:Upgrade your plan to modify billing interval. A store that chose its plan earlier, or is on a custom plan, may not have it: contact support@appstle.com to check.

Skip an upcoming order

{id} is the id of an upcoming order from Get upcoming orders:
A successful call returns 200 with that upcoming order, and its status is now SKIPPED. The order no longer appears in the next upcoming orders response.

Product management

To protect customers from accidental or fraudulent charges, a store with the charge cap on refuses an API change to a subscription’s products, such as adding a product or raising a quantity, when it would raise the subscription’s amount to more than 3 times the customer’s original order amount (5 times once the subscription has billed 3 times). A subscription with no original order amount on file is capped at 500 USD instead, converted to its currency. New installs have the charge cap on. The call returns 400 with errorKey line_item_escalation_blocked and a message that starts with UserGeneratedError:To prevent fraudulent or accidental charges, this change was blocked. Changes a customer makes in the customer portal aren’t subject to this limit. To raise the limit for a store, contact support@appstle.com.

Add a product to a subscription

variantId is the Shopify variant ID, with or without the gid:// prefix. Add isOneTimeProduct=true to add the product to the next order only. A successful call returns 200 with the updated contract. Each entry in its lines.nodes has an id such as gid://shopify/SubscriptionLine/ae46e632-dfd0-4135-b577-2d0a634042bf. The call doesn’t create an order or charge the customer, and it doesn’t change nextBillingDate. The new line is billed with the subscription’s next scheduled order and with every order after it. A line added with isOneTimeProduct=true is billed with the next order only, and Appstle removes it after that order bills successfully. A successful call also sends the customer the store’s product-added email (its default subject is “Product added to your subscription!”), unless the store has turned that email off under More → Notification Settings. To bill the customer sooner, call Trigger immediate billing for an order. It bills every line on the subscription, not only the new one, and the store’s When billing manually setting decides what it does to the schedule. The call needs an Appstle plan that includes Order now: a store without it gets 400 with errorKey feature_access_denied (see Plan features some endpoints need). The store can also have a daily limit on immediate orders, 3 a day unless support has raised it: once the store has used its immediate orders for the day, the call gets 400 with errorKey immediate_order_daily_limit_exceeded (see Daily limit on immediate orders). Adding a product that the subscription already has usually creates a second line. Some stores are set up to raise the quantity of the existing line instead when its price is the same, so check lines.nodes in the response. A one-time line is always added as a new line. To change the quantity of an existing line yourself, use Update product quantity.

Add a product at a custom price

Use this call to set the price of the new line yourself, for example to charge a prorated amount:
It takes the same parameters as Add a product to a subscription, plus the required price: the price of one unit, in the subscription’s currency (the currencyCode on its lines). The product’s own price and selling plans are ignored, so the new line has no selling plan. The line is billed the same way as above: with the next scheduled order, with nextBillingDate unchanged, and once only when you send isOneTimeProduct=true. The charge cap in the Note above applies to this call too. Appstle adds price times quantity to the subscription’s current amount, every existing line’s current price times its quantity, and refuses the call with 400 and line_item_escalation_blocked when the total is over the cap. A refused call doesn’t add the line, so don’t retry it with the same price and quantity. Discounts can still lower the price you send:
  • A discount on the subscription that covers all its lines, such as the discount code in the example below, also applies to the new line.
  • If the store has Offer additional discount for adding products to subscription switched on in its customer portal settings, Appstle also adds the store’s subscription discount to the new line, one-time or not.
The response is the updated contract. The new line is the entry in lines.nodes with your variant and price, and its lineDiscountedPrice is what the line costs after discounts. A one-time line carries the attribute _appstle-one-time-product with the value true. This is the new line from a call with price=3.25&isOneTimeProduct=true, on a subscription with a 10% discount code:
On a subscription whose plan is Prepaid, separate orders, you can add only one-time lines at a custom price. A recurring line returns 400 with errorKey prepaidSeparateOrdersNoDiscountAddBlocked. To charge a prorated amount for a product added in the middle of a billing cycle, and the full price from then on, make two calls with the same contractId and variantId, one after the other. The first adds a one-time line at the prorated price, and the second adds the ongoing line at the full price:
The next scheduled order bills both lines, and later orders bill only the ongoing line. nextBillingDate doesn’t change. Because the next order has both lines, it contains the product twice: once at the prorated price and once at the full price. Each call also sends the customer the product-added email. Discounts on the subscription apply to both lines, so check each line’s lineDiscountedPrice in the responses.

Remove a product from a subscription

lineId is the line’s full gid:// ID, from lines.nodes[].id. A successful call returns 200 with the updated contract. Read the IDs with GET /subscription-contracts/contract-external/{contractId}.

Update product quantity

A successful call returns 200 with the updated contract.

Discounts

Applying and removing a discount need an Appstle plan that includes contract price changes (see Plan features some endpoints need). Stores that choose a paid plan today get it, and the Free plan doesn’t include it. A store on a plan without it gets 400 with errorKey permissionDenied and UserGeneratedError:Upgrade your plan to modify contract price. A store that chose its plan earlier, or is on a custom plan, may not have it: contact support@appstle.com to check. To change the discount that a subscription plan gives, see Change a plan’s discount.

Apply a discount code

The code must be one of the store’s Shopify discount codes, and its Purchase type must include subscriptions. A successful call returns 200 with the updated contract. The new discount is in discounts.nodes[], and each line’s lineDiscountedPrice shows the price after the discount. This is a trimmed response for a 10 percent code called SAVE10 on a contract with one line:
Keep the discount’s id: it is the discountId you pass to remove a discount. In this example the code is set in Shopify to apply to one recurring payment, so recurringCycleLimit is 1. A refused call returns 400. The body’s errorKey says why, and its message starts with UserGeneratedError:. Each item gives the errorKey, then the message after that prefix:
  • DISCOUNT_NOT_FOUND, Discount code not found: the code isn’t one of the store’s Shopify discount codes.
  • DISCOUNT_NOT_ACTIVE, This discount code is not currently active: the discount has expired or hasn’t started yet.
  • DISCOUNT_NOT_STARTED, This discount code is not yet active, and DISCOUNT_EXPIRED, This discount code has expired: the same two cases, found from the discount’s start and end dates. The app checks the discount’s status first, so you normally get DISCOUNT_NOT_ACTIVE instead.
  • USAGE_LIMIT_REACHED, This discount code has reached its usage limit: the discount has used up its total number of uses.
  • NOT_APPLICABLE_TO_SUBSCRIPTIONS, This discount code cannot be applied to subscriptions: the discount’s Purchase type is One-time purchase.
  • ALREADY_USED_BY_CUSTOMER, You have already used this discount code: the discount allows one use per customer, and this contract’s customer has used it.
  • CUSTOMER_NOT_ELIGIBLE, This discount code is not available for your account: the discount is limited to specific customers, and this contract’s customer isn’t one of them.
  • subscriptionTotalAlreadyZero, This subscription already has a total price of $0. An additional discount cannot be applied.: the contract’s total is already $0.
  • updateError: the change didn’t go through. When the contract already has a discount code that this one can’t be combined with under the codes’ Combinations settings in Shopify, the message names both, for example SAVE10 cannot be combined with WELCOME15.
  • idexists: Shopify refused the code for this contract, and the message says why, for example This discount doesn't apply to any of the products currently in this subscription.
  • No errorKey, Discount is already applied: a discount with this code is already on the contract.
The text after UserGeneratedError: is written for people: remove the prefix and show the rest to the customer or support agent. Handle an errorKey that isn’t in this list the same way.

Remove a discount

discountId is the full gid:// ID of the discount. Read it from the discounts of the apply response, or of GET /subscription-contracts/contract-external/{contractId}. A successful call returns 200 with the updated contract, and the discount is gone from discounts.nodes[]. An ID that isn’t on the contract also returns 200 and changes nothing, so check discounts in the response to confirm the removal.

Shipping

Read the delivery address and method

Of the delivery details, the contract list returns only deliveryCountryCode. To read a subscription’s delivery address and its current delivery method, read the contract itself:
The call reads the contract from Shopify each time, so call it for the contracts you need, not for every contract on a schedule. To learn when an address or a method changes, have the merchant send webhooks to your endpoint: each subscription.updated event carries the whole contract, deliveryMethod included. An ID that isn’t one of the store’s contracts returns 400 with the errorKey invalidContract. Here are the deliveryMethod and deliveryPrice of a subscription that ships, with the rest of the contract left out:
deliveryMethod is null when the subscription has nothing to ship. Otherwise deliveryMethod.__typename says how it’s delivered, and the fields that follow depend on it:
  • SubscriptionDeliveryMethodShipping: address, and shippingOption with title, presentmentTitle, description and code.
  • SubscriptionDeliveryMethodLocalDelivery: address, and localDeliveryOption with title, presentmentTitle, description, code and phone.
  • SubscriptionDeliveryMethodPickup: pickupOption only, with title, presentmentTitle, description, code and location. The location has id, name and address, the pickup point’s address. There is no customer address.
address has address1, address2, city, company, country, countryCode, countryCodeV2, firstName, lastName, name, phone, province, provinceCode and zip. A pickup location’s address has address1, address2, city, country, countryCode, phone, province, provinceCode and zip. The type comes from how Shopify delivers the order, not from the rate’s name: a shipping rate that the store calls “Free store pickup” is still SubscriptionDeliveryMethodShipping, with the customer’s address. To change them: See the reference for the rest of the contract.

Update shipping address

The contract goes in the query string and the address in a JSON body:
A successful call returns 200 with the updated contract.
Send methodType with every request. The call builds the delivery method from the body each time, so a request without methodType moves the subscription to SHIPPING, even when it’s on local delivery or pickup now. To change only the address, send the method the subscription has now. Read it from deliveryMethod.__typename in the contract (see Read the delivery address and method):
  • SubscriptionDeliveryMethodShipping: send SHIPPING.
  • SubscriptionDeliveryMethodLocalDelivery: send LOCAL.
  • SubscriptionDeliveryMethodPickup: send PICK_UP, with its deliveryMethod.pickupOption.location.id as locationId.
When the method type stays SHIPPING or LOCAL, the subscription keeps the title of its current delivery option. When the type changes, that title isn’t carried over. A PICK_UP request doesn’t keep the title of the current pickup option. What each method needs:
  • SHIPPING: the whole address. address1 and countryCode are required. Appstle passes the address to Shopify, which validates the rest.
  • LOCAL: the same as SHIPPING, plus phone. Without it, the call returns 400 with UserGeneratedError:Phone No is required for Local Delivery.
  • PICK_UP: locationId, the Shopify location ID of the pickup point, as a number or a gid://shopify/Location/ ID. Shopify gets no address from this request. Only the ShipperHQ check below reads the address fields. Without locationId, the call returns 400 with UserGeneratedError:Choose a pickup location.
Send countryCode as the two-letter country code, such as US, and provinceCode as the region’s short code, such as OR or BC. The call ignores country and province: a body that has only those returns 400 with UserGeneratedError:Choose a valid country for this address. When Shopify refuses the change, the call returns 400 with errorKey addressUpdateFailed. If Shopify’s reason is about the address, title holds it, such as UserGeneratedError:Delivery method shipping address province code is invalid. Otherwise title is UserGeneratedError:We couldn't update this delivery address. Check the address details and try again. A methodType other than the three values gets this second message too. Two more checks can refuse the address with 400:
  • ShipperHQ. When the store validates addresses with ShipperHQ, every request is checked, PICK_UP included. An address it can’t deliver to gets the title Address is not valid. No valid carriers found for given address, and an error from ShipperHQ gets Error occurred while getting address validity.
  • Delivery options. Some stores refuse an address that has no delivery option for the requested method when the current address has one. The title is UserGeneratedError: The selected address is not eligible for delivery. Please choose a different address. PICK_UP requests skip this check.
A successful call also sends the customer the store’s address-change email, unless the store has turned that email off. Appstle may recalculate the shipping price after the call returns. The recalculation can also move the subscription to another of the store’s rates, which changes the delivery option’s title. Read the contract again for the final deliveryPrice and title. On a prepaid subscription that stays on SHIPPING, the call also changes the shipping address of the order that holds the remaining deliveries, when that order holds only this subscription and the country doesn’t change. Otherwise, that order keeps the old address: edit it in Shopify. The call returns 200 either way, and the subscription’s activity log says whether the order changed. See the reference for every field.

Past orders

Get order history

The last page also lists the contract’s first order, with id set to null. x-total-count doesn’t count it.

Cancellation and pause records

List retention activity

When a customer goes through the cancel or pause flow in the customer portal, Appstle records what happened: the reason they picked, the note they typed and whether they accepted a retention offer. GET /api/external/v2/customer-retention-activities returns these records for churn dashboards, CRM syncs and win-back automation. Cancelling or pausing a subscription with the Admin API, or with the Storefront API’s cancel and pause endpoints from your own frontend, writes none.
Send fromDay and toDay as full ISO-8601 date-times with a Z suffix, such as 2026-11-01T00:00:00Z. A date alone, such as 2026-11-01, returns 400.
The response is a JSON array, newest record first (highest id first). The endpoint ignores sort, so you can’t change the order. The x-total-count header holds the number of matching records. page starts at 0 and size defaults to 20. A new record joins the top of the list, even while you page, and moves every other record one place down, so the next page can start with records you have already read. To page through a list that doesn’t move, set toDay to the time you start reading, and store records by id.
The link header holds the URLs of the first and last pages, and of the next and previous pages when they exist. Follow them as they are: they keep the encoding of your call, so fromDay stays 2026-11-01T00%3A00%3A00Z. To build the next page yourself instead, send the same parameters with page set to the next number, and stop when a page comes back with fewer than size records or when you have read x-total-count records.
The retentionAction code says which offer the customer accepted: To see why customers leave, read actionOption in additionalInfo, because cancellationReason is only the free-text note. Accept codes you don’t recognize, because new offer types get new codes. You can filter the list with these query parameters. Each one is optional. This section lists every parameter. To try the call, use the playground in the API reference.

Subscription plans

Change a plan’s discount

To run a sale, or to end one, change the plan’s discountOffer and leave the group’s products alone. Read the group with Get subscription group by ID, change the plan, and send the group back with Update subscription group details and product assignments. To find the group’s id, use Get all subscription groups. This example changes the discount of the plan named Monthly coffee to 25 percent. It uses jq to edit the JSON between the two calls:
A successful call returns 200. The response doesn’t show the saved group: each plan’s idNew comes back empty, and productIds is null even though the group keeps its products. Read the group again to check the change:
  • discountOffer follows the plan’s discountType. It’s a percentage off for PERCENTAGE, an amount off in the store’s currency for FIXED, and the price the customer pays for PRICE. The example plan uses PERCENTAGE.
  • A new discountOffer applies only to subscriptions that start after the change. Each subscription keeps the discount it started with, so customers who subscribe during a sale keep the sale discount after it ends.
  • A change to discountOffer2 reaches existing subscriptions. discountOffer2 is the plan’s second discount, which starts at afterCycle2. Appstle reads it from the plan when a subscription reaches that cycle, so a subscription that hasn’t reached it yet gets the new value.
  • The call doesn’t need updateProducts or deleteProducts. Leave them out, or send them empty, and the group keeps its products. The call adds products only when updateProducts has productDetails or variantDetails, or allProduct set to true. It removes products only when deleteProducts lists productIds or variantIds.
  • Send every plan, with all its fields. A plan you leave out of subscriptionPlans is deleted, and a field you leave out of a plan goes back to its default. That’s why the example sends back what GET returned.
  • Keep idNew on each plan. GET returns it. A plan sent without idNew is created as a new plan with a new ID, and the saved plan it replaced is deleted.
  • A plan with discountEnabled set to true needs a discountOffer. Without it the call returns 400 with errorKey discountOfferMissing and changes nothing.
  • The example is safe to run again. It reads the group before it changes it. Run it again after a timeout, or after a 400 with errorKey sellingPlanPublicationFailed. That error means the plan was saved, but its storefront settings weren’t published.
  • To end the sale, send the old amount. Save each plan’s discountOffer before you change it.

Build-a-Box

Use these calls to create, change and remove Build-a-Box boxes from your server. A box has two identifiers: its uniqueRef, which the Appstle app’s Build-A-Box list shows as Ref and which ends the box’s page link (https://your-store.com/apps/subscriptions/bb/<uniqueRef>), and a numeric id, which every response that returns the box carries. Store the id with the uniqueRef: while a box is off, no call finds its id from its uniqueRef. The examples use a fixed-price box (buildABoxType SINGLE_PRODUCT). The update and delete rules apply to every box type. A box with thirdPartyRule set to true belongs to the Appstle Bundles app: change it in Bundles, because each time the merchant saves the box there, Bundles sends the whole box again and replaces any change you made with these calls.

Change the choices in a box

To add or remove the choices of a parent product in a fixed-price box, use Update subscription bundling configuration. It needs no read first: you name the box by its uniqueRef and list the product IDs to add and remove, and Appstle fills in each product’s title, handle and image from Shopify. The body is an array, so one call can change several boxes. Appstle saves each box on its own, in the order you send them, so a call that fails can leave the boxes before the failing one already changed.
This call removes Dark Roast Coffee from the choices of the parent Ethiopia Coffee and adds Decaf Coffee. sourceProductId is the id of the parent’s sourceProduct. Use the variant arrays the same way to add or remove single variants, and leave the arrays you don’t need empty.
  • The call returns 200 with an empty body. An unknown babHandle or parent is skipped without an error, and a save that fails also returns 200, so read the box afterwards to check the change. A product id that doesn’t exist in Shopify returns 400 with Internal Server Error in the body.
  • It also answers 200 for a box that’s off. To check the change on a box that’s off, read it by its id with Retrieve a Build-A-Box bundle by ID. A copy of the box saved before this call, sent back with a PUT, undoes the change.

Update a box

To change anything else, such as a box’s name, limits or texts, read the box, change the fields you need, and send the whole box back with Update an existing Build-A-Box subscription bundle.
PUT /api/external/v2/build-a-box replaces the whole box with the body you send, although the reference describes a partial update. A field you leave out is cleared, and a missing uniqueRef gets a new random value, which breaks the box’s page link. Send back everything that GET returned.
Read the box with Retrieve Build-A-Box bundle details by handle. The handle is the box’s uniqueRef. The box is in bundle, next to the details of its plan group, and bundle is what you send back. To read a box that’s off, use Retrieve a Build-A-Box bundle by ID with the box’s id. It returns the box itself, without the bundle wrapper, so leave .bundle | out of the jq filters below. This example renames a box and raises the limit of one parent product, and leaves everything else as it is. It uses jq to edit the JSON between the two calls:
A successful call returns 200 with the saved box. To check the change, read the box again and print the parts you changed:
  • Send uniqueRef back. Without it, each call gives the box a new uniqueRef. The old page link stops working, and so does every cart, script and subscription line that carries the old value as _appstle-bb-id: the customer portal no longer finds the box for subscriptions already sold from it. To repair the box, send its old uniqueRef in another PUT.
  • The last save wins. If the box changes in the Appstle app between your GET and your PUT, your PUT undoes that change. Read the box just before you send it, as the example does.
  • The example is safe to run again. It reads the box before it changes it, so run it again after a timeout.
  • shop is optional. Leave it out or send your store’s .myshopify.com domain. The domain of another store returns 403 with Shop does not match the authenticated session.
  • singleProductSettings is a JSON string. In a fixed-price box, it holds one entry per parent product. Parse it, change the entry you need, and turn it back into a string, as the fromjson and tojson steps do. To change one parent’s choices, replace that entry’s products array. Fixed-price box: Step 1 explains each field. Entries that the Appstle app saves also carry imageSrc, status and sku, so copy a whole entry when you reuse a choice. A box page shows its product images without them.
  • The call doesn’t check product IDs or subscriptionId. A product id that doesn’t exist in Shopify saves without an error, so take the IDs from Shopify first, for example from /products/<handle>.js on the storefront. A subscriptionId that isn’t one of your plan groups saves too, but GET by handle then answers 404 even while the box is on.
  • sellingPlanIds is a separate setting. It’s a JSON string that maps a parent product’s id to the selling plan IDs the box page offers for that parent, for example {"15386745176368": ["692928545072"]}. The Appstle app saves the IDs as strings. A parent with no entry, or with an empty list, gets every plan in the box’s plan group. Changing singleProductSettings doesn’t change sellingPlanIds, so send back the value that GET returned.
  • GET by handle answers 404 while the box is off. Read a box that’s off with Retrieve a Build-A-Box bundle by ID instead. It returns the box itself, with groupName (always null here) and subscriptionBundleLink (the box page link while the box is on) besides the fields of bundle, and you can send that response back with a PUT as it is.
  • A path made only of digits is an ID. GET /api/external/v2/build-a-box/{value} reads {value} as the box’s id when it has only digits, and as a uniqueRef otherwise. An id that isn’t one of your store’s boxes answers 404, and a box whose uniqueRef is only digits can be read only by its id.
When the call is refused, the response is application/problem+json, with the reason in errorKey:
  • 400 idnull: the body has no id.
  • 400 idnotfound: the id isn’t one of your store’s boxes.
  • 400 invaliddiscount: discount, or the discount of a tier in tieredDiscount, isn’t between 0 and 100.
  • 400 invalidtierdiscount: tieredDiscount isn’t a JSON array, or a tier lacks a whole-number quantity of 1 or more.
  • 403, no errorKey: shop names another store. Leave shop out, or send your own store’s domain.

Create a box

Create a new Build-A-Box subscription bundle takes the same fields as the update. Leave out id and uniqueRef: a body with the id or uniqueRef of one of your boxes overwrites that box, and the call still returns 201. subscriptionId is the id of the plan group the box uses: list the groups with Get all subscription groups. This example creates a fixed-price box that’s off, so customers can’t open it yet:
The fields the example sends:
  • name (string): the box’s name.
  • subscriptionId (number): the id of the plan group the box uses.
  • subscriptionBundlingEnabled (boolean): true opens the box page to customers.
  • buildABoxType (string): SINGLE_PRODUCT for a fixed-price box.
  • bundleRedirect (string): where the box page sends the customer after the last step. The Appstle app doesn’t save a fixed-price box without it, so a box you create without it blocks the merchant’s next edit. CART goes to the cart. The other values are CART_DRAWER, CHECKOUT, CUSTOM and NONE.
  • singleProductSettings (string): a JSON string with one entry per parent product, as in the update example.
  • sellingPlanIds (string, optional): a JSON string, as in the update bullets.
The call returns 201 with the whole new box, including its generated uniqueRef and id:
Keep the response: you need its id to read it while it’s off and to delete it, and its uniqueRef to read it by handle. To turn the box on, open it in the Appstle app, check it, select Enabled under Build-A-Box Status and save.
  • A POST isn’t safe to repeat. Each one without uniqueRef creates a new box. If a POST times out, look for the box in the Appstle app’s Build-A-Box list before you send it again.

Delete a box

Delete a Build-A-Box subscription bundle takes the numeric id and returns 204. An id that isn’t one of your store’s boxes returns 400 with errorKey unauthorized. A box that any subscription was created from, cancelled ones included, can’t be deleted: the call returns 400 with Deleting Build-A-Box is not possible, N subscriptions found. You may deactivate the Build-A-Box., where N is the count. To take such a box off the store, send it back with a PUT and subscriptionBundlingEnabled set to false.

Rate limits

The Admin API limits how many calls a store can make. Treat the numbers below as the most you should send: a call over one can get 429 Too Many Requests, with a Retry-After: 30 header and this body:
A store can also have a daily limit on immediate orders, 3 a day unless support has raised it. A call over it gets 400 with errorKey immediate_order_daily_limit_exceeded, not 429, and a retry fails the same way until midnight UTC. See Daily limit on immediate orders. Calls made with a partner token count against the store the token acts for, together with the store’s own API keys. A call with a missing, wrong or revoked key gets 401 before any limit is checked, so it never gets 429. Retrying it won’t help: fix the key. When you get a 429:
  • Wait before you retry. Wait at least the Retry-After seconds, retry, and back off further if the 429 comes back. Retrying at once keeps you over the limit.
  • Don’t retry a failing call in a loop. After five error responses an endpoint allows only 10 calls a minute, so fix the request first.
  • Limit parallel writes. Five writes in progress is the store’s total, so queue writes on your side and send a few at a time.
Customer portal calls have limits of their own: see Rate limits in the storefront guide.

Partner integrations

If you are building a platform that connects to Appstle on behalf of multiple merchants, use the Partner Integration Framework. It provides:
  • A standard connection and merchant-approval flow
  • One isolated, revocable API token per connected merchant
  • External API access without requiring each merchant to purchase API access
  • Automatic token revocation when a merchant disconnects
Your Partner Secret authenticates /api/partner/... connection calls through X-Partner-Secret. After an approved Nonce Handshake, use the issued merchant-scoped token as X-API-Key when calling /api/external/v2/.... To get onboarded, email support@appstle.com with your company name, product description, base URL, and contact email. The Partner integration guide lists the complete onboarding requirements and implementation steps.

Next steps

Webhooks

Receive real-time events when subscriptions change.

Shopify Flow

No-code automation using Shopify’s built-in workflow engine.

Klaviyo events

The events Appstle sends to Klaviyo, when each is sent and the properties it carries.

Authentication

Create, rotate, and revoke merchant API keys.

Partner integration

Connect your platform and receive scoped API tokens for merchants.