API version v1
Build on Storelancer
Apps connect to stores with OAuth 2.0, read and write store data with the Admin API, and react to events with webhooks. Themes are declarative design packages merchants apply in one click.
Overview
- Authorize URL
https://storelancer.com/oauth/authorize - Token URL
https://storelancer.com/api/oauth/token - Admin API
https://storelancer.com/api/v1/ - Store identifier
shop = the store handle, e.g. acme-shoes
Create an app in the developer portal to get a client_id (slc_…) and a client_secret (sls_…). The secret is shown once; keep it on your server only.
1. Install flow
When a merchant clicks Install in the App Store, we send them to your App URL with signed parameters:
GET https://your-app.example/?shop=acme-shoes×tamp=1767225600&hmac=3b1f…
Verify the request before doing anything: sort all parameters except hmac by name, join them as key=value with &, compute HMAC-SHA256 with your client secret, compare in constant time, and reject timestamps older than 5 minutes.
import crypto from "node:crypto";
function verify(query, secret) {
const { hmac, ...rest } = query;
const msg = Object.keys(rest).sort().map((k) => `${k}=${rest[k]}`).join("&");
const digest = crypto.createHmac("sha256", secret).update(msg).digest("hex");
const ok = hmac && crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(hmac));
return ok && Math.abs(Date.now() / 1000 - Number(rest.timestamp)) < 300;
}Then redirect the merchant to the authorize URL (step 2).
2. OAuth authorization
https://storelancer.com/oauth/authorize ?client_id=slc_… &scope=read_products,write_products,read_orders &redirect_uri=https://your-app.example/auth/callback &state=<random, stored in the user's session> &shop=acme-shoes
redirect_urimust exactly match one of your registered redirect URLs. Otherwise we show an error and never redirect.scopemust be a subset of the scopes declared in your app (and approved in review). Omit it to request all declared scopes.stateis required. Check it on the callback to prevent CSRF.
The merchant sees your icon, the permissions and (for paid apps) your plans. If they approve — and pay, for a paid plan — we redirect to your callback:
https://your-app.example/auth/callback?code=…&state=…&shop=acme-shoes×tamp=…&hmac=…
Verify the hmac (same method as above) and the state. If the merchant cancels you receive error=access_denied&state=….
3. Token exchange
Exchange the code from your server within 10 minutes. Codes work once: replaying a code revokes the token issued from it.
curl -X POST https://storelancer.com/api/oauth/token \
-H "Content-Type: application/json" \
-d '{"client_id":"slc_…","client_secret":"sls_…","code":"…"}'
{ "access_token": "slat_…", "token_type": "bearer", "scope": "read_orders,read_products,write_products", "shop": "acme-shoes" }Store the access token encrypted. It works until the merchant uninstalls the app (you receive app/uninstalled), the plan isn't paid, or the app is suspended.
4. Admin API
JSON over HTTPS. Send Authorization: Bearer slat_…. Money is in minor units (cents). Limit: 240 requests per minute per store (HTTP 429 with Retry-After).
| Endpoint | Scope |
|---|---|
| GET /shop | read_store |
| GET /products?limit&page&status&q&updated_since | read_products |
| GET /products/{id} | read_products |
| POST /products | write_products |
| PATCH /products/{id} | write_products |
| DELETE /products/{id} | write_products |
| POST /variants/{id}/inventory {mode: delta|set, quantity} | write_inventory |
| GET /orders?limit&page&financial_status&created_since&created_before | read_orders |
| GET /orders/{id} | read_orders |
| POST /orders/{id}/fulfillments {line_items, carrier, tracking_number, tracking_url} | write_orders |
| GET /customers?limit&page&q | read_customers |
| GET /customers/{id} | read_customers |
curl -X POST https://storelancer.com/api/v1/products \
-H "Authorization: Bearer slat_…" -H "Content-Type: application/json" \
-d '{"title":"Canvas Tote","status":"active","variants":[{"price":1500,"sku":"TOTE-1","inventory_quantity":20}]}'Errors: {"error":{"code":"insufficient_scope","message":"…"}} with status 400, 401 (bad token), 402 (plan not paid / uninstalled), 403 (scope or suspended), 404, 422 (validation, with fields), 429.
Scopes
Write scopes include the matching read scope. Ask only for what your app needs — reviewers check this.
read_storeSee your store name, currency, languages and contact emailread_productsSee products, variants, prices and collectionswrite_productsCreate and edit products and pricesread_inventorySee stock levelswrite_inventoryChange stock levelsread_ordersSee orders, including customer names, emails and addresseswrite_ordersMark orders as shipped and add tracking numbersread_customersSee customers and their contact details
5. Webhooks
Set a webhook URL (https, public address) and topics in your app. A topic is only delivered if the store granted its scope.
- orders/create · read_orders
- orders/paid · read_orders
- orders/fulfilled · read_orders
- orders/cancelled · read_orders
- products/create · read_products
- products/update · read_products
- products/delete · read_products
- app/uninstalled
Each POST has the JSON payload and these headers: X-Storelancer-Topic, X-Storelancer-Shop, X-Storelancer-Webhook-Id (use it to de-duplicate), X-Storelancer-Hmac-Sha256. Answer with any 2xx within 10 seconds; failures are retried up to 8 times with exponential backoff. We don't follow redirects.
const raw = await readRawBody(req); // the exact bytes received
const digest = crypto.createHmac("sha256", CLIENT_SECRET).update(raw).digest("base64");
const ok = crypto.timingSafeEqual(Buffer.from(digest), Buffer.from(req.headers["x-storelancer-hmac-sha256"]));On app/uninstalled, delete the store's access token and stop processing its data.
6. Embedded apps
If your app is embedded, merchants open it inside the dashboard. We load your App URL in a sandboxed frame with shop, timestamp, hmac and session — an HS256 JWT signed with your client secret, valid for 60 seconds:
{ "iss": "https://storelancer.com", "dest": "acme-shoes", "aud": "slc_…", "sub": "<merchant user id>",
"store_id": "…", "iat": 1767225600, "nbf": 1767225595, "exp": 1767225660, "jti": "…" }Verify the signature, aud (your client ID) and exp, then start your own session for the store in dest. Your pages must allow being framed by https://storelancer.com (Content-Security-Policy: frame-ancestors https://storelancer.com).
7. Billing & payouts
Apps are free or offer up to 3 paid plans (monthly or yearly, USD, optional free trial of up to 60 days; a free plan can sit next to paid ones). Merchants pick a plan on the permission screen and pay Storelancer by card. The access token only works while the plan is active or in trial; if a payment fails or the merchant cancels, the API returns 402 until a plan is paid again.
For each paid invoice and theme sale you earn the price minus a 15% platform commission. Balances appear in Earnings and are paid out monthly to the PayPal or bank account in your settings.
8. Themes
A theme is declarative, so it can't run code on a store: a base layout, design settings (colours, fonts, corner radius, buttons, layout options) and a list of home page sections using the same settings as the store builder. Images and collections are left for each merchant to choose. Themes are free or have a one-time price; merchants apply them to their draft design and publish when ready.
9. Review & security rules
- Request the minimum scopes. Explain in your listing why you need each one.
- Store access tokens and customer data encrypted; never log them; delete a store's data within 30 days of
app/uninstalledunless the merchant asks otherwise. - Verify every HMAC and session token. Use HTTPS everywhere.
- Have a privacy policy that says what you store, why and for how long.
- Don't misrepresent your app, its pricing or Storelancer. Don't charge merchants outside the plans you list.
- Every new version is reviewed before merchants see it; the approved version stays live meanwhile.
Developer terms
- You may use store data only to provide your app's features to the merchant who installed it, and must follow applicable data-protection law (including GDPR where it applies).
- You are responsible for your app, its security and your support to merchants. Respond to support requests within 2 business days.
- Storelancer may review, reject, suspend or remove any app or theme, and revoke API access, to protect merchants and their customers.
- Paid plans and themes are billed by Storelancer. You receive the amount paid minus the platform commission (15% currently), paid out monthly.
- The API is provided as is; we'll announce breaking changes at least 90 days in advance.