Billing

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

Endpoints

GET
GET
GET
GET
GET
GET

Retrieve billing usage timeseries

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Query parameters

  • breakdowns
    string | null
  • cursor
    string | null
  • end_date
    string | null
  • interval
    string | null
  • limit
    integer | null
  • start_date
    string | null
  • team_ids
    string | null
  • top_projects
    integer | null
  • usage_types
    string | null

Response


Example request

GET /api/organizations/:organization_id/billing/usage/timeseries
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/billing/usage/timeseries/

Example response

Status 200
RESPONSE
{
"count": 0,
"next": "http://example.com",
"previous": "http://example.com",
"results": [
{
"id": 0,
"label": "string",
"data": [
0.1
],
"dates": [
"string"
],
"breakdown_type": "type",
"breakdown_value": null
}
]
}

Retrieve billing project spend export

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Query parameters

  • breakdowns
    string | null
  • end_date
    string | null
  • interval
    string | null
  • start_date
    string | null
  • usage_types
    string | null

Example request

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

Example response

Status 200

Retrieve billing project spend timeseries

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Query parameters

  • breakdowns
    string | null
  • end_date
    string | null
  • interval
    string | null
  • start_date
    string | null
  • usage_types
    string | null

Response


Example request

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

Example response

Status 200
RESPONSE
{
"count": 0,
"next": "http://example.com",
"previous": "http://example.com",
"results": [
{
"id": 0,
"label": "string",
"data": [
0.1
],
"dates": [
"string"
],
"breakdown_type": "type",
"breakdown_value": null
}
]
}

Retrieve billing project usage

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"billing_period": {
"current_period_start": "2019-08-24T14:15:22Z",
"current_period_end": "2019-08-24T14:15:22Z",
"interval": "month"
},
"results": [
{
"usage_key": "string",
"name": "string",
"usage": 0.1
}
]
}

Retrieve billing project usage export

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Query parameters

  • breakdowns
    string | null
  • end_date
    string | null
  • interval
    string | null
  • start_date
    string | null
  • usage_types
    string | null

Example request

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

Example response

Status 200

Retrieve billing project usage timeseries

In beta: the organization billing API is behind the organization-billing-api feature flag and answers 403 without it, so ask support for access. Its shapes may change while it is in beta.

Required API key scopes

billing:read

Query parameters

  • breakdowns
    string | null
  • end_date
    string | null
  • interval
    string | null
  • start_date
    string | null
  • usage_types
    string | null

Response


Example request

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

Example response

Status 200
RESPONSE
{
"count": 0,
"next": "http://example.com",
"previous": "http://example.com",
"results": [
{
"id": 0,
"label": "string",
"data": [
0.1
],
"dates": [
"string"
],
"breakdown_type": "type",
"breakdown_value": null
}
]
}