Audit log
litecommerce keeps an append-only audit log per tenant. It captures the events that matter for trust and debugging: admin writes, auth events, API-key changes, and platform-support access.
Each record includes the actor, the tenant, the action, the target, a timestamp, and structured metadata. The log is queryable and surfaced in a merchant-visible viewer inside the admin app, so operators can answer "who changed this?" without a database query.
Because it's append-only, audit history is a reliable source of truth — it isn't edited or deleted as a side effect of other operations.
Reading the log
GET /api/v1/merchant/audit-logsRequires an Owner or Admin membership — any other role receives 403. Results
come back newest-first in data, with a nextCursor for pagination:
{
"data": [
{
"id": "…",
"actorUserId": "…",
"action": "item.updated",
"targetType": "item",
"targetId": "9f2c…",
"metadata": { "fields": ["priceInCents"] },
"createdAt": "2026-05-17T14:02:11.000Z"
}
],
"nextCursor": "…"
}action is a namespace.verb string (e.g. item.created, settings.updated,
onboarding.step_completed). metadata shape varies by action and records
operational context for that action — settings.updated, for instance, records
only the category names that changed, not the values. It is not a redacted
field: some actions record operator-supplied input verbatim, so metadata can
contain sensitive operational context, including customer data. Treat the audit
log, and its export, as sensitive at the same level as the records it describes.
That is why read and export are Owner/Admin only. The JSON list carries
actorUserId; the actor's email is resolved only in the CSV export below
(actorEmail), not on these rows.
Filters
All optional and composable: action (substring — item. matches every item
event), targetType, targetId, actorUserId, since / until (ISO-8601),
limit (default 50, max 200), and cursor.
CSV export
GET /api/v1/merchant/audit-logs/exportSame filters and the same Owner/Admin restriction, no pagination — streams the
matched entries as a CSV attachment
(timestamp, actorUserId, actorEmail, action, targetType, targetId, metadata)
for compliance archives or spreadsheet review.
Related
- Auth & roles — the actors that show up in audit records
- Tenants & context — audit is always tenant-scoped