POST /accounts/{account_id}/workers/observability/telemetry/query
Run a temporary or saved query.
Servers
- https://api.cloudflare.com/client/v4
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id |
String | Yes |
Your Cloudflare account ID. |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
dry |
Boolean | No |
When true, executes the query without persisting the results. Useful for validation or previewing. Default value: false |
ignoreSeries |
Boolean | No |
When true, omits time-series data from the response and returns only aggregated values. Reduces response size when series are not needed. Default value: false |
timeframe |
Object | Yes |
Timeframe for the query using Unix timestamps in milliseconds. Narrower timeframes produce faster responses and more specific results. |
timeframe.to |
Number | Yes |
End timestamp for the query timeframe (Unix timestamp in milliseconds) |
timeframe.from |
Number | Yes |
Start timestamp for the query timeframe (Unix timestamp in milliseconds) |
parameters |
Object | No |
Query parameters defining what data to retrieve — filters, calculations, group-bys, and ordering. In practice this should always be provided for ad-hoc queries. Only omit when executing a previously saved query by queryId. Use the keys and values endpoints to discover available fields before building filters. |
parameters.datasets[] |
Array | No |
Datasets to query. Leave empty to query all available datasets. |
parameters.filters[] |
Array | No |
Filters to narrow query results. Use the keys and values endpoints to discover available fields before building filters. Supports nested groups via kind: 'group'. Maximum nesting depth is 4. |
parameters.filters[].filters[] |
Array | Yes |
Child filter nodes. Each can be a leaf filter or another nested group. |
parameters.filters[].filterCombination |
String | Yes |
Logical operator for combining child filters: 'and' (all must match) or 'or' (any must match). Valid values:
|
parameters.filters[].key |
String | Yes |
Filter field name. Use verified keys from previous query results or the keys endpoint. Common keys include $metadata.service, $metadata.origin, $metadata.trigger, $metadata.message, and $metadata.error. |
parameters.filters[].operation |
String | Yes |
Comparison operator. String operators: includes, not_includes, starts_with, ends_with, regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. Valid values:
|
parameters.filters[].type |
String | Yes |
Data type of the filter field. Must match the actual type of the key being filtered. Valid values:
|
parameters.filters[].value |
Object | No |
Comparison value. Must match actual values in your data — verify with the values endpoint. Ensure the value type (string/number/boolean) matches the field type. String comparisons are case-sensitive. Regex uses RE2 syntax (no lookaheads/lookbehinds). |
parameters.filters[].kind |
String | Yes |
Discriminator for leaf filter nodes. Always 'filter' when present; may be omitted. Valid values:
|
parameters.limit |
Integer | No |
Maximum number of group-by rows to return in calculation results. A value of 10 is a sensible default for most use cases. |
parameters.filterCombination |
String | No |
Logical operator for combining top-level filters: 'and' (all must match) or 'or' (any must match). Defaults to 'and'. Valid values:
|
parameters.orderBy |
Object | No |
Ordering for grouped calculation results. Only effective when a group-by is present. |
parameters.orderBy.order |
String | No |
Sort direction: 'asc' for ascending, 'desc' for descending. Valid values:
|
parameters.orderBy.value |
String | Yes |
Alias of the calculation to order results by. Must match the alias (or operator) of a calculation in the query. |
parameters.needle |
Object | No |
Full-text search expression applied across all event fields. Matches events containing the specified text. |
parameters.needle.value |
String | Yes |
The text or pattern to search for. |
parameters.needle.matchCase |
Boolean | No |
When true, performs a case-sensitive search. Defaults to case-insensitive. |
parameters.needle.isRegex |
Boolean | No |
When true, treats the value as a regular expression (RE2 syntax). |
parameters.groupBys[] |
Array | No |
Fields to group calculation results by. Only applicable when the query view is 'calculations'. Produces per-group aggregate values. |
parameters.groupBys[].type |
String | Yes |
Data type of the group-by field. Valid values:
|
parameters.groupBys[].value |
String | Yes |
Field name to group results by (e.g. $metadata.service, $metadata.statusCode). |
parameters.havings[] |
Array | No |
Post-aggregation filters applied to calculation results. Use to filter groups after aggregation (e.g. only groups where count > 100). |
parameters.havings[].key |
String | Yes |
Calculation alias or operator to filter on after aggregation. |
parameters.havings[].operation |
String | Yes |
Numeric comparison operator: eq, neq, gt, gte, lt, lte. Valid values:
|
parameters.havings[].value |
Number | Yes |
Threshold value to compare the calculation result against. |
parameters.calculations[] |
Array | No |
Aggregation calculations to compute (e.g. count, avg, p99). Each calculation produces aggregate values and optional time-series data. |
parameters.calculations[].operator |
String | Yes |
Aggregation operator to apply. Examples: count, avg, sum, min, max, median, p90, p95, p99, uniq, stddev, variance. Valid values:
|
parameters.calculations[].key |
String | No |
Field name to calculate over. Must exist in the data — verify with the keys endpoint. Omit for operators that don't require a key (e.g. count). |
parameters.calculations[].keyType |
String | No |
Data type of the key. Required when key is provided to ensure correct aggregation. Valid values:
|
parameters.calculations[].alias |
String | No |
Custom label for this calculation in the results. Useful for distinguishing multiple calculations. |
view |
String | No |
Controls the shape of the response. 'events': individual log lines matching the query. 'calculations': aggregated metrics (count, avg, p99, etc.) with optional group-by breakdowns and time-series. 'invocations': events grouped by request ID. 'traces': distributed trace summaries. 'agents': Durable Object agent summaries. Valid values:
Default value: "calculations" |
offsetBy |
Number | No |
Numeric offset for paginating grouped/pattern results (top-N lists). Use together with limit. Not used by cursor-based pagination. |
chart |
Boolean | No |
When true, includes time-series data in the response. |
limit |
Number | No |
Maximum number of events to return when view is 'events'. Also controls the number of group-by rows when view is 'calculations'. Default value: 50 |
queryId |
String | Yes |
Identifier for the query. When parameters are omitted, this ID is used to load a previously saved query's parameters. When providing parameters inline, pass any identifier (e.g. an ad-hoc ID). |
offsetDirection |
String | No |
Pagination direction: 'next' for forward, 'prev' for backward. |
granularity |
Number | No |
Number of time-series buckets. Only used when view is 'calculations'. Omit to let the system auto-detect an appropriate granularity. |
compare |
Boolean | No |
When true, includes a comparison dataset from the previous time period of equal length. |
offset |
String | No |
Cursor for pagination in event, trace, and invocation views. Pass the $metadata.id of the last returned item to fetch the next page. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.