Read logs with the admin API
Query, remove, clear and download logs from a script with the primary access token.
The admin interface reads the logs through POST /api/. Your scripts can do the same with the primary access token. An API token does not work here.
Every request sends a JSON body with a schema that names the action, followed by its arguments as a query string.
Query logs
curl -H "x-token: PRIMARY_TOKEN" -H "content-type: application/json" \
-d '{"schema":"logs?type=error&fields=app,type,message&limit=1"}' \
https://logs.example.com/api/Response:
{"items":[{"app":"Demo shop","type":"error","message":"Stock check failed for order 1002"}],"count":2,"page":1,"limit":1,"pages":2}count is the number of matching logs, pages the number of pages.
Arguments
| Argument | Example | What it does |
|---|---|---|
| a field name | app=shop | Filters by app, type, schema, userid, username, message, url, ip, ua, data or id. Finds the text anywhere in the field and ignores upper and lower case. |
dtcreated | dtcreated=2026-11-19 | Filters by the day the log arrived. A range: dtcreated=2026-11-18 - 2026-11-20. |
sort | sort=app_asc | Sorts by a field, _asc or _desc. The default is dtcreated_desc, newest first. |
fields | fields=app,message | Returns only these fields. |
page | page=2 | The page to return. |
limit | limit=20 | Logs per page, at most 100. |
Each item holds id, app, type, schema, userid, username, ua, message, url, ip, dtcreated and data.
Remove logs
Pass the IDs of the logs, separated by commas:
curl -H "x-token: PRIMARY_TOKEN" -H "content-type: application/json" \
-d '{"schema":"logs_remove?id=24nap001bg51d,24nap002bg50d"}' \
https://logs.example.com/api/Response:
{"success":true}Clear all logs
curl -H "x-token: PRIMARY_TOKEN" -H "content-type: application/json" \
-d '{"schema":"logs_clear"}' \
https://logs.example.com/api/Response:
{"success":true}Download the log file
curl -H "x-token: PRIMARY_TOKEN" -o logs.nosql https://logs.example.com/api/download/See Download logs for what the file holds.