Introduction
The LianaCMS REST API v3 lets your applications read and edit the users, categories, news, events, products and contacts of a LianaCMS site, read forms and their submissions, and create or update many items at once with batch requests.
Every request runs as a CMS user and has exactly that user's rights. Authorization explains which user that is and how to get a token.
API URL
Each site serves the API from its own domain:
API URL
{domain} is any domain of your LianaCMS site, for example https://www.example.com/api/v3. The
links in responses (href, next and so on) use the site's main domain.
Try it in the API reference
Each endpoint in the API reference has a Test button that sends the request from your browser to
your site. First enter your site's domain under Server, then add your token under Headers:
X-Auth-Token, or, from the January 2027 update, Authorization with Bearer <token>. The requests act on your live site, so use a
token with only the cms-api:read scope, or a test site.
Requests
- Send request bodies as JSON with
Content-Type: application/json. APOSTorPATCHwithout a body returns400, and so does a body whose content type is notapplication/json,text/plainorapplication/octet-stream. - Filters go in the query string. A filter that takes several values is sent with brackets, for
example
categories[]=3&categories[]=7. Sending such a filter without the brackets returns400. - Different filters must all match. The values of one filter are alternatives: any of them matches.
- Parameters an endpoint doesn't know are ignored. A parameter with an invalid value returns
400. - There are no sorting parameters.
- An unsupported method on an existing path returns
403, never405.
Responses
Responses are JSON and are never cached. Every response has meta.response_at, the time of the
response. A list returns its items in items, the address of the request in href, and links to the
first, prev and next pages. There is no total count. Responses may also contain other keys with
the value null; ignore them.
Paging
| Parameter | Default | Values |
|---|---|---|
limit | 20 | 0–200. Another value returns 400. |
offset | 0 | A negative value is treated as 0. |
On the last page, next points back to the first page. Stop when a page returns fewer items than
limit.
Batch requests
The Batch endpoints take a JSON array of items and return 202 with an href to the
background job in the Job Queue. When the job is done, the job's address
redirects (303) to the batch result, which lists the items that were rejected.
Status codes
| Status | Meaning |
|---|---|
200 | Success. |
202 | A batch request was accepted and runs in the background. |
303 | A finished background job: follow Location to its result. |
400 | Invalid parameter, identifier or body. details says what was wrong. |
401 | No credentials, or credentials that are invalid, revoked or expired. |
403 | The user lacks the right, the module is not in use, the method is not supported, or the token is refused. |
404 | The item doesn't exist, or the user may not see it. |
429 | Too many failed authentication attempts from your address. Wait for Retry-After seconds. |
503 | Bearer tokens can't be checked right now. Try again later. |
Errors
An error returns:
Code
code is the HTTP status and message a stable description. details is more specific and appears
only on some 4xx errors, never on 404.
Limits
The API has no request rate limit, but after 100 failed authentication attempts from one address in
five minutes, requests from that address return 429 with Retry-After. Batch requests have no size
limit of their own; the web server's request size limit applies.