Query Events
Query your Tenant's event history. See Events for authentication, searchable history, consistency, and availability. Individual runtime-log records have their own endpoints: List Reactor Logs and List Proxy Logs.
List Events
Get a page of events for the Tenant, newest first.
Permissions
event:read
Request
data.<path> filters are not fixed request fields, so the SDKs send them as extra query parameters through each SDK's per-request options. The examples below show how.
- cURL
- Node
- C#
- Java
- Python
- Go
curl "https://api.basistheory.com/events?type=token.created&data.token.metadata.order=order-1&size=20" \
-H "BT-API-KEY: <MANAGEMENT_API_KEY>"
const events = await client.events.list(
{
type: "token.created",
startDate: new Date("2026-10-01T00:00:00Z"),
endDate: new Date("2026-10-02T00:00:00Z"),
size: 20,
},
{ queryParams: { "data.token.metadata.order": "order-1" } }
);
for await (const event of events) {
console.log(event);
}
var events = await client.Events.ListAsync(
new EventsListRequest
{
Type = "token.created",
StartDate = new DateTime(2026, 10, 1, 0, 0, 0, DateTimeKind.Utc),
EndDate = new DateTime(2026, 10, 2, 0, 0, 0, DateTimeKind.Utc),
Size = 20,
},
new RequestOptions
{
AdditionalQueryParameters = new Dictionary<string, string>
{
["data.token.metadata.order"] = "order-1",
},
}
);
await foreach (var e in events)
{
Console.WriteLine(e);
}
BasisTheoryApiClient client = BasisTheoryApiClient.builder()
.apiKey("<MANAGEMENT_API_KEY>")
.build();
SyncPagingIterable<Event> events = client.events().list(
EventsListRequest.builder()
.type("token.created")
.startDate(OffsetDateTime.parse("2026-10-01T00:00:00Z"))
.endDate(OffsetDateTime.parse("2026-10-02T00:00:00Z"))
.size(20)
.build(),
RequestOptions.builder()
.addQueryParameter("data.token.metadata.order", "order-1")
.build());
for (Event event : events) {
System.out.println(event);
}
import datetime
response = client.events.list(
type="token.created",
start_date=datetime.datetime.fromisoformat("2026-10-01T00:00:00+00:00"),
end_date=datetime.datetime.fromisoformat("2026-10-02T00:00:00+00:00"),
size=20,
request_options={
"additional_query_parameters": {"data.token.metadata.order": "order-1"}
},
)
for event in response:
print(event)
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
print(page)
startDate := time.Date(2026, 10, 1, 0, 0, 0, 0, time.UTC)
endDate := time.Date(2026, 10, 2, 0, 0, 0, 0, time.UTC)
page, err := client.Events.List(
ctx,
&basistheory.EventsListRequest{
Type: basistheory.String("token.created"),
StartDate: &startDate,
EndDate: &endDate,
Size: basistheory.Int(20),
},
option.WithQueryParameters(url.Values{
"data.token.metadata.order": []string{"order-1"},
}),
)
if err != nil {
return err
}
iter := page.Iterator()
for iter.Next(ctx) {
fmt.Println(iter.Current())
}
if err := iter.Err(); err != nil {
return err
}
Query Parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
start_date | false | date | 24 hours before end_date | Returns events whose timestamp is greater than or equal to this value. ISO 8601 with a timezone and at most millisecond precision; URL-encode a + offset as %2B. A value earlier than your searchable history is raised to the oldest visible instant. Must not be after end_date. |
end_date | false | date | Time of the request | Returns events whose timestamp is less than this value. Same format as start_date. A future value is lowered to the time of the request. |
size | false | integer | 20 | Maximum number of unique events to return, from 1 to 100. |
type | false | string | null | Exact event type, such as token.created. |
trace_id | false | string | null | Exact event trace ID. |
data.<path> | false | string | null | Exact payload value, such as data.token.metadata.order=order-1. See Filtering by Payload. |
start | false | string | null | Cursor from a previous response's pagination.next. See Ordering and Pagination. |
Equal start_date and end_date values return an empty page. Each parameter accepts a single value; unknown or repeated parameters return 400. A request accepts at most 36 query parameters. Values are limited to 1,024 characters, except start, which allows 12,000.
Filtering by Payload
Payload filters are exact, case-sensitive string equality on a dotted path under data, and multiple filters combine with AND.
- Any leaf under
datais filterable, including keys you define, such asdata.token.metadata.<key>, as long as the key uses only ASCII letters, digits, underscores, and hyphens. There is no escape syntax: a dot in a filter path always separates segments, so a key that contains a dot, a space, or any other character cannot be addressed. - Numbers and booleans compare as their string form, for example
data.destination.response.status=200. - An array path matches when any element matches. Two filters on the same array are not correlated to the same element.
- Paths are up to 256 characters, including
data., made of dot-separated segments of ASCII letters, digits, underscores, and hyphens. The combined filters are limited to 4,096 bytes.
Substring, wildcard, prefix, and case-insensitive matching are not supported, nor are numeric or date ranges on payload values, membership operators, or sorting and aggregation on payload fields. start_date and end_date apply to the event timestamp only; a date inside data matches only by exact string.
The event types and the fields in each payload are listed on Event Types. The Events API returns the event object described there, without the delivered_at wrapper. data.records.message on reactor.log and proxy.log events is also exact-match only; use List Reactor Logs or List Proxy Logs to search messages by word.
Ordering and Pagination
Events are sorted by timestamp, newest first, then by id descending. Responses use the cursor paginated object. pagination.page_size is the number of events returned, pagination.next is null when there are no more results, and no total count is returned.
To get the next page, send pagination.next as the start parameter. The cursor carries the original filters, dates, and size, so start alone is enough; if you send those parameters again, they must match. Cursors are opaque, bound to your Tenant, and valid only on the route that issued them. A short page can still have a next cursor, so keep paging until next is null.
Every page re-checks your permissions and current searchable history. History that has expired since the first page is excluded from later pages.
A single page never contains the same id twice, but the same event can appear on more than one page, after you restart a query, or in overlapping polling windows. Deduplicate by id.
A cursor can expire. The API then returns 400 with errors.start set to Invalid or expired cursor. Restart the query without 'start'. Restart the query without start.
Response
Returns a cursor paginated object with the data property containing an array of events. Returns an error if events could not be retrieved.
{
"data": [
{
"id": "ad393f80-3cc7-4f30-902f-02e239f6a039",
"tenant_id": "d87c3e57-e7e3-45e6-bfce-db5177102019",
"type": "token.created",
"timestamp": "2026-09-16T12:00:00.000Z",
"trace_id": "example-trace",
"data": {
"token": {
"metadata": {
"order": "order-1"
}
}
}
}
],
"pagination": {
"next": "opaque-cursor",
"page_size": 1
}
}
An empty or exhausted result has no cursor:
{
"data": [],
"pagination": {
"next": null,
"page_size": 0
}
}
Event Object
| Attribute | Type | Description |
|---|---|---|
id | uuid | Unique identifier of the event. |
tenant_id | uuid | The Tenant that owns the event. |
type | string | The event type, such as token.created. |
timestamp | date | When the operation happened, in ISO 8601 format. start_date and end_date filter on this field. |
trace_id | string | (Optional) Identifier that correlates related events. |
data | object | The event payload. Its shape depends on type; see Event Types. |
Errors
Errors use the Problem Details format with the application/problem+json content type. Validation errors include a field-level errors object. The same statuses apply to List Reactor Logs and List Proxy Logs.
| Status | Meaning |
|---|---|
400 | A date is malformed; start_date is after end_date; size, a filter, a path, or the resource ID is invalid; or the cursor is invalid, does not match the query, or has expired. |
401 | The credential is missing or invalid. |
403 | The Application lacks event:read (List Events) or log:read (runtime-log endpoints). |
429 | The request was rate limited. Retry after the number of seconds in the Retry-After header. |
500 | An unexpected error occurred. |
503 | The service is temporarily unavailable. Retry later. The API never returns an empty page in this case. |
An unsupported query parameter or payload path:
{
"type": "about:blank",
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "The inputs supplied to the API are invalid",
"instance": "/events",
"errors": {
"query": ["Unsupported query parameter or field path."]
}
}
An expired cursor:
{
"type": "about:blank",
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "The inputs supplied to the API are invalid",
"instance": "/events",
"errors": {
"start": ["Invalid or expired cursor. Restart the query without 'start'."]
}
}