SparkLayer 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.
The SparkLayer API is a set of REST APIs that connect your backend systems, such as an ERP, CRM or iPaaS, to SparkLayer. Use them to send B2B data like price lists and stock levels, keep order history in step, and manage how customers buy.
Plan requirement
API access is available on the Pro and Enterprise plans (opens in a new tab).
Which APIs you need
Most integrations need only one or two of these APIs.
- On a platform SparkLayer integrates with, such as Shopify? SparkLayer already gets your products and customers from the platform. Start with the Pricing API, and add the Stock and Purchasing APIs if your ERP holds stock levels and order history.
- On a platform SparkLayer doesn't integrate with? Use Ignite to connect it.
If you're not sure which approach suits your integration, contact our support team to talk it through.
The APIs
| API | Use it to |
|---|---|
| Pricing API | Create price lists, set prices by SKU and calculate the price a customer pays |
| Stock API | Read, update and delete stock levels by SKU, and manage stock locations |
| Purchasing API | Keep the orders, quotes and carts customers see in My Account, with their history and payments |
| Ordering API | Build a cart for a customer, price it, and place it as an order on your eCommerce platform |
| Core API | Manage customer groups, discounts, shipping methods and settings, delete customers, and look up a customer's prices |
| Files API | Upload and download files, such as the attachments customers add to orders |
| Sync Logging API | Record when each data sync ran, and which records failed and why |
Base URLs
| Environment | Base URL |
|---|---|
| Live | https://app.sparklayer.io |
| Test | https://test.app.sparklayer.io |
All the APIs share the same base URL. Live and test hold separate data and use separate API keys: see Test mode.
Authentication
The APIs use the OAuth 2.0 client credentials flow:
- Create an API key in the Dashboard, at Settings,API (opens in your SparkLayer Dashboard in a new tab).
- Exchange its client ID and secret for an access token at
POST /api/auth/token. Tokens are valid for one hour. - Send the token as
Authorization: Bearer <ACCESS_TOKEN>, with your Site ID in theSite-Idheader, on every request.
See Authentication for the full flow, or the quickstart to make your first call.
Requests and responses
- Request and response bodies are JSON. Send
Content-Type: application/jsonwith any request that has a body. - Send a
User-Agentheader that identifies your integration, so our support team can find your requests. - Errors return an HTTP status code and a JSON body describing the problem: see Errors.
- Some list endpoints return results in pages: see Pagination.
Ignite
Ignite connects SparkLayer to an eCommerce platform it doesn't have a ready-made integration for. It works the other way round from the APIs above: instead of your code calling SparkLayer, SparkLayer calls a service you build. That service answers SparkLayer's requests, for example to create customers, work out tax and shipping, complete checkout and sync data from your platform.
Next steps
- Quickstart: make your first API request.
- Authentication: handle tokens and token expiry.
- Pricing API: the API most integrations start with.
Last updated