Skip to main content
POST
/
1
/
queries
/
{datasetSlug}
curl --request POST \
  --url https://api.honeycomb.io/1/queries/{datasetSlug} \
  --header 'Content-Type: application/json' \
  --data '
{
  "calculations": [
    {
      "op": "COUNT"
    }
  ],
  "orders": [
    {
      "op": "COUNT",
      "order": "descending"
    }
  ],
  "time_range": 7200
}
'
{
  "id": "abc3419d",
  "calculations": [
    {
      "op": "COUNT"
    }
  ],
  "orders": [
    {
      "op": "COUNT",
      "order": "descending"
    }
  ],
  "time_range": 7200
}

Path Parameters

datasetSlug
string
required

The dataset slug or use __all__ for endpoints that support environment-wide operations.

Body

application/json
breakdowns
string[]

the columns by which to break events down into groups

Maximum array length: 100
calculations
object[]

the calculations to return as a time series and summary table

Maximum array length: 100
filters
object[]

The filters with which to restrict the considered events

Maximum array length: 100
filter_combination
enum<string>
default:AND

Set to "OR" to match ANY filter in the filter list

Available options:
AND,
OR
formulas
object[]

Mathematical formulas to be returned as a time series and summary table. Formulas operate on the results of calculations and are returned in query results instead of calculations. Only available in Metrics Beta.

Maximum array length: 100
granularity
integer

The time resolution of the query's graph, in seconds. Given a query time range T, valid values (T/1000...T/1). If left blank, granularity may be set to a sub-second value for queries with short time ranges.

Required range: x >= 1
orders
object[]

The terms on which to order the query results. Each term must appear in the breakdowns field, the calculations field, or the formulas field. Formulas and calculations with name properties can be referenced by putting the name in the column property.

Maximum array length: 100
limit
integer
default:100

The maximum number of unique groups returned in 'results'. Aggregating many unique groups across a large time range is computationally expensive, and too high a limit with too many unique groups may cause queries to fail completely. Limiting the results to only the needed values can significantly speed up queries. The normal allowed maximum value when creating a query is 1_000. When running 'disable_series' queries, this can be overridden to be up to 10_000, so the maximum value returned from the API when fetching a query may be up to 10_000.

Required range: 1 <= x <= 10000
start_time
integer
default:1676399428

Absolute start time of query, in seconds since UNIX epoch. Must be <= end_time.

Required range: x >= 1
end_time
integer
default:1676467828

Absolute end time of query, in seconds since UNIX epoch.

Required range: x >= 1
time_range
integer
default:7200

Time range of query in seconds. Can be used with either start_time (seconds after start_time), end_time (seconds before end_time), or without either (seconds before now).

Required range: x >= 1
havings
object[]

The Having clause allows you to filter on the results table. This operation is distinct from the Where clause, which filters the underlying events. Order By allows you to order the results, and Having filters them. Formulas and calculations with name properties can be referenced by putting the name in the column property.

Maximum array length: 100
calculated_fields
object[]

Computed properties that are calculated by a formula.

Maximum array length: 100
compare_time_offset_seconds
enum<integer>

When set, offsets the query's time range by this number of seconds into the past, allowing comparison with historical data from an earlier time period. For example, setting this to 86400 (24 hours) will compare current results against data from 24 hours ago.

Note
  • The offset must be greater than or equal to the query's time range duration.
Allowed values
  • same time range as query time range
  • 1800 - 30 minutes
  • 3600 - 1 hour
  • 7200 - 2 hours
  • 28800 - 8 hours
  • 86400 - 24 hours
  • 604800 - 7 days
  • 2419200 - 28 days
  • 15724800 - 6 months
Available options:
1800,
3600,
7200,
28800,
86400,
604800,
2419200,
15724800
usage_mode
boolean
default:false

If true, query results will return aggregates without correcting for sample rates. This is useful for understanding the actual volume of data stored rather than the estimated original event counts. By default, aggregates are adjusted to reflect the estimated original event volume based on sample rates. Note: This field is not supported for triggers.

Response

Success

id
string
breakdowns
string[]

the columns by which to break events down into groups

Maximum array length: 100
calculations
object[]

the calculations to return as a time series and summary table

Maximum array length: 100
filters
object[]

The filters with which to restrict the considered events

Maximum array length: 100
filter_combination
enum<string>
default:AND

Set to "OR" to match ANY filter in the filter list

Available options:
AND,
OR
formulas
object[]

Mathematical formulas to be returned as a time series and summary table. Formulas operate on the results of calculations and are returned in query results instead of calculations. Only available in Metrics Beta.

Maximum array length: 100
granularity
integer

The time resolution of the query's graph, in seconds. Given a query time range T, valid values (T/1000...T/1). If left blank, granularity may be set to a sub-second value for queries with short time ranges.

Required range: x >= 1
orders
object[]

The terms on which to order the query results. Each term must appear in the breakdowns field, the calculations field, or the formulas field. Formulas and calculations with name properties can be referenced by putting the name in the column property.

Maximum array length: 100
limit
integer
default:100

The maximum number of unique groups returned in 'results'. Aggregating many unique groups across a large time range is computationally expensive, and too high a limit with too many unique groups may cause queries to fail completely. Limiting the results to only the needed values can significantly speed up queries. The normal allowed maximum value when creating a query is 1_000. When running 'disable_series' queries, this can be overridden to be up to 10_000, so the maximum value returned from the API when fetching a query may be up to 10_000.

Required range: 1 <= x <= 10000
start_time
integer
default:1676399428

Absolute start time of query, in seconds since UNIX epoch. Must be <= end_time.

Required range: x >= 1
end_time
integer
default:1676467828

Absolute end time of query, in seconds since UNIX epoch.

Required range: x >= 1
time_range
integer
default:7200

Time range of query in seconds. Can be used with either start_time (seconds after start_time), end_time (seconds before end_time), or without either (seconds before now).

Required range: x >= 1
havings
object[]

The Having clause allows you to filter on the results table. This operation is distinct from the Where clause, which filters the underlying events. Order By allows you to order the results, and Having filters them. Formulas and calculations with name properties can be referenced by putting the name in the column property.

Maximum array length: 100
calculated_fields
object[]

Computed properties that are calculated by a formula.

Maximum array length: 100
compare_time_offset_seconds
enum<integer>

When set, offsets the query's time range by this number of seconds into the past, allowing comparison with historical data from an earlier time period. For example, setting this to 86400 (24 hours) will compare current results against data from 24 hours ago.

Note
  • The offset must be greater than or equal to the query's time range duration.
Allowed values
  • same time range as query time range
  • 1800 - 30 minutes
  • 3600 - 1 hour
  • 7200 - 2 hours
  • 28800 - 8 hours
  • 86400 - 24 hours
  • 604800 - 7 days
  • 2419200 - 28 days
  • 15724800 - 6 months
Available options:
1800,
3600,
7200,
28800,
86400,
604800,
2419200,
15724800
usage_mode
boolean
default:false

If true, query results will return aggregates without correcting for sample rates. This is useful for understanding the actual volume of data stored rather than the estimated original event counts. By default, aggregates are adjusted to reflect the estimated original event volume based on sample rates. Note: This field is not supported for triggers.