Billing

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

Endpoints

POST
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET
GET

Create billing alerts destinations delete

Delete a notification destination by deleting its HogFunction group atomically.

Required API key scopes

organization:write

Path parameters

  • id
    string

Request parameters

  • hog_function_ids
    array

Example request

POST /api/organizations/:organization_id/billing/alerts/:id/destinations/delete
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/organizations/:organization_id/billing/alerts/:id/destinations/delete/\
-d hog_function_ids="array"

Example response

Status 204 No response body

Create billing alerts destinations delete

Delete a notification destination by deleting its HogFunction group atomically.

Required API key scopes

organization:write

Path parameters

  • id
    string

Request parameters

  • hog_function_ids
    array

Example request

POST /api/organizations/:organization_id/billing/alerts/:id/destinations/delete
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/organizations/:organization_id/billing/alerts/:id/destinations/delete/\
-d hog_function_ids="array"

Example response

Status 204 No response body

List all billing alerts events

List evaluation and notification events for this billing alert, newest first.

Required API key scopes

organization:read

Path parameters

  • id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/organizations/:organization_id/billing/alerts/:id/events
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/alerts/:id/events/

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",
"kind": "check",
"source": "scheduled",
"attempt_number": 0,
"created_at": "2019-08-24T14:15:22Z",
"evaluation_date": "2019-08-24",
"configuration_revision": 0,
"period_start": "2019-08-24T14:15:22Z",
"period_end": "2019-08-24T14:15:22Z",
"metric": "spend",
"current_value": "string",
"baseline_value": "string",
"absolute_delta": "string",
"relative_delta_percentage": "string",
"threshold_breached": true,
"state_before": "not_firing",
"state_after": "not_firing",
"notification_sent_at": "2019-08-24T14:15:22Z",
"targets_notified": null,
"query_duration_ms": 0,
"error_code": "string",
"error_message": "string",
"reason": "string"
}
]
}

List all billing alerts events

List evaluation and notification events for this billing alert, newest first.

Required API key scopes

organization:read

Path parameters

  • id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/organizations/:organization_id/billing/alerts/:id/events
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/alerts/:id/events/

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",
"kind": "check",
"source": "scheduled",
"attempt_number": 0,
"created_at": "2019-08-24T14:15:22Z",
"evaluation_date": "2019-08-24",
"configuration_revision": 0,
"period_start": "2019-08-24T14:15:22Z",
"period_end": "2019-08-24T14:15:22Z",
"metric": "spend",
"current_value": "string",
"baseline_value": "string",
"absolute_delta": "string",
"relative_delta_percentage": "string",
"threshold_breached": true,
"state_before": "not_firing",
"state_after": "not_firing",
"notification_sent_at": "2019-08-24T14:15:22Z",
"targets_notified": null,
"query_duration_ms": 0,
"error_code": "string",
"error_message": "string",
"reason": "string"
}
]
}

Retrieve billing features

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/organizations/:organization_id/billing/features
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/features/

Example response

Status 200
RESPONSE
{
"available_product_features": [
{
"key": "string",
"name": "string",
"description": "string",
"unit": "string",
"limit": 0,
"note": "string",
"is_plan_default": true,
"entitlement_only": true,
"category": "string"
}
]
}

Retrieve billing forecast

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/organizations/:organization_id/billing/forecast
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/forecast/

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"
},
"projected_total_amount_usd": "string",
"projected_total_amount_usd_with_limit": "string",
"projected_total_amount_usd_after_discount": "string",
"projected_total_amount_usd_with_limit_after_discount": "string",
"products": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"projected_usage": 0,
"projected_amount_usd": "string",
"projected_amount_usd_with_limit": "string",
"tier_forecast": [
{
"up_to": 0,
"projected_usage": 0,
"projected_amount_usd": "string"
}
],
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"projected_usage": 0,
"projected_amount_usd": "string",
"projected_amount_usd_with_limit": "string",
"tier_forecast": [
{
"up_to": 0,
"projected_usage": 0,
"projected_amount_usd": "string"
}
]
}
]
}
],
"computed_at": "2019-08-24T14:15:22Z"
}

List all billing invoices

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

  • cursor
    string
  • limit
    integer
  • status
    string
    One of: "open""paid""uncollectible""void"

Response


Example request

GET /api/organizations/:organization_id/billing/invoices
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/invoices/

Example response

Status 200
RESPONSE
{
"next": "http://example.com",
"previous": "http://example.com",
"results": [
{
"id": "string",
"number": "string",
"status": "open",
"currency": "string",
"subtotal": "string",
"total": "string",
"amount_due": "string",
"amount_paid": "string",
"period_start": "2019-08-24T14:15:22Z",
"period_end": "2019-08-24T14:15:22Z",
"created": "2019-08-24T14:15:22Z",
"due_date": "2019-08-24T14:15:22Z"
}
]
}

Retrieve billing invoices content

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

Path parameters

  • invoice_id
    string

Example request

GET /api/organizations/:organization_id/billing/invoices/:invoice_id/content
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/invoices/:invoice_id/content/

Example response

Status 200

Retrieve billing limits

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/organizations/:organization_id/billing/limits
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/limits/

Example response

Status 200
RESPONSE
{
"results": [
{
"key": "string",
"limit_usd": 0,
"next_period_limit_usd": 0,
"spend_usd": "string",
"reached": true
}
]
}

List all billing products

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

  • include_plans
    boolean
    Default: false

Response


Example request

GET /api/organizations/:organization_id/billing/products
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/products/

Example response

Status 200
RESPONSE
{
"results": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"name": "string",
"description": "string",
"price_description": "string",
"icon_key": "string",
"image_url": "string",
"docs_url": "string",
"subscribed": true,
"inclusion_only": true,
"contact_support": true,
"legacy_product": true,
"free_allocation": 0,
"usage_limit": 0,
"unit": "string",
"display_unit": "string",
"display_decimals": 0,
"display_divisor": 0,
"tiered": true,
"unit_amount_usd": "string",
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"plans": [
{
"product_key": "string",
"plan_key": "string",
"name": "string",
"description": "string",
"image_url": "string",
"docs_url": "string",
"note": "string",
"unit": "string",
"flat_rate": true,
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"free_allocation": 0,
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"unit": "string",
"limit": 0,
"note": "string",
"is_plan_default": true,
"entitlement_only": true,
"category": "string"
}
],
"included_if": "string",
"contact_support": true,
"unit_amount_usd": "string",
"current_plan": true,
"initial_billing_limit": 0
}
],
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"images": null,
"icon_key": "string",
"type": "string",
"category": "string"
}
],
"trial": {
"length": 0
},
"headline": "string",
"screenshot_url": "string",
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"name": "string",
"description": "string",
"price_description": "string",
"icon_key": "string",
"image_url": "string",
"docs_url": "string",
"subscribed": true,
"inclusion_only": true,
"contact_support": true,
"legacy_product": true,
"free_allocation": 0,
"usage_limit": 0,
"unit": "string",
"display_unit": "string",
"display_decimals": 0,
"display_divisor": 0,
"tiered": true,
"unit_amount_usd": "string",
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"plans": [
{
"product_key": "string",
"plan_key": "string",
"name": "string",
"description": "string",
"image_url": "string",
"docs_url": "string",
"note": "string",
"unit": "string",
"flat_rate": true,
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"free_allocation": 0,
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"unit": "string",
"limit": 0,
"note": "string",
"is_plan_default": true,
"entitlement_only": true,
"category": "string"
}
],
"included_if": "string",
"contact_support": true,
"unit_amount_usd": "string",
"current_plan": true,
"initial_billing_limit": 0
}
],
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"images": null,
"icon_key": "string",
"type": "string",
"category": "string"
}
],
"trial": {
"length": 0
},
"included_with_main_product": true,
"included_if": "string",
"default_unit_amount_usd": "string"
}
]
}
]
}

Retrieve billing products

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

Path parameters

  • product_key
    string

Query parameters

  • include_plans
    boolean
    Default: false

Response


Example request

GET /api/organizations/:organization_id/billing/products/:product_key
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/products/:product_key/

Example response

Status 200
RESPONSE
{
"kind": "product",
"key": "string",
"usage_key": "string",
"name": "string",
"description": "string",
"price_description": "string",
"icon_key": "string",
"image_url": "string",
"docs_url": "string",
"subscribed": true,
"inclusion_only": true,
"contact_support": true,
"legacy_product": true,
"free_allocation": 0,
"usage_limit": 0,
"unit": "string",
"display_unit": "string",
"display_decimals": 0,
"display_divisor": 0,
"tiered": true,
"unit_amount_usd": "string",
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"plans": [
{
"product_key": "string",
"plan_key": "string",
"name": "string",
"description": "string",
"image_url": "string",
"docs_url": "string",
"note": "string",
"unit": "string",
"flat_rate": true,
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"free_allocation": 0,
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"unit": "string",
"limit": 0,
"note": "string",
"is_plan_default": true,
"entitlement_only": true,
"category": "string"
}
],
"included_if": "string",
"contact_support": true,
"unit_amount_usd": "string",
"current_plan": true,
"initial_billing_limit": 0
}
],
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"images": null,
"icon_key": "string",
"type": "string",
"category": "string"
}
],
"trial": {
"length": 0
},
"headline": "string",
"screenshot_url": "string",
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"name": "string",
"description": "string",
"price_description": "string",
"icon_key": "string",
"image_url": "string",
"docs_url": "string",
"subscribed": true,
"inclusion_only": true,
"contact_support": true,
"legacy_product": true,
"free_allocation": 0,
"usage_limit": 0,
"unit": "string",
"display_unit": "string",
"display_decimals": 0,
"display_divisor": 0,
"tiered": true,
"unit_amount_usd": "string",
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"plans": [
{
"product_key": "string",
"plan_key": "string",
"name": "string",
"description": "string",
"image_url": "string",
"docs_url": "string",
"note": "string",
"unit": "string",
"flat_rate": true,
"tiers": [
{
"flat_amount_usd": "string",
"unit_amount_usd": "string",
"up_to": 0
}
],
"free_allocation": 0,
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"unit": "string",
"limit": 0,
"note": "string",
"is_plan_default": true,
"entitlement_only": true,
"category": "string"
}
],
"included_if": "string",
"contact_support": true,
"unit_amount_usd": "string",
"current_plan": true,
"initial_billing_limit": 0
}
],
"features": [
{
"key": "string",
"name": "string",
"description": "string",
"images": null,
"icon_key": "string",
"type": "string",
"category": "string"
}
],
"trial": {
"length": 0
},
"included_with_main_product": true,
"included_if": "string",
"default_unit_amount_usd": "string"
}
]
}

Retrieve billing products summary

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/organizations/:organization_id/billing/products/summary
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/products/summary/

Example response

Status 200
RESPONSE
{
"results": [
{
"key": "string",
"name": "string",
"description": "string",
"subscribed": true,
"addons": [
{
"key": "string",
"name": "string",
"description": "string",
"subscribed": true
}
],
"features": [
{
"key": "string",
"name": "string",
"included": true,
"addon_keys": [
"string"
]
}
]
}
]
}

List all billing project

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. Every project the organization has reported usage for, deleted ones included, so a caller knows which ids a project breakdown or a team_ids filter can name. Below full billing access the list is the projects the caller can see.

Required API key scopes

billing:read

Response


Example request

GET /api/organizations/:organization_id/billing/projects
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/projects/

Example response

Status 200
RESPONSE
{
"count": 0,
"next": "http://example.com",
"previous": "http://example.com",
"results": [
{
"id": 0,
"name": "string",
"deleted": true
}
]
}

Retrieve billing spend summary

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/organizations/:organization_id/billing/spend
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/spend/

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"
},
"usage_reported_through": "2019-08-24",
"current_total_amount_usd": "string",
"current_total_amount_usd_after_discount": "string",
"products": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"current_amount_usd": "string",
"current_amount_usd_before_addons": "string",
"tier_spend": [
{
"up_to": 0,
"current_amount_usd": "string"
}
],
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"current_amount_usd": "string",
"current_amount_usd_before_addons": "string",
"tier_spend": [
{
"up_to": 0,
"current_amount_usd": "string"
}
]
}
]
}
]
}

Retrieve billing 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
  • team_ids
    string | null
  • top_projects
    integer | null
  • usage_types
    string | null

Example request

GET /api/organizations/:organization_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/organizations/:organization_id/billing/spend/export/

Example response

Status 200

Retrieve billing 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
  • 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/spend/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/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 subscription

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/organizations/:organization_id/billing/subscription
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/subscription/

Example response

Status 200
RESPONSE
{
"customer_id": "string",
"has_active_subscription": true,
"subscription_level": "string",
"billing_plan": "string",
"billing_provider": "stripe",
"deactivated": true,
"is_annual_plan_customer": true,
"billing_period": {
"current_period_start": "2019-08-24T14:15:22Z",
"current_period_end": "2019-08-24T14:15:22Z",
"interval": "month"
},
"trial": {
"type": "string",
"status": "string",
"target": "string",
"expires_at": "2019-08-24T14:15:22Z"
},
"free_trial_until": "2019-08-24T14:15:22Z",
"discount_percent": 0,
"discount_amount_usd": "string",
"amount_off_expires_at": "2019-08-24T14:15:22Z",
"startup_program_label": "string",
"startup_program_label_previous": "string",
"billing_portal_url": "http://example.com",
"invoices_url": "http://example.com",
"license": {
"plan": "string"
},
"billing_managed_by_partner": {
"partner_name": "string"
}
}

Retrieve billing usage summary

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/organizations/:organization_id/billing/usage
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/

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"
},
"usage_reported_through": "2019-08-24",
"usage_summary": [
{
"usage_key": "string",
"usage": 0,
"limit": 0,
"todays_usage": 0,
"quota_limited_until": "2019-08-24T14:15:22Z",
"quota_limiting_suspended_until": "2019-08-24T14:15:22Z"
}
],
"products": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"current_usage": 0,
"usage_limit": 0,
"has_exceeded_limit": true,
"usage_ratio": 0.1,
"tier_usage": [
{
"up_to": 0,
"current_usage": 0
}
],
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"current_usage": 0,
"usage_limit": 0,
"has_exceeded_limit": true,
"usage_ratio": 0.1,
"tier_usage": [
{
"up_to": 0,
"current_usage": 0
}
]
}
]
}
]
}

Retrieve billing 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
  • team_ids
    string | null
  • top_projects
    integer | null
  • usage_types
    string | null

Example request

GET /api/organizations/:organization_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/organizations/:organization_id/billing/usage/export/

Example response

Status 200

Retrieve billing usage status

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/organizations/:organization_id/billing/usage/status
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/status/

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"
},
"usage_reported_through": "2019-08-24",
"products": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"usage_limit": 0,
"has_exceeded_limit": true,
"approaching_limit": true,
"quota_limited_until": "2019-08-24T14:15:22Z",
"quota_limiting_suspended_until": "2019-08-24T14:15:22Z",
"addons": [
{
"kind": "product",
"key": "string",
"usage_key": "string",
"usage_limit": 0,
"has_exceeded_limit": true,
"approaching_limit": true,
"quota_limited_until": "2019-08-24T14:15:22Z",
"quota_limiting_suspended_until": "2019-08-24T14:15:22Z"
}
]
}
]
}