Sync carts from a headless store or mobile app
The Ecto API lets your own server read and update the saved cart of a logged-in customer. It is built for headless storefronts and native mobile apps, whose cart changes Ecto cannot see from your theme.
Ecto never merges two carts. The most recent version wins, whether it comes from your theme or from the API. How Ecto decides which cart to keep explains this rule in detail.
How it works
- Your app does a
GETwhen it opens, and aPUTwhen the cart changes. - The next time the customer loads your online store while logged in, on any device, Ecto restores the version saved through the API. The Ecto block must be enabled on your theme.
- When the customer changes their cart on your online store, your next
GETreturns that newer version.
The API only handles carts of logged-in customers. The customer must exist in your Shopify store.
The limits are 60 requests per minute per customer and 600 requests per minute per shop. If a customer can change their cart several times in a row, such as tapping "+" on a quantity, group these changes into one PUT.
Authentication
Generate a key in the Ecto app: API access card at the bottom of the home page, then Generate API key. The key starts with ecto_sk_ and is shown only once. A shop can have up to 5 active keys, and you can give each one a label to remember what it is for.
Send the key with every request:
Authorization: Bearer ecto_sk_your_keyKeep your key on your server. Never embed it in a mobile app, a website, or any code that runs on a customer's device. Your app talks to your server, and your server talks to Ecto.
Your server decides which customer the request is for, based on the customer it has authenticated on its side. Never pass along a customer ID sent by the app as is: anyone could then read or replace another customer's cart.
If a key leaks or needs replacing, generate a new one, deploy it on your server, then click Revoke on the old one. A revoked key stops working immediately.
A key only ever reaches the carts of the shop it belongs to. If you uninstall Ecto, your keys are revoked.
Base URL
https://app-cross-cart.frb.ioAll endpoints start with /v1. In the paths below, {id} is the Shopify customer ID, either numeric (123456789) or as a GID (gid://shopify/Customer/123456789).
Read a saved cart
GET /v1/customers/{id}/cartA customer with no saved cart returns 200 with an empty cart.
{
"customer_id": "123456789",
"lines": [
{
"variant_id": "44119131406611",
"product_id": "8011223344",
"title": "Classic Tee - Medium",
"sku": "TEE-M",
"quantity": 2,
"properties": [{ "key": "Gift note", "value": "Happy birthday" }]
}
],
"item_count": 2,
"updated_at": "2026-11-09T10:15:00Z",
"cart_token": "Z2NwLWV1cm9wZS13ZXN0MQ"
}The response has no prices. cart_token is the token you sent with your last PUT. It is null if you did not send one, or if the latest version comes from your online store.
Replace a saved cart
PUT /v1/customers/{id}/cartSend the complete cart every time. There is no add or remove call: what you send replaces what was saved, and becomes the latest version.
curl -X PUT "https://app-cross-cart.frb.io/v1/customers/123456789/cart" \
-H "Authorization: Bearer ecto_sk_your_key" \
-H "Content-Type: application/json" \
-d '{
"lines": [
{
"variant_id": "gid://shopify/ProductVariant/44119131406611",
"quantity": 2,
"properties": [{ "key": "Gift note", "value": "Happy birthday" }]
}
],
"cart_token": "Z2NwLWV1cm9wZS13ZXN0MQ",
"client_label": "iOS app",
"expected_updated_at": "2026-11-09T10:15:00Z"
}'The response has the same format as GET.
Field | Required | Description |
|---|---|---|
| Yes | The full cart, 500 lines at most. Each line has |
| No | A list of |
| No | The token of your Storefront API cart, without its |
| No | Up to 64 characters, such as |
| No | The |
To get cart_token, take the ID of your Storefront API cart, gid://shopify/Cart/<token>?key=<secret>, and send only <token>.
Prices are never accepted. Ecto reads each variant's price from Shopify, in your store's currency. Each line must be a variant of your store.
A PUT replaces the whole saved cart. Besides the lines, it removes the cart attributes and the cart discounts saved from your online store. A bundle read with GET comes back as its parent line only, so sending it back drops its components.
Sending an empty lines array saves an empty cart. If the Ecto block on your theme has "Doesn't replace cart if new one is empty" turned on, browsers keep their items. To empty the cart everywhere, use DELETE.
Empty a saved cart
DELETE /v1/customers/{id}/cartThe cart is emptied on every device, even with "Doesn't replace cart if new one is empty" turned on, just like after an order. You can send expected_updated_at and client_label in the body. The response has the same format as GET.
Errors
Errors are JSON, with a stable code and a readable message.
{ "code": "unknown_variant", "message": "Some variants do not belong to this shop.", "variant_ids": ["123"] }Status | Meaning |
|---|---|
| The key is missing, invalid, or revoked. |
| The key is not allowed to do this, or the shop is uninstalled or frozen. |
|
|
| The request is invalid: |
|
|
|
|
Orders placed in your app
By default, Ecto only listens to orders from the standard checkout. If your app places orders with another source, contact our support so we can set up your order source together. We will ask you for the JSON of a sample order.
Once it is set up, these orders empty the saved cart, count toward your Ecto revenue when the cart travelled between your store and your app, and appear as "App" in How orders travel.
Updated on: 09/11/2026
Thank you!
