Spanish Total.js
English
Documentation For AI agents
Contents

Read logs with the admin API

Query, remove, clear and download logs from a script with the primary access token.

.md GitHub
On this page

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

ArgumentExampleWhat it does
a field nameapp=shopFilters 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.
dtcreateddtcreated=2026-11-19Filters by the day the log arrived. A range: dtcreated=2026-11-18 - 2026-11-20.
sortsort=app_ascSorts by a field, _asc or _desc. The default is dtcreated_desc, newest first.
fieldsfields=app,messageReturns only these fields.
pagepage=2The page to return.
limitlimit=20Logs 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.

Made in Europe