BillKit/Docs Console
Subscriptions

Cancel a subscription

Ends a subscription at the end of the current period, so the customer keeps the access they have already paid for.

POST/v1/subscriptions/{subscription_id}/cancel
Operation cancel_subscription · Scope subscriptions:cancel · Spec snapshot 2026-09-13

Parameters

ParameterDescription
subscription_idstring · pathrequiredNo description in the spec.

Returns

The subscription with cancel_at_period_end set. Cancellation is always at the period boundary; there is no immediate-termination variant.

Until that boundary passes the customer is still on a live subscription and can change their mind: reactivate clears the pending cancellation with no new checkout. Cancelling an already-cancelling subscription returns the unchanged row, so a retried call converges on one state.

Test it

Cancel in a sandbox, then advance the test clock past current_period_end and watch the status settle to canceled with no further invoice.

Errors

Status Cause
401 Missing or invalid API key.
403 Key is missing the subscriptions:cancel scope.
404 No such object, or it belongs to the other mode.
422 Validation Error
429 Rate limited. Back off and retry.
Request · curl
curl -X POST https://api.billkit.eu/v1/subscriptions/sub_9XKp2vQ1/cancel \
  -H "Authorization: Bearer $BILLKIT_SECRET_KEY"
Response · 200 OK
{
  "cancel_at_period_end": false,
  "canceled_at": 1789392000,
  "cancellation_reason": "string",
  "created": 1789392000,
  "current_period_end": 0,
  "current_period_start": 0,
  "customer": {
    "country_code": "NL",
    "email": "ada@example.com",
    "id": "obj_9XKp2vQ1",
    "name": "Ada Lovelace",
    "object": "customer.summary"
  },
  "customer_id": "cus_9XKp2vQ1",
  "dunning_attempts_notified": 0,
  "dunning_last_notified_at": 1789392000,
  "dunning_max_attempts": 0,
  "id": "sub_9XKp2vQ1",
  "last_payment_at": 1789392000,
  "last_payment_id": "pay_9XKp2vQ1",
  "livemode": false,
  "mrr_cents": 1900,
  "object": "subscription",
  "payment_count": 0,
  "price": {
    "active": false,
    "amount_cents": 1900,
    "currency": "EUR",
    "id": "obj_9XKp2vQ1",
    "interval": "string",
    "object": "price.summary",
    "payment_methods": [
      "string"
    ],
    "product_id": "prod_9XKp2vQ1",
    "product_name": "Ada Lovelace",
    "trial_days": 0,
    "unit_amount_decimal": "string",
    "usage_type": "string"
  },
  "price_id": "price_9XKp2vQ1",
  "refund_eligibility": {
    "amount_cents": 1900,
    "currency": "EUR",
    "days_remaining": 0,
    "eligible": false,
    "object": "refund_eligibility",
    "reason": "string"
  },
  "renewal_state": "string",
  "serves_customer": false,
  "status": "string",
  "trial_end": 0,
  "trial_start": 0
}