Search Events
Search for events
Request
https://api.castle.io/v1/events/query Request body
filters | object[] or object Either a list of filters or a filter tree ( |
One of | |
Option 1 | object[] |
Option 2 | object A filter tree node. Set exactly one of |
$and | object[] |
One of | |
Option 1 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $in$nin$eq$neq$like$nlike$contains$ncontains$starts_with$nstarts_with$ends_with$nends_with$matches$nmatches$ip_range$nip_range |
value | string or number or boolean or string or number[] or object Can be string, bool, numeric, object, or an array of string/numeric values |
Option 2 | object It allows querying data for relative time, eq. events within the last 1 hour. |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $relative_range |
value | object |
Option 3 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $range |
value | object |
Option 4 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $exists$nexists |
Option 5 | object |
field | string field name to filter on |
op | string $geo |
value | object |
Option 6 | object Matches against elements of an array field whose items are tuples with named
subfields (e.g.
Each sub-clause targets a tuple subfield and is validated as if it were a
top-level filter against that subfield — the subfield's declared
|
field | string Name of the array field to match against. |
op | string $array_match_any$array_match_all$narray_match_any$narray_match_all |
value | object[] Sub-clauses evaluated against each array element. |
Option 7 | object A filter tree node. Set exactly one of |
$and | object[] |
$or | object[] |
$or | object[] |
One of | |
Option 1 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $in$nin$eq$neq$like$nlike$contains$ncontains$starts_with$nstarts_with$ends_with$nends_with$matches$nmatches$ip_range$nip_range |
value | string or number or boolean or string or number[] or object Can be string, bool, numeric, object, or an array of string/numeric values |
Option 2 | object It allows querying data for relative time, eq. events within the last 1 hour. |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $relative_range |
value | object |
Option 3 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $range |
value | object |
Option 4 | object |
field | string Field name. Consult the Events Schema API for the list of available fields. |
op | string $exists$nexists |
Option 5 | object |
field | string field name to filter on |
op | string $geo |
value | object |
Option 6 | object Matches against elements of an array field whose items are tuples with named
subfields (e.g.
Each sub-clause targets a tuple subfield and is validated as if it were a
top-level filter against that subfield — the subfield's declared
|
field | string Name of the array field to match against. |
op | string $array_match_any$array_match_all$narray_match_any$narray_match_all |
value | object[] Sub-clauses evaluated against each array element. |
Option 7 | object A filter tree node. Set exactly one of |
$and | object[] |
$or | object[] |
query_type | stringDefault: $records_with_countThe type of query to perform.
$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 |
One of | |
Option 1 | object |
name | string Human-readable name of the aggregation |
description | string | null Description of the aggregation |
interval | integer Time interval in seconds over which aggregation should be observed. Maximum is 180 days. |
group_by | object | null |
fields | object[] The fields names to group by |
field | string |
filters | object Event filters to define when aggregation should be triggered. Accepts a list of filters or a filter tree. |
value | object Field name where to get the value from for the aggregation |
field | string Field name |
aggregation_type | string $avg$count_uniq$first$last$max$min$sum |
metadata | object Metadata is useful for providing additional, structured information on an object. |
whodunnit | string |
whodunnit_type | string $analyst_email$castle_agent$castle_dashboard_user$castle_policy$user$user_email$other |
Option 2 | object |
name | string Human-readable name of the aggregation |
description | string | null Description of the aggregation |
interval | integer Time interval in seconds over which aggregation should be observed. Maximum is 180 days. |
group_by | object | null |
fields | object[] The fields names to group by |
field | string |
filters | object Event filters to define when aggregation should be triggered. Accepts a list of filters or a filter tree. |
value | object Field name where to get the value from for the aggregation |
field | string Field name |
aggregation_type | string $count |
metadata | object Metadata is useful for providing additional, structured information on an object. |
formulas | object[] EXPERIMENTAL! Array of formulas to include in the response.
For each formula, you can reference its name in the |
name | string Formula name |
value | string Formula to calculate value |
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||