Metrics

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST

Create metrics values

Distinct metric names for the team. Backs the catalog UI.

Required API key scopes

metrics:read

Request parameters

  • value
    string
    Default:
  • limit
    integer
    Default: 100
  • service
    string
  • names
    array

Response


Example request

POST /api/projects/:project_id/metrics/values
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/metrics/values/\
-d names="array"

Example response

Status 200
RESPONSE
{
"results": [
{
"name": "string",
"metric_type": "string",
"unit": "string",
"last_seen": "2019-08-24T14:15:22Z",
"sparkline": [
0.1
]
}
]
}

Create metrics values

Distinct metric names for the team. Backs the catalog UI.

Required API key scopes

metrics:read

Request parameters

  • value
    string
    Default:
  • limit
    integer
    Default: 100
  • service
    string
  • names
    array

Response


Example request

POST /api/projects/:project_id/metrics/values
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/metrics/values/\
-d names="array"

Example response

Status 200
RESPONSE
{
"results": [
{
"name": "string",
"metric_type": "string",
"unit": "string",
"last_seen": "2019-08-24T14:15:22Z",
"sparkline": [
0.1
]
}
]
}