Out-of-the-box Query APIs for the most common analytics use cases and data visualizations. You can test your GraphQL API requests without writing a single line of code in our API Playground.

Common features

All of our APIs offer the following features:
Make API requests using pre-defined or inline Metric definitions.Query using an in-line metric definition:
Query
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      count: {
        dataPool: {
          name: "TacoSoft Demo Data"
        }
      }
    }:
  }) {
    ...
  }
}
Query using a pre-defined metric definition by ID:
Query
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      id: "METXXXXXXXXXXXXXXXXXXXXXXXXXX"
    }
  }) {
    ...
  }
}
Query using a pre-defined metric definition by name:
Query
query TimeSeriesExample {
  timeSeries(input: {
    metric: {
      name: "sales"
    }
  }) {
    ...
  }
}
Built-in relative time ranges make it easy to implement common scenarios:
  • Current periods: THIS_HOUR, TODAY, THIS_WEEK, THIS_MONTH, THIS_QUARTER, THIS_YEAR
  • Previous periods: PREVIOUS_HOUR, YESTERDAY, PREVIOUS_WEEK, PREVIOUS_MONTH, PREVIOUS_QUARTER, PREVIOUS_YEAR
  • Next periods: NEXT_HOUR, TOMORROW, NEXT_WEEK, NEXT_MONTH, NEXT_QUARTER, NEXT_YEAR
  • Last N periods: LAST_N_MINUTES, LAST_N_HOURS, LAST_N_DAYS, LAST_N_WEEKS, LAST_N_MONTHS, LAST_N_QUARTERS, LAST_N_YEARS
Absolute time ranges allow for precise date and time selection.
Query
query TimeSeriesExample {
  timeSeries(input: {
    ...
    timeRange: {
      absolute: { start: "2024-01-01", end: "2024-01-05" }
    }
  }) {
    ...
  }
}
Apply filters using SQL syntax.
query TimeSeriesExample {
  timeSeries(input: {
    ...
    filterSql: "(restaurant_name = 'El Buen Sabor') AND (taco_total_price > 100)"
  }) {
    ...
  }
}
Calculates the relative time ranges for the given time zone, allowing for accurate representation of data across different geographical locations.
Query
query TimeSeriesExample {
  timeSeries(input: {
    ...
    timeZone: "America/Los_Angeles"
  }) {
    ...
  }
}
Automatically adds the FINAL modifier to queries on ReplacingMergeTree tables, ensuring that the latest data is always used.
Access Policies are enforced for all Query APIs.

For more details, see our Access Policies documentation.

Use JWT tokens to secure multi-tenant applications with any Data API.

For more details, see our Multi-tenant JWT tokens documentation.