REST API
Two surfaces, one shape. Public endpoints are safe to call from the browser; private endpoints are authenticated with a secret key and run on your server.
Full reference is generated from OpenAPI
Introduction
The public API powers the widget and any custom storefront. The private API powers your dashboard and server-side integrations. Both speak JSON and share the same casing, error, pagination, and timestamp conventions - the differences are the base URL, the auth key, and what you're allowed to do.
curl https://api.shoprocket.io/v3/public/pk_live_.../cart \
-H "X-Cart-Token: any-random-string"curl https://api.shoprocket.io/v3/private/products \
-H "Authorization: Bearer sk_live_..."Base URLs
Public endpoints are scoped to a store via your publishable key in the path. Private endpoints identify the store via your secret key in the Authorization header. Endpoint paths below omit the base URL and key, e.g. GET /cart means GET /v3/public/{pk}/cart.
https://api.shoprocket.io/v3/public/{publishable_key}
https://api.shoprocket.io/v3/privateAuthentication
Use a publishable key (pk_) for the public API and a secret key (sk_) for the private API. Public cart endpoints additionally require an X-Cart-Token header to identify the visitor session. See the authentication guide for full detail.
Authorization: Bearer {your_key}
X-Cart-Token: {visitor_cart_token} # public cart endpoints onlyConventions
- All request and response bodies are JSON; keys are camelCase.
- Money is an object with a minor-unit
amount, acurrency, and aformattedstring. - IDs are type-prefixed (
prod_,ord_,cus_); timestamps are ISO 8601 UTC.
"total": {
"amount": 4200,
"currency": "USD",
"formatted": "$42.00"
}Errors
Errors use standard HTTP status codes and a consistent body with a machine-readable code.
{
"error": {
"code": "cart_item_out_of_stock",
"message": "That product is out of stock."
}
}Pagination
List endpoints are cursor-paginated. Pass ?limit and ?cursor; the response includes a nextCursor when more results exist.
{
"data": [ /* … */ ],
"hasMore": true,
"nextCursor": "cur_abc123"
}Get store
/storePUBLICReturns the store's public profile: name, currencies, languages, and theme settings.
{
"id": "str_123",
"name": "Acme Goods",
"currencies": ["USD", "EUR"],
"defaultCurrency": "USD"
}Get cart
/cartPUBLICAuthReturns the current cart for the supplied X-Cart-Token, creating an empty one if the token is new.
{
"id": "cart_123",
"items": [],
"total": { "amount": 0, "currency": "USD" }
}Add item
/cart/itemsPUBLICAuthAdds a product (and optional variant) to the cart.
| Field | Type | Description |
|---|---|---|
productIdrequired | string | The product to add. |
variantId | string | A specific variant, if the product has options. |
quantity | integer | Defaults to 1. |
curl -X POST .../cart/items \
-H "X-Cart-Token: 8f3c…" \
-d '{ "productId": "prod_123", "quantity": 1 }'Cart
/cart/items/{id}PUBLICChange the quantity of a line item.
/cart/items/{id}PUBLICRemove a line item from the cart.
/cart/discountPUBLICApply a discount code to the cart.
/cart/discountPUBLICRemove the applied discount.
/cart/estimatePUBLICEstimate tax and shipping before checkout.
/cart/shipping-optionsPUBLICAvailable shipping options for the cart's address.
/cart/shippingPUBLICChoose a shipping option.
/cart/checkoutPUBLICRead the current checkout state.
/cart/checkoutPUBLICSave customer and address details.
/cart/checkout/submitPUBLICPlace the order and start payment.
Customer auth
/customers/checkPUBLICPlannedCheck whether an email has an account.
/customers/auth-linkPUBLICPlannedEmail a passwordless sign-in link.
/customers/verifyPUBLICPlannedExchange an auth token for a session.
/customersPUBLICPlannedCreate a customer account.
/customers/statusPUBLICPlannedWhether the current visitor is signed in.
/customers/mePUBLICPlannedThe signed-in customer's profile.
/customers/mePUBLICPlannedUpdate the customer's profile.
/customers/me/ordersPUBLICPlannedThe customer's order history.
/customers/me/orders/{id}PUBLICPlannedA single order for the customer.
/customers/logoutPUBLICPlannedEnd the customer session.
Products
/productsPUBLICThe catalogue, filterable and paginated.
/products/{id}PUBLICA single product with variants and media.
/products/{id}/reviewsPUBLICReviews for a product.
/products/{id}/reviewsPUBLICSubmit a product review.
Categories
/categoriesPUBLICAll product categories.
/categories/{id}PUBLICA single category.
Tax & payments
/tax/calculatePUBLICTax for a given basket and address.
/payment-methodsPUBLICEnabled payment methods for the store.
Conversations
/conversationsPUBLICPlannedOpen a storefront chat conversation.
/conversations/currentPUBLICPlannedThe visitor's active conversation.
/conversations/{id}/messagesPUBLICPlannedMessages in a conversation.
/conversations/{id}/messagesPUBLICPlannedSend a message from the visitor.
Feeds
/feeds/productsPUBLICGoogle/Meta product feed, one URL per platform and locale.
Products
/productsPRIVATEPlannedAll products, including drafts.
/productsPRIVATEPlannedCreate a product.
/products/{id}PRIVATEPlannedUpdate a product.
/products/{id}PRIVATEPlannedDelete a product.
/products/{id}/stockPRIVATEPlannedAdjust inventory levels.
Orders
/ordersPRIVATEPlannedAll orders, filterable.
/orders/{id}PRIVATEPlannedA single order.
/orders/{id}/fulfilPRIVATEPlannedMark an order fulfilled / shipped.
/orders/{id}/refundPRIVATEPlannedRefund an order in full or part.
/orders/{id}/cancelPRIVATEPlannedCancel an order.
Customers
/customersPRIVATEPlannedAll customers.
/customers/{id}PRIVATEPlannedA single customer.
/customers/{id}PRIVATEPlannedUpdate a customer.
Webhooks
/webhooksPRIVATEPlannedRegistered webhook endpoints.
/webhooksPRIVATEPlannedRegister a webhook endpoint.
/webhooks/{id}PRIVATEPlannedRemove a webhook endpoint.