Customer

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET
POST
GET
PATCH
DELETE

List all accounts

Required API key scopes

account:read

Query parameters

  • account_executive
    string
  • account_owner
    string
  • all_roles_unassigned
    boolean
  • csm
    string
  • limit
    integer
  • offset
    integer
  • ordering
    string
    One of: "-created_at""-name""-updated_at""created_at""name""updated_at"
  • search
    string
  • tags
    string

Response


Example request

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

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",
"external_id": "string",
"properties": {
"csm": {
"id": 0,
"email": "string"
},
"account_executive": {
"id": 0,
"email": "string"
},
"account_owner": {
"id": 0,
"email": "string"
},
"stripe_customer_id": "string",
"hubspot_deal_id": "string",
"billing_id": "string",
"sfdc_id": "string",
"zendesk_id": "string"
},
"tags": [
"string"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create accounts

Required API key scopes

account:write

Request parameters

  • name
    string
  • external_id
    stringnull
  • properties
    objectnull
  • tags
    array

Response


Example request

POST /api/environments/:project_id/accounts
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/environments/:project_id/accounts/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"external_id": "string",
"properties": {
"csm": {
"id": 0,
"email": "string"
},
"account_executive": {
"id": 0,
"email": "string"
},
"account_owner": {
"id": 0,
"email": "string"
},
"stripe_customer_id": "string",
"hubspot_deal_id": "string",
"billing_id": "string",
"sfdc_id": "string",
"zendesk_id": "string"
},
"tags": [
"string"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve accounts

Required API key scopes

account:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"external_id": "string",
"properties": {
"csm": {
"id": 0,
"email": "string"
},
"account_executive": {
"id": 0,
"email": "string"
},
"account_owner": {
"id": 0,
"email": "string"
},
"stripe_customer_id": "string",
"hubspot_deal_id": "string",
"billing_id": "string",
"sfdc_id": "string",
"zendesk_id": "string"
},
"tags": [
"string"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}

Update accounts

Required API key scopes

account:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • external_id
    stringnull
  • properties
    objectnull
  • tags
    array

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"external_id": "string",
"properties": {
"csm": {
"id": 0,
"email": "string"
},
"account_executive": {
"id": 0,
"email": "string"
},
"account_owner": {
"id": 0,
"email": "string"
},
"stripe_customer_id": "string",
"hubspot_deal_id": "string",
"billing_id": "string",
"sfdc_id": "string",
"zendesk_id": "string"
},
"tags": [
"string"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}

Delete accounts

Required API key scopes

account:write

Path parameters

  • id
    string

Example request

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

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

Community questions

Questions about this page? or post a community question.