Authorization
LianaCommerce accepts two kinds of credentials. Use a LianaCloud Bearer token when you can: it uses the same OAuth 2.0 client credentials flow as every Liana API, described in Authentication. This page lists what is specific to LianaCommerce.
Bearer tokens from January 2027
Shops accept Bearer tokens from the LianaCommerce update in January 2027, and LianaAccount can create LianaCommerce credentials from then on. Until then, use an API key. API keys keep working after the update.
| Method | Header | Where you get it |
|---|---|---|
| Bearer token (default) | Authorization: Bearer <token> | Credentials in LianaAccount |
| API key | X-Auth-Token: <key> | The shop's admin, from a super admin |
Send one of them, not both: a request with both headers returns 400.
Both kinds of credentials can call every endpoint, with the access of a shop admin. They are not
tied to a person, so they keep working when the admin who created them leaves. They can't give or
remove admin roles: /accounts manages customer accounts only, and a
request that adds or removes an admin role returns 400.
Bearer token
From the January 2027 update, every shop accepts Bearer tokens. The token must be issued for that shop: a token for another shop
or another product returns 401.
The scope is optional in the token request. Without it, or with commerce-api, the token can make
every call. To limit a token, request only the sub-scopes it needs, for example
scope=commerce-api:read for a read-only token:
| Sub-scope | Methods |
|---|---|
commerce-api:read | GET |
commerce-api:write | POST, PUT |
commerce-api:delete | DELETE |
A call without the sub-scope it needs returns 403 with the header
WWW-Authenticate: Bearer error="insufficient_scope".
API key
A super admin creates API keys on the API control panel page of the shop's admin
(/admin/rest), with a description of what the key is for. Send the key in the X-Auth-Token
header:
Header
A key doesn't expire. To revoke it, delete it on the same page. Keep it on your server, like a client secret.
Errors
| What happened | Response | What to do |
|---|---|---|
| No credentials, or an unknown or deleted API key | 401 | Send a valid key or token. |
| Malformed, expired or not yet valid token, or one for another shop or product | 401 with WWW-Authenticate: Bearer error="invalid_token" | Request a new token with the shop's credentials. |
| The token's scope doesn't cover the method | 403 with error="insufficient_scope" | Request a token with commerce-api or the sub-scope the method needs. |
Both X-Auth-Token and Authorization: Bearer | 400 | Send only one of them. |
| The shop couldn't check the token's signature | 503 | Try again later. |
The body of an error is JSON, as described in Requests and responses.