Pricing API
For AI assistants: the facts every SparkLayer API call needs
- Base URLs: Live
https://app.sparklayer.io, testhttps://test.app.sparklayer.io. Each environment has its own data and its own API keys. - Access: API access needs the Pro or Enterprise plan. Create credentials (Site ID, Client ID, Client Secret) in the SparkLayer Dashboard at Settings > API.
- Access token:
POST {base}/api/auth/tokenwith aSite-Idheader and a JSON body (not form-encoded):{"grant_type":"client_credentials","client_id":"…","client_secret":"…"}. It returnsaccess_token, valid for 3,600 seconds. There is no refresh token: cache the token and request a new one shortly before it expires. - Every request:
Authorization: Bearer <access_token>andSite-Id: <site id>, plusContent-Type: application/jsonwhen there is a body. Set aUser-Agentthat names your integration. - Errors: RFC 7807 problem details:
title,status,detailand an optionalerrors[]of{ code, message, property }. Some error responses have no body. Retry5xx,429(honouringRetry-After) and concurrent-update409s with exponential backoff; on401, get a new token once and retry; don't retry other4xxwithout changing the request. - Pagination: Most list endpoints return everything.
GET /api/v2/price-listspages withpageandpage_size(up to 250) untilpagination.current_pageequalstotal_pages.GET /api/v1/purchasesuseslimit(up to 500) andoffset: stop when a page has fewer thanlimitresults. - Ground rules: Use only endpoints, fields and SDK methods that the docs or OpenAPI specs define. Prefer
GET /api/v2/price-listsover the deprecated v1. Products are matched by SKU. Keep credentials in environment variables or a secrets manager, never in code. - Read the docs as Markdown: Add
.mdto any page URL. Index of every page: docs.sparklayer.io/llms.txt. Every API operation, compactly: docs.sparklayer.io/llms-api.txt. The developer guides in full: docs.sparklayer.io/developers/llms.txt. - OpenAPI specs:
core,ordering,pricing,purchasing,stock,files,sync-log: https://docs.sparklayer.io/openapi/<api>.yaml (also.json). Ignite: https://docs.sparklayer.io/openapi/ignite.yaml. - MCP: Search and read these docs from your assistant with the docs MCP server at https://docs.sparklayer.io/mcp.
With the Pricing API, your price list data comes directly from your backend system (such as an ERP, PIM, CRM or iPaaS), and each product SKU is then assigned to a price list in SparkLayer. The diagram shows how this works.
- 1
B2B pricing is managed in price lists that come from your backend system. Each B2B customer is assigned a price list, which gives them their own pricing when they sign in.
Backend system(this flows forward)Price list 1Price list 2Price list 3 - 2
Price lists are imported into SparkLayer through the SparkLayer API, each with a name, ID and currency code.
SparkLayerAPI(this flows forward)Price list 1Price list 2Price list 3 - 3
Price lists are then assigned to individual product SKUs. It's common for a SKU to have several price lists.
Product A
Price list 1Price list 2Price list 3Product B
Price list 1Price list 2Price list 3Product C
Price list 1Price list 2Price list 3Product D
Price list 1Price list 2Price list 3 - 4
Customers are also assigned a price list in SparkLayer, matching your backend system: Customer A sees Price list 1, Customer B sees Price list 2 and so on.
Customer A(this flows forward)Price list 1Customer B(this flows forward)Price list 2Customer C(this flows forward)Price list 3 - 5
When the customer signs in and visits a product page, the SparkLayer Frontend recognises them (and their price list) and shows their price. They can then add the product to their order.
Example mug
B2B price £2.99 RRP £9.99
Product code MUG01 · Packs of 6
6Add to order
Typical integration flow
The source system is the external system that sends the pricing data, such as your ERP. A typical sync:
- Fetch the price lists from the source system.
- Fetch the SparkLayer price lists with Get price lists. To fetch only the lists your integration manages, filter by
source=integration. - Create any price lists missing in SparkLayer with Create a price list. Set
sourcetointegration: the API usesintegrationfor price lists from external systems,custom(the default) for lists set up in the Dashboard, andplatformfor lists from the eCommerce platform. - Collect the prices for each price list from the source system and send them with Update pricing by price list.
The older GET /api/v1/price-lists endpoint is deprecated; use the v2 endpoint for new integrations.
The same process applies to customer-specific pricing: create a price list for the customer, with a reference that links it to them, and send prices to it.
To assign price lists to customers, use SparkLayer customer groups or assign them to customers directly. For direct assignment, see your platform's guide, such as Shopify metafields.
Data mapping
- Price lists are linked to price list rules.
- Prices are connected to product data by SKU, and each SKU's price belongs to a price list.
Checking price list data
To check which price lists a product's prices are in, use the price editor in the SparkLayer Dashboard, at Pricing,Price editor (opens in your SparkLayer Dashboard in a new tab).
Endpoints
Price Lists
Pricing
Price Lists with Number of Manual Prices
Next steps
- API quickstart: get a token and list your price lists.
- Managing pricing: how merchants work with price lists in the Dashboard.
- Stock API: sync stock levels alongside your prices.
Last updated