Groups types

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

Endpoints

GET
DELETE
GET
POST
GET
PATCH
DELETE
PATCH

List all groups types

Required API key scopes

group:read

Example request

GET /api/projects/:project_id/groups_types
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/

Example response

Status 200
RESPONSE
{
"group_type": "string",
"group_type_index": 0,
"name_singular": "string",
"name_plural": "string",
"detail_dashboard": 0,
"default_columns": [
"string"
],
"created_at": "2019-08-24T14:15:22Z"
}

Delete groups types

Required API key scopes

group:write

Path parameters

  • group_type_index
    integer

Example request

DELETE /api/projects/:project_id/groups_types/:group_type_index
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/

Example response

Status 204 No response body

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

Update groups types update metadata

Request parameters

  • name_singular
    stringnull
  • name_plural
    stringnull
  • detail_dashboard
    integernull
  • default_columns
    arraynull
  • created_at
    stringnull

Example request

PATCH /api/projects/:project_id/groups_types/update_metadata
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/update_metadata/\
-d group_type="string"

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.