Subscriptions
Terminate a subscription
This endpoint allows you to terminate a subscription.
DELETE
/api/v1/subscriptions/{external_id}
Bearer*
{
"subscription": {
"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__"
EXTERNAL_ID="__YOUR_SUBSCRIPTION_ID__"
curl --location --request DELETE "$LAGO_URL/api/v1/subscriptions/$EXTERNAL_ID?status=pending" \
--header "Authorization: Bearer $API_KEY"
Authorizations
Authorizationheaderrequired
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
external_idrequired
string
External ID of the existing subscription
Query Parameters
status
string
If the field is not defined, Lago will terminate only active
subscriptions. However, if you wish to cancel a pending
subscription, please ensure that you include status=pending
in your request.
Response
200 - application/json
subscriptionrequired
object
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
EXTERNAL_ID="__YOUR_SUBSCRIPTION_ID__"
curl --location --request DELETE "$LAGO_URL/api/v1/subscriptions/$EXTERNAL_ID?status=pending" \
--header "Authorization: Bearer $API_KEY"
{
"subscription": {
"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"
}
}