Subscriptions
List all subscriptions
This endpoint retrieves all active subscriptions.
GET
/api/v1/subscriptions
Bearer*
{
"meta": {
"current_page": "2",
"next_page": "3",
"prev_page": "1",
"total_count": "70",
"total_pages": "4"
},
"subscriptions": [
{
"billing_time": "anniversary",
"canceled_at": "2022-09-14T16:35:31Z",
"created_at": "2022-08-08T00:00:00Z",
"downgrade_plan_date": "null",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Repository A",
"next_plan_code": "null",
"plan_code": "premium",
"previous_plan_code": "null",
"started_at": "2022-08-08T00:00:00Z",
"status": "active",
"subscription_at": "2022-08-08T00:00:00Z",
"terminated_at": "2022-09-14T16:35:31Z"
}
]
}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/subscriptions?external_customer_id=123&plan_code=starter&status[]=pending" \
--header "Authorization: Bearer $API_KEY"
Authorizations
Authorizationheaderrequired
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Query Parameters
page
integer
Page number.
per_page
integer
Number of records per page.
external_customer_id
string
The customer external unique identifier (provided by your own application)
plan_code
string
The unique code representing the plan to be attached to the customer. This code must correspond to the code property of one of the active plans.
status
enum<string>[]
If the field is not defined, Lago will return only active
subscriptions. However, if you wish to fetch subscriptions by different status you can define them in a status[] query param. Available filter values: pending
, canceled
, terminated
, active
.
Available options:
pending
, canceled
, terminated
, active
Response
200 - application/json
metarequired
object
subscriptionsrequired
object[]
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request GET "$LAGO_URL/api/v1/subscriptions?external_customer_id=123&plan_code=starter&status[]=pending" \
--header "Authorization: Bearer $API_KEY"
{
"meta": {
"current_page": "2",
"next_page": "3",
"prev_page": "1",
"total_count": "70",
"total_pages": "4"
},
"subscriptions": [
{
"billing_time": "anniversary",
"canceled_at": "2022-09-14T16:35:31Z",
"created_at": "2022-08-08T00:00:00Z",
"downgrade_plan_date": "null",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Repository A",
"next_plan_code": "null",
"plan_code": "premium",
"previous_plan_code": "null",
"started_at": "2022-08-08T00:00:00Z",
"status": "active",
"subscription_at": "2022-08-08T00:00:00Z",
"terminated_at": "2022-09-14T16:35:31Z"
}
]
}