metrics
metrics

The options of one dashboard variable, for the variable selects on dashboards.

post/api/projects/{project_id}/metrics/variable_options/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/metrics/variable_options/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

source'custom' | 'promql' | 'sql' | 'textbox' required
  • custom - custom
  • promql - promql
  • sql - sql
  • textbox - textbox
querystring nullable

The options query when source is promql or sql. It can refer to other variables as $name. PromQL supports label_values(label), label_values(selector, label), label_names(), metrics(regex) and query_result(expr). SQL returns the options in its first column.

customValuesstring[] nullable

The options when source is custom.

regexstring nullable

A regex that filters the options of a query, as pattern or /pattern/flags. With a capture group, each option is its first group. An invalid regex is rejected before any query runs.

dateFromstring nullable

Start of the window that options come from, as in a dashboard date filter: ISO 8601 or a relative date such as '-7d'. Defaults to 24 hours ago.

dateTostring nullable

End of the window that options come from, in the same format as dateFrom. Defaults to now.

Response

resultsstring[] required

The options of the variable, at most 1,000.

Changes