Customer

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

Endpoints

GET
POST
GET
PATCH
DELETE

List all groups types metrics

Required API key scopes

usage_metric:read

Path parameters

  • group_type_index
    integer

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/groups_types/:group_type_index/metrics
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/groups_types/:group_type_index/metrics/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"format": "numeric",
"interval": 7,
"display": "number",
"filters": {},
"math": "count",
"math_property": "string"
}
]
}

Create groups types metrics

Required API key scopes

usage_metric:write

Path parameters

  • group_type_index
    integer

Request parameters

  • name
    string
  • format
    Default: numeric
  • interval
    integer
    Default: 7
  • display
    Default: number
  • filters
    object
  • math
    Default: count
  • math_property
    stringnull

Response


Example request

POST /api/projects/:project_id/groups_types/:group_type_index/metrics
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/groups_types/:group_type_index/metrics/\
-d name="string",\
-d filters="object"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"format": "numeric",
"interval": 7,
"display": "number",
"filters": {},
"math": "count",
"math_property": "string"
}

Retrieve groups types metrics

Required API key scopes

usage_metric:read

Path parameters

  • group_type_index
    integer
  • id
    string

Response


Example request

GET /api/projects/:project_id/groups_types/:group_type_index/metrics/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/groups_types/:group_type_index/metrics/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"format": "numeric",
"interval": 7,
"display": "number",
"filters": {},
"math": "count",
"math_property": "string"
}

Update groups types metrics

Required API key scopes

usage_metric:write

Path parameters

  • group_type_index
    integer
  • id
    string

Request parameters

  • name
    string
  • format
    Default: numeric
  • interval
    integer
    Default: 7
  • display
    Default: number
  • filters
    object
  • math
    Default: count
  • math_property
    stringnull

Response


Example request

PATCH /api/projects/:project_id/groups_types/:group_type_index/metrics/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/groups_types/:group_type_index/metrics/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"format": "numeric",
"interval": 7,
"display": "number",
"filters": {},
"math": "count",
"math_property": "string"
}

Delete groups types metrics

Required API key scopes

usage_metric:write

Path parameters

  • group_type_index
    integer
  • id
    string

Example request

DELETE /api/projects/:project_id/groups_types/:group_type_index/metrics/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/groups_types/:group_type_index/metrics/:id/

Example response

Status 204 No response body

Community questions

Questions about this page? or post a community question.