LianaCommerce

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.

MethodHeaderWhere you get it
Bearer token (default)Authorization: Bearer <token>Credentials in LianaAccount
API keyX-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-scopeMethods
commerce-api:readGET
commerce-api:writePOST, PUT
commerce-api:deleteDELETE

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
X-Auth-Token: <key>

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 happenedResponseWhat to do
No credentials, or an unknown or deleted API key401Send a valid key or token.
Malformed, expired or not yet valid token, or one for another shop or product401 with WWW-Authenticate: Bearer error="invalid_token"Request a new token with the shop's credentials.
The token's scope doesn't cover the method403 with error="insufficient_scope"Request a token with commerce-api or the sub-scope the method needs.
Both X-Auth-Token and Authorization: Bearer400Send only one of them.
The shop couldn't check the token's signature503Try again later.

The body of an error is JSON, as described in Requests and responses.

Last modified on