Plan groups
The Plan Groups API allows you to manage plan groups for your account. Each group can have a number of plans in them, organized in the way that makes most sense for your reporting. You can list, create, update, and delete plan groups, and control the plans inside them.
List plan groups
Retrieve all plan groups for your account. You can optionally limit the number of returned plans.
Endpoint: GET /data/plan-groups
Query parameters:
| Parameter | Type | Description |
|---|---|---|
limit | integer | Optional. Limit the number of plans returned. |
Example request:
GET /data/plan-groups?limit=100
Authorization: Bearer YOUR_API_KEYExample response
{
"result": {
"count": 5,
"list": [
{
"id": "b8d2d779-fdc7-4df0-89ee-88b5397a4b28",
"name": "Growth",
"plans": [
{
"id": "price_1LvNamxxqqZbQ9jJmRjpZevo",
"name": "Growth Monthly (EUR)",
"billing_freq": "month",
"billing_freq_count": 1,
"product_name": "Growth",
"currency": "eur"
},
{
"id": "price_1LskeDssUqqZbQ9jJjGxZLKfu",
"name": "Growth Yearly (USD)",
"billing_freq": "year",
"billing_freq_count": 1,
"product_name": "Growth",
"currency": "usd"
}
]
},
{
"id": "e12df8c4-78db-421d-919a-0f094905024d",
"name": "Pro",
"plans": [
{
"id": "price_1LvNcxxFUqqZbQ9jJZLJX83C4",
"name": "Pro Monthly (USD)",
"billing_freq": "month",
"billing_freq_count": 1,
"product_name": "Pro",
"currency": "usd"
},
...
]
}
]
}
}Create plan groups
Add a new plan group including the relationship to the plans in the group. The plans are referred by their ID only, and must exist beforehand.
Endpoint: POST /data/plan-groups
Request body:
{
"name": "Growth",
"plans": [
{
"id": "price_1LvNamxxqqZbQ9jJmRjpZevo"
},
{
"id": "price_1LskeDssUqqZbQ9jJjGxZLKfu"
}
]
}Example response:
{
"success": true,
"id": "b8d2d779-fdc7-4df0-89ee-88b5397a4b28"
}Update a plan group
Update an existing plan by its external ID. You can update the names and the list of plans.
Endpoint: PUT /data/plan-groups/:id
Request body:
{
"name": "Growth",
"plans": [
{
"id": "price_1LvNamxxqqZbQ9jJmRjpZevo"
}
]
}Example response:
{
"success": true,
"id": "b8d2d779-fdc7-4df0-89ee-88b5397a4b28"
}Delete a plan group
Delete a plan group by its external ID, including the group's relationship to its plans. The plans themselves are not deleted.
Endpoint: DELETE /data/plans
Request body:
{
"id": "plan_123"
}Example response:
{
"success": true,
"id": "b8d2d779-fdc7-4df0-89ee-88b5397a4b28"
}