LianaCMS

Authorization

The LianaCMS REST API accepts two kinds of credentials. Send one of them with every request, never both: a request with both returns 400.

  1. OAuth 2.0 Bearer token (recommended): Authorization: Bearer <token>, from LianaCloud credentials.
  2. CMS API token: X-Auth-Token: <token>, created in the CMS admin.

Bearer tokens from January 2027

LianaCMS accepts Bearer tokens from its update in January 2027, and LianaAccount can create LianaCMS credentials from then on. Until then, use a CMS API token. CMS API tokens keep working after the update.

Admin session cookies and the API keys of the REST API v1 and v2 don't work on v3.

Whichever you use, the request runs as one CMS user and has exactly that user's rights. An item the user may not see returns 404, and an action the user may not do returns 403.

OAuth 2.0 Bearer token

LianaCMS uses the same OAuth 2.0 client credentials flow as every Liana API. Authentication explains how to create credentials in LianaAccount, request a token and handle its errors. This section lists what is specific to LianaCMS.

Where it works

From the January 2027 update, Bearer tokens work on LianaCMS sites whose admins sign in through LianaCloud, and only there. Not every site does: some still use their own single sign-on, or user names and passwords of the CMS. Those sites return 401 with the message this site does not accept bearer tokens; use a CMS API token there. If you don't know how a site's admins sign in, ask its administrator.

Credentials belong to a person

In other Liana products, credentials belong to the application. LianaCMS credentials belong to the LianaCloud user who created them, and every request made with them runs as that user's CMS account, with its rights on the site.

  • The creator must have signed in to the site through LianaCloud at least once, so that the CMS knows their account. Until then, requests return 403.
  • If the creator's CMS account is deactivated or loses its rights on the site, requests return 403.
  • Changes to the creator's groups in LianaCloud take effect in the CMS when they next sign in.
  • Only the creator can rotate the secret. If the creator loses access to the site, their credentials are deleted.

For an integration, consider creating the credentials as a dedicated user that has only the rights the integration needs.

Scopes

The scope is optional in the token request. Without it, or with cms-api, the token can make every call the user may make. To limit a token, request only the sub-scopes it needs, for example scope=cms-api:read for a read-only token:

Sub-scopeMethods
cms-api:readGET
cms-api:writePOST, PATCH
cms-api:deleteDELETE

A call without a scope that covers its method returns 403 with WWW-Authenticate: Bearer error="insufficient_scope".

Errors

What happenedResponse
Malformed, expired or not yet valid token, or a token for another site401 with WWW-Authenticate: Bearer error="invalid_token"
No scope that covers the method403 with WWW-Authenticate: Bearer error="insufficient_scope"
The creator hasn't signed in to the site, is inactive or has no rights on it403, with the reason in message
Both Authorization and X-Auth-Token sent400
The site can't fetch the token issuer's keys503. Try again later.

CMS API token

A CMS API token works on every LianaCMS site.

  1. Log in to the CMS admin as a main administrator. Only main administrators can create tokens.
  2. Open Preferences → API key and create a token. Give it a name, and an expiry date if you want it to stop working after that day. Leave the scopes empty, or select rest:v3.
  3. Copy the token. It is shown only once.

The token belongs to the user who created it and runs every request as that user. Deleting it in the admin revokes it immediately.

A token with scopes but without rest:v3 returns 403, and so do tokens issued to MCP apps. A malformed, unknown, revoked or expired token returns 401.

Failed attempts

After 100 failed authentication attempts from one address in five minutes, requests from that address return 429 with Retry-After, the number of seconds to wait. Expired tokens and missing rights don't count as failed attempts.

Calling from a browser

The API allows requests from any origin (CORS), with both the Authorization and X-Auth-Token headers. Never put LianaCloud client secrets or CMS API tokens in browser code that others can read.

Last modified on