Skip to content
Browse API reference

Search Events

Search for events

Request

POST https://api.castle.io/v1/events/query

Request body

filters
required
object[] or object

Either a list of filters or a filter tree ({ "$and" | "$or": [...] }). A tree can nest $and and $or groups, for example (A OR B) AND (C OR D), which the list form cannot express.

query_type
stringDefault: $records_with_count

The type of query to perform.

  • $count returns the number of records matching the query (total_count will be present and data will be empty)
  • $records returns the records matching the query (total_count will be 0)
  • $records_with_count returns the number of records matching the query and the records matching the query
$count$records$records_with_count
page
integer
aggregations
object[]

EXPERIMENTAL! Array of aggregations to include in the response. For each aggregation, you can reference its name in the columns, sort, and having fields.

formulas
object[]

EXPERIMENTAL! Array of formulas to include in the response. For each formula, you can reference its name in the columns, sort, and having fields.

columns
string[]

Field names to return. Consult the Events Schema API for the list of available fields. When set, only these fields are returned. When omitted, all fields are returned.

results_size
integer

Response

200
object

Returns the events that match the search criteria

401
No body

You are missing the Authorization header, or the API secret is missing or incorrect.

403
No body

The request is rejected because the service is not enabled for this account.

422
object

The request body is unprocessable by the API. Make sure it conforms to the specified format for the endpoint.

500
No body

There’s an issue on our end.