Everything you need to connect an external system to a Lelaloop shop: authenticate with OAuth 2.0, then read and update products, inventory, orders and customers.
The Lelaloop Shop API lets external systems, such as an ERP, a warehouse, an accounting package or a shipping tool, work with a shop's products, inventory, orders and customers over HTTPS.
It is a REST API with resource-oriented URLs, JSON request and response bodies, and standard HTTP status codes. Every request carries an OAuth 2.0 access token that is bound to exactly one shop, so there is never a shop id in the URL.
OAuth 2.0
Authorization Code with PKCE for third-party systems, client credentials for the shop's own back office.
One shop per token
The shop owner creates the app, chooses its scopes and can disconnect it at any time.
OpenAPI 3.1
A machine-readable description for Postman, code generators and your own tooling.
Base URL and versioning
All endpoints in the reference are relative to this base URL. Always use HTTPS.
Base URL
https://lelaloop.com/api/v1
The version is part of the path (/api/v1). Within a version we may add endpoints, optional parameters and response fields, so your integration should ignore fields it does not recognise. Changes that would break existing integrations are released under a new version path.
Server-to-server only
The API does not send CORS headers, so browsers cannot call it. Call it from your backend, and never put the client secret or any token in frontend or mobile app code.
OpenAPI specification
The endpoint reference on this page is generated from the OpenAPI 3.1 document served at GET /api/v1/openapi.json. It is public and needs no token.
Go from nothing to a first successful call. This path uses the client credentials grant, which is the fastest way to try the API against your own shop.
1
Create an app
In the shop admin, open Settings › Apps & API and create an app. Pick the scopes it needs and, if you will use the authorization code flow, add your redirect URI. You receive a client_id (it starts with llc_) and a client_secret (it starts with lls_). The secret is shown only once, so store it somewhere safe right away.
2
Get an access token
Exchange the client credentials for an access token. To connect on behalf of other shop owners, use the authorization code flow instead; it is described in the Authentication section.
The API uses OAuth 2.0. An app belongs to one shop, and every token it obtains works with that shop only. Two grant types are available:
Grant
Use it when
Refresh token
Authorization code with PKCE
An external system connects to a shop and the shop owner approves the access in the browser.
Yes
Client credentials
The shop's own systems run machine to machine, with no person in the loop.
No
Endpoint
URL
Authorization page
GET https://lelaloop.com/oauth/authorize
Token endpoint
POST https://lelaloop.com/api/oauth/token
Revocation endpoint
POST https://lelaloop.com/api/oauth/revoke
The token and revocation endpoints authenticate your app with its client credentials. Send them with HTTP Basic authentication (Authorization: Basic followed by the base64 of client_id:client_secret, recommended) or as the client_id and client_secret body fields, but not both at once. The body can be application/x-www-form-urlencoded, as the OAuth standard defines, or application/json.
These two endpoints answer with plain OAuth JSON, not with the envelope used by the rest of the API, and their responses must never be cached.
Authorization code flow with PKCE
Use this flow when a shop owner connects their shop to your system. The owner approves the request in the browser and your server receives tokens without ever seeing the owner's login. PKCE is mandatory, and only the S256 method is accepted.
1. Create a code verifier, a code challenge and a state
Generate a random code_verifier (43 to 128 characters from the set A-Z a-z 0-9 - . _ ~), derive code_challenge as the base64url-encoded SHA-256 hash of the verifier, and generate a random state. Keep the verifier and the state on your server, tied to the user's session.
Must be identical, character for character, to one of the redirect URIs registered for the app.
scope
No
Space-separated scopes. They must be within the scopes configured for the app. Leave it out to request all of them.
state
Recommended
An opaque random value (up to 1024 characters) that is returned unchanged. Use it to protect against CSRF.
code_challenge
Yes
The PKCE code challenge: 43 base64url characters.
code_challenge_method
Yes
Always S256.
The shop owner signs in if needed and sees the name of your app, the shop and the requested scopes. Only an owner of the shop that created the app can approve the request.
Redirect URI rules
A redirect URI must be an absolute https URL with no fragment and no embedded credentials. Plain http is accepted only for localhost, 127.0.0.1 and [::1] during development. An app can register up to 10 redirect URIs, and matching is an exact string comparison.
3. Handle the redirect back to your app
After the decision, the browser returns to your redirect_uri. First check that state equals the value you stored. On approval you receive a code, which is valid for 5 minutes and can be used once. If the owner declines, you receive error=access_denied.
Other problems with the request come back the same way, in the error and error_description parameters: invalid_request (PKCE missing or malformed), invalid_scope and unsupported_response_type. If the client_id or the redirect_uri is wrong, there is no redirect at all: the error is shown on the authorization page, because no trusted address exists to send it to.
4. Exchange the code for tokens
From your server, call the token endpoint with the code, the same redirect_uri and the original code_verifier.
Used to obtain the next pair of tokens. Absent for the client credentials grant.
scope
The scopes actually granted, separated by spaces.
shop_id
The id of the shop the token works with. Store it next to the tokens.
A code is consumed by the first exchange attempt, even a failed one (for example a wrong redirect_uri or code_verifier). If the exchange fails, start the flow again. Presenting a code that was already used also revokes the tokens issued from it.
Refreshing tokens
An access token lives for 60 minutes. Use the refresh token to obtain a new pair without involving the shop owner.
Refresh tokens rotate. Each one works once, and every refresh returns a new refresh token that is valid for 30 days. Save the new pair before you start using it.
Using a refresh token a second time is treated as a sign of theft: the whole connection is revoked (every access and refresh token of that authorization) and the shop owner has to authorize again.
Run one refresh at a time per connection, behind a lock or a single worker. Two parallel refreshes with the same token count as reuse.
Send scope only if you want to narrow the scopes of the new tokens; scopes can never be widened. A refresh request rejected because of its parameters (for example an invalid scope) does not consume the refresh token, so you can correct it and retry with the same token.
A refresh fails with invalid_grant when the person who authorized the app is no longer an owner of the shop or their account has been disabled.
Never retry a refresh with the old token
If your code crashes or times out after sending a refresh request, the old refresh token may already be spent. Sending it again revokes the connection. Refresh shortly before the access token expires instead of on every request, and persist the response atomically.
Client credentials grant
For systems that belong to the shop itself, such as a nightly stock sync. There is no browser step: the app authenticates with its own credentials and receives an access token for its shop. scope is optional and defaults to every scope configured for the app.
The response has no refresh token. When the access token expires after 60 minutes, simply request a new one. The token acts on behalf of the person who created the app, so it stops working if that person loses access to the shop.
This grant needs nothing but the client secret. Use it only from servers you control.
Revoking access
When a shop disconnects from your system, revoke the connection by sending any of its access or refresh tokens to the revocation endpoint. Revoking one token revokes the whole connection.
curl -X POST "https://lelaloop.com/api/oauth/revoke" \
-u "llc_xxx:lls_xxx" \
-d token=llrt_xxx
The endpoint answers 200 with an empty JSON object, even when the token is unknown or belongs to another app, as RFC 7009 requires.
Shop owners can also turn an app off or disconnect it in Settings › Apps & API. Every request is checked against the current state of the token, the app and the shop, so the change takes effect immediately and your calls start failing with 401.
Credential lifetimes
Credential
Prefix
Lifetime
Notes
Client id
llc_
Permanent
Public identifier of the app. Not a secret.
Client secret
lls_
Until rotated
Shown once when it is created. Rotate it if it may have leaked.
Authorization code
llac_
5 minutes
Single use.
Access token
llat_
60 minutes
Sent as a Bearer token with every API request.
Refresh token
llrt_
30 days
Single use. Replaced by a new one on every refresh.
Tokens are opaque strings. Do not parse them or rely on their length; the prefix exists only so that secret scanners can recognise them.
The scopes of a token are re-evaluated on every request. When the shop owner removes a scope from the app, existing tokens lose it at once.
OAuth errors
The token and revocation endpoints report errors in the standard OAuth shape: an error code for your program and an error_description for you.
400 Bad Request
{
"error": "invalid_grant",
"error_description": "Authorization code is invalid, expired or already used"
}
error
HTTP
Description
invalid_request
400
A required parameter is missing or malformed, the Content-Type is not supported, or the client credentials were sent in both the header and the body.
invalid_client
401
The app is unknown or turned off, or the client secret is wrong.
invalid_grant
400
The authorization code or refresh token is invalid, expired, already used or was issued to another app; the redirect_uri or code_verifier does not match; or the person who authorized the app no longer has access to the shop.
unsupported_grant_type
400
grant_type is not authorization_code, refresh_token or client_credentials.
invalid_scope
400
A requested scope is unknown, or goes beyond what the app or the original authorization allows.
temporarily_unavailable
429
Too many token requests. Wait for the number of seconds in Retry-After (HTTP 429).
server_error
500
An unexpected failure on our side. Try again later.
When these endpoints are rate limited they answer 429 with a Retry-After header and the error temporarily_unavailable, in the same OAuth error shape.
Scopes
Scopes limit what a token can do. Each one is named after a resource and an access level: read or write. The shop owner chooses the scopes of an app, and an authorization can request any subset of them.
Scope
Allows
shop:read
Read the shop's name, domain, currency and languages.
products:read
Read products and categories.
products:write
Create, update and delete products and categories, and upload images.
inventory:read
Read stock levels.
inventory:write
Update stock levels.
orders:read
Read orders, including the customer's name, email and shipping address.
orders:write
Change order status and tracking information.
customers:read
Read customers. This is personal data.
A write scope includes the read scope of the same resource. An app with products:write does not need to request products:read.
Request the smallest set of scopes your integration needs. Shop owners are more likely to approve a short, clearly justified list.
A token can never do more than its app. The effective scopes of a request are the scopes granted to the token that the app still has.
The consent screen highlights scopes that change data or expose personal data: products:write, inventory:write, orders:read, orders:write, customers:read.
Every endpoint in the reference lists the scope it requires. A call without that scope fails with 403; data.code is insufficient_scope and data.requiredScope names the missing scope.
Authenticate every request with the access token in the Authorization header. This header is the only accepted place for a token: it is never read from the query string or from a cookie.
HTTP
Authorization: Bearer llat_xxx
Header
Description
Authorization
Required. The word Bearer, a space, then the access token.
Content-Type
Required for POST, PUT and PATCH: application/json, or multipart/form-data for image upload. Anything else is rejected with 415.
A JSON request body can be up to 2 MB; larger bodies are rejected with 413.
Response envelope
Every successful response uses the same envelope: success is always true, message is a short human-readable label and data holds the result. Endpoints that return nothing, such as a delete, omit data. Rely on the HTTP status and on data, not on the text of message.
List endpoints accept page (starting at 1) and limit (default 20, maximum 100). The data object contains items, total, page, limit and hasMore. Keep requesting the next page while hasMore is true. Most lists also accept search and a few filters; see each endpoint.
Strings of 24 hexadecimal characters. A malformed id in the path returns 404.
Money
Decimal numbers in the shop's currency, for example 39.9. Read the ISO 4217 currency code from currency in GET /shop; orders also carry their own currency field.
Dates and times
ISO 8601 strings in UTC, for example 2026-03-14T09:30:00.000Z.
Content language
Translatable text such as product names and descriptions is read and written in the shop's default language. Pass locale (for example en, vi or zh-CN) to work in another language enabled for the shop; the enabled languages are listed in locales from GET /shop. A language the shop has not enabled falls back to the default. The reference shows whether an endpoint takes locale in the query string or in the body.
Unknown fields
Responses may gain new fields over time. Ignore the ones you do not use instead of failing on them.
Every response includes an X-Request-Id header and Cache-Control: no-store. Do not cache API responses in shared caches.
Errors
Errors are reported with HTTP status codes; a failed request never answers 200. The JSON body describes the problem:
Field
Description
statusCode
The HTTP status, repeated in the body.
message
A human-readable explanation, always in English. The wording may change, so do not parse it; use data.code for automated handling.
data.code
A stable, machine-readable code. Build your error handling on this value.
data.requestId
The id of this request, identical to the X-Request-Id response header.
data.errors
Only with 422: one entry per invalid field, each with field (a dotted path such as variants.0.price) and an English message.
The body can contain other fields as well; ignore any field that is not listed here.
Status codes
HTTP
data.code
Description
400
invalid_request
The request is malformed, for example a multipart upload without its file field.
401
unauthorized
The access token is missing, invalid, expired or revoked, or the app or the shop is no longer active.
403
forbidden
The action is not permitted.
403
insufficient_scope
The token does not carry the scope the endpoint requires. data.requiredScope names it.
404
not_found
The resource does not exist in this shop, or the id is malformed.
405
method_not_allowed
The HTTP method is not supported on this path.
409
conflict
The request conflicts with existing data, such as a duplicate SKU or slug.
413
payload_too_large
The request body is too large.
415
unsupported_media_type
The Content-Type is not supported by this endpoint.
422
validation_failed
Validation failed (see data.errors), or the operation is not allowed in the current state of the resource, such as an invalid order status transition.
429
rate_limited
A rate limit was exceeded. Wait for the number of seconds in Retry-After.
500
internal_error
An unexpected error on our side. No internal detail is exposed; report the request id if it persists.
503
service_unavailable
The service is temporarily unavailable. Retry with backoff.
Handling errors
Branch on the HTTP status and on data.code. Treat codes you do not know by their status class: 4xx means the request must change, 5xx means try again later.
On 401, refresh the access token once and repeat the request. If it still fails, or the refresh returns invalid_grant, the connection has been revoked: stop calling and ask the shop owner to connect again.
Retry 500 and 503 with exponential backoff. Do not retry other 4xx responses without changing the request.
Log the X-Request-Id of failed requests and quote it when you contact support. It lets us find the exact request.
Rate limits
Requests are counted in fixed windows of 60 seconds. Several limits apply at the same time, and a request that exceeds any of them is rejected with 429.
Counted for
Limit
All requests of one app
120 requests per 60 seconds
Write requests of one app (POST, PUT, PATCH, DELETE)
60 requests per 60 seconds
All apps of one shop together
600 requests per 60 seconds
All requests from one IP address, counted before authentication
600 requests per 60 seconds
Token and revocation endpoints, per IP address
30 requests per 60 seconds
Token and revocation endpoints, per client_id
60 requests per 60 seconds
Response headers
Authenticated API responses report the state of the per-app limit, so you can pace your requests before you hit it:
Header
Description
X-RateLimit-Limit
The per-app limit of the current window.
X-RateLimit-Remaining
Requests left in the current window.
X-RateLimit-Reset
Seconds until the current window ends. This is a duration, not a timestamp.
Retry-After
Sent with 429: the number of seconds to wait before retrying. The same value is in data.retryAfterSeconds.
Wait for Retry-After seconds before sending the request again. Retrying earlier only uses up the next window.
If the header is missing, use exponential backoff with jitter and cap the number of attempts.
Watch X-RateLimit-Remaining and slow down before it reaches zero, especially in bulk jobs.
Reduce the number of calls: request the largest page size, sync only what changed, and queue writes through a single worker per shop.
Node.js
async function callApi(url, init, attempt = 0) {
const response = await fetch(url, init)
if (response.status !== 429 && response.status !== 503) return response
if (attempt >= 5) throw new Error('Still rate limited after 5 retries')
// Honour Retry-After; fall back to exponential backoff with jitter.
const retryAfter = Number(response.headers.get('Retry-After'))
const delayMs = retryAfter > 0 ? retryAfter * 1000 : 2 ** attempt * 1000 + Math.random() * 250
await new Promise(resolve => setTimeout(resolve, delayMs))
return callApi(url, init, attempt + 1)
}
Security and best practices
A checklist for taking an integration to production.
Keep secrets on the server
The client secret and all tokens belong on your backend. Never embed them in a web page, a mobile app or a public repository.
Use HTTPS everywhere
Call the API over HTTPS only, and host your redirect URI on HTTPS. Plain http is accepted for loopback addresses in development only.
Verify state and use PKCE
Generate a fresh state and code_verifier for every authorization, bind them to the user's session and reject a callback whose state does not match.
Encrypt tokens at rest
Store access and refresh tokens encrypted, with access limited to the service that needs them, and store the shop_id alongside.
Rotate a leaked secret
If a client secret may have been exposed, ask the shop owner to rotate it in Settings › Apps & API and deploy the new one immediately.
Ask for the minimum
Request only the scopes you use. Prefer read scopes when you never write, and avoid scopes that expose personal data unless you need them.
Make retries safe
The API has no idempotency keys. PUT requests and absolute updates, such as setting a variant's stock, are safe to repeat. Before repeating a POST that creates a resource after a timeout, check whether the first attempt succeeded.
Keep tokens out of logs
Never log the Authorization header, tokens, codes or the client secret. Log the request id instead.
Handle disconnection
A shop owner can disconnect your app at any time. Treat a persistent 401 as a disconnected shop, stop your jobs for it, and revoke tokens yourself when a shop leaves your system.
Respect personal data
Orders and customers contain personal data. Fetch only what you need, keep it only as long as you need it, and follow the privacy laws that apply to you and to the shop.
Endpoint reference
This section is generated from the OpenAPI specification and is written in English. Paths are relative to the base URL. Every endpoint can also answer 401, 403 and 429.
401Missing, invalid, expired or revoked access token.
403The token does not carry the required scope.
404The resource does not exist in this shop.
429Rate limit exceeded. See the Retry-After header.
PUT/products/{productId}
Replace a product
Full replacement: read the product, change what you need, send the whole object back. Keep each variant id and each option slug exactly as returned so variant history, carts and orders stay linked.
401Missing, invalid, expired or revoked access token.
403The token does not carry the required scope.
404The resource does not exist in this shop.
422Validation failed or the operation is not allowed in the current state.
429Rate limit exceeded. See the Retry-After header.
POST/media
Upload an image
Uploads one image (multipart/form-data, field file, max 15 MB) to the shop media library. Use the returned url / thumbUrl in product or category images.
401Missing, invalid, expired or revoked access token.
403The token does not carry the required scope.
404The resource does not exist in this shop.
429Rate limit exceeded. See the Retry-After header.
PATCH/orders/{orderId}/status
Change order status
Moves the order along its lifecycle: pending → confirmed → processing → shipped → delivered → completed, with cancelled / refunded branches. Invalid transitions return 422. An order paid through a payment gateway cannot be set to refunded here.