Skip to main content

Search events

GET /api/v0/events/ returns the events your team has indexed, newest first. It accepts one filter vocabulary, shared with export requests and the log in the app, so a filter written once behaves the same everywhere. The endpoint itself is documented on Events list; this page covers how to use it.

An event in the response is the read shape of an envelope: id, trail, event, created_at (the producer's timestamp), received_at (when Santati indexed it), organization_id, actor, targets, metadata, data, context, hash and schema_version. See The event envelope for how those values were sent.

Filters​

Any subset of the parameters below may be sent. Absent and empty parameters do not filter.

ParameterValueMeaning
trailstring, at most 64 charactersOnly events from this trail. A key scoped to other trails is refused.
eventstring, at most 255 charactersExact event type, for example invoice.voided.
event_prefixstring, at most 255 charactersEvents whose type starts with this literal prefix.
organization_idstring, at most 255 charactersExact producer organization id.
actor_idstring, at most 255 charactersExact actor id.
actor_typeuser, system, agent or anonymousActor kind.
created_afterRFC 3339 instant or bare dateInclusive lower bound on the producer's created_at.
created_beforeRFC 3339 instant or bare dateInclusive upper bound; may not be earlier than created_after.
target_typestring, at most 64 charactersEvents acting on a target of this type.
target_idstring, at most 255 charactersEvents acting on this target id.
metadata.<key>string, at most 500 charactersRepeatable, at most 10 keys. Matches events whose metadata holds this key with this exact string value.
qstring, at most 200 charactersFull-text search over the indexed payload; see Full-text search.
sortoccurred_at or relevanceOrdering. Defaults to occurred_at; relevance requires q.
cursoropaque stringPage marker from the previous response's next. Send it back verbatim.
limitintegerPage size. Defaults to 100, maximum 1000.

Rules that apply to every request:

  • A single-value parameter takes exactly one value. Repeating one is a 400 with code invalid and the parameter under fields, for example {"trail": ["Give this filter a single value."]}.
  • A timestamp must carry a UTC offset, or be a bare date read as midnight UTC. A timestamp with a time but no offset is refused rather than guessed, because guessing would silently shift a compliance query.
  • A value longer than its limit is a 400 naming the parameter under fields, for example {"event_prefix": ["At most 255 characters."]}.
  • Parameter names outside the vocabulary are ignored on this endpoint, so appending a tracking parameter is harmless. Exports are stricter and refuse them, because a stored filter set that quietly ignores a name would lie.

Parameter spelling is exact and matching is exact (and case-sensitive): there is no normalisation and no prefix matching except the event_prefix parameter.

Targets​

target_type and target_id together must hold of the same target row, so target_type=invoice plus target_id=inv_4471 matches events that acted on that one invoice, not events that acted on a different invoice and on some other invoice-typed target. Either parameter alone matches events with any target of that type, or with that id, respectively.

Metadata​

metadata.<key> filters on a JSON containment test, so it matches events whose metadata holds <key> with exactly the string value given. Keys are at most 40 characters of A-Z a-z 0-9 _ . - and may not contain __. Each pair is its own AND term, so repeating one key with two different values matches nothing; use distinct keys to combine conditions. More than 10 keys is a 400.

curl -G https://api.santati.io/api/v0/events/ \
-H "Authorization: Api-Key $SANTATI_API_KEY" \
--data-urlencode "trail=billing" \
--data-urlencode "metadata.department=finance"
{
"next": null,
"previous": null,
"results": [
{
"id": "01J9Z6Q0F2M8R4T7V1W3X5Y7Z9",
"trail": "billing",
"event": "invoice.voided",
"created_at": "2026-09-30T10:15:00Z",
"received_at": "2026-09-30T10:15:02.418773Z",
"organization_id": "org_acme",
"actor": {
"type": "user",
"id": "user_17",
"name": "Ada Lovelace",
"metadata": { "email": "ada@acme.test" }
},
"targets": [
{ "type": "invoice", "id": "inv_4471", "name": "INV-4471", "metadata": {} }
],
"metadata": { "department": "finance" },
"data": { "before": { "status": "open" }, "after": { "status": "voided" } },
"context": { "request_id": "req_9f2c" },
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"schema_version": 3
}
]
}

q runs over the event's stored payload through a pg_catalog.simple index, so there is no English stemming: inv, invoice and invoiced stay distinct tokens, which is what identifier search needs. The value is sanitised to runs of letters and digits, each becoming a prefix term, and the terms are ANDed: inv_555 refund searches for inv:* and 555:* and refund:*. A dot inside a run is kept, so invoice.voided searches for that whole lexeme.

q must hold at least one letter or digit, and at most 200 characters. A q with no searchable term is a 400 (Enter at least one letter or digit to search for.) rather than an ignored parameter, because dropping it would answer a search with every event. q composes with every other filter by AND.

Sorting​

The default order is newest first by producer timestamp, tie-broken by id (occurred_at, descending). sort=relevance ranks matches against q by text rank, then by the same timestamp and id tie-breakers. sort=relevance without q is a 400 ({"sort": ["Relevance ordering requires q."]}), because there would be nothing to rank against. Export files are always ordered by timestamp and id — a sort=relevance in an export's query is dropped.

Pagination​

Every list response has the same cursor shape: {"next", "previous", "results"} and no count, so you are never handed a total that is already stale. limit defaults to 100 and is capped at 1000. Under the default occurred_at ordering the cursor is stable under concurrent writes.

sort=relevance pages by an opaque offset cursor over a total order, bounded to the first 10,000 matches. Once the window is exhausted next is null instead of paging forever, and a cursor that points at or past the window is a 400 (Relevance paging stops at the first 10000 matches.). Under sort=relevance a malformed or negative cursor is a 400 with Invalid cursor under cursor; under the default ordering a malformed cursor is a 404 with code not_found and the message Invalid cursor.

Follow next verbatim. It is an absolute URL that already carries your filters, the limit and the cursor, so nothing needs to be re-encoded.

Iterate every page​

This loop walks the whole result set by following next until it is null:

url="https://api.santati.io/api/v0/events/?trail=billing&limit=100"
while [ -n "$url" ]; do
page=$(curl -sS -H "Authorization: Api-Key $SANTATI_API_KEY" "$url")
echo "$page" | jq -r '.results[] | [.created_at, .event, .id] | @tsv'
url=$(echo "$page" | jq -r '.next // empty')
done

jq -r '.next // empty' turns the final null into an empty string, which ends the loop. For a very large read, an export is cheaper than paging.

Examples​

One trail, one event type, a time window​

curl -G https://api.santati.io/api/v0/events/ \
-H "Authorization: Api-Key $SANTATI_API_KEY" \
--data-urlencode "trail=billing" \
--data-urlencode "event=invoice.voided" \
--data-urlencode "created_after=2026-09-01T00:00:00Z" \
--data-urlencode "created_before=2026-09-30T23:59:59Z"
{
"next": "https://api.santati.io/api/v0/events/?cursor=cD0yMDI2LTA5LTMwVDEwOjE1OjAwWg&limit=100&trail=billing",
"previous": null,
"results": [
{
"id": "01J9Z6Q0F2M8R4T7V1W3X5Y7Z9",
"trail": "billing",
"event": "invoice.voided",
"created_at": "2026-09-30T10:15:00Z",
"organization_id": "org_acme"
}
]
}

Everything one actor did​

curl -G https://api.santati.io/api/v0/events/ \
-H "Authorization: Api-Key $SANTATI_API_KEY" \
--data-urlencode "actor_type=user" \
--data-urlencode "actor_id=user_17" \
--data-urlencode "limit=1000"
{
"next": null,
"previous": null,
"results": [
{
"id": "01J9Z6Q0F2M8R4T7V1W3X5Y7Z9",
"event": "invoice.voided",
"created_at": "2026-09-30T10:15:00Z",
"actor": { "type": "user", "id": "user_17", "name": "Ada Lovelace", "metadata": {} }
}
]
}

Full-text search, ranked​

curl -G https://api.santati.io/api/v0/events/ \
-H "Authorization: Api-Key $SANTATI_API_KEY" \
--data-urlencode "q=invoice.voided refund" \
--data-urlencode "sort=relevance" \
--data-urlencode "limit=50"

The body has the same shape, with results ordered by text rank instead of purely by time.

Following a cursor​

curl -G https://api.santati.io/api/v0/events/ \
-H "Authorization: Api-Key $SANTATI_API_KEY" \
--data-urlencode "trail=billing" \
--data-urlencode "cursor=cD0yMDI2LTA5LTMwVDEwOjE1OjAwWg"
{
"next": "https://api.santati.io/api/v0/events/?cursor=cD0yMDI2LTA5LTMwVDEwOjE2OjAwWg&trail=billing",
"previous": "https://api.santati.io/api/v0/events/?cursor=cD0yMDI2LTA5LTMwVDEwOjE0OjAwWg&trail=billing",
"results": [
{
"id": "01J9Z6Q0F2M8R4T7V1W3X5Y7Z9",
"trail": "billing",
"event": "invoice.voided",
"created_at": "2026-09-30T10:15:00Z"
}
]
}

Statuses​

StatusWhen
200The page was returned.
400A filter value failed validation. Code invalid; fields names every offending parameter, including cursor for a bad sort=relevance cursor or one past the relevance window.
403The key is missing, malformed, revoked, expired, or not scoped to the requested trail. Code permission_denied, or trail_not_allowed for a trail the key may not read.
404A malformed cursor under the default occurred_at ordering. Code not_found.

Every error uses the shared envelope, {"error": {"code", "message", "field", "fields"}}: see Errors.