curl --request POST \
--url https://app.saasybill.com/api/v1/subscriptions/{id}/end \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"when": "period_end"
}
'{
"id": "9d4e2b7a-13c5-4f8e-b6a0-2e1d7c9f5b33",
"object": "subscription",
"customer": "3b9f1c1e-6a52-4c0e-9d7e-1f6f2f0b7a11",
"customer_code": "ACME-001",
"plan": "b6c1e0a4-2f7d-4a61-8f0c-5d3e9a7b2c44",
"status": "active",
"currency": "AUD",
"interval": {
"unit": "month",
"count": 1
},
"timezone": "Australia/Sydney",
"start_date": "2026-09-30",
"renewal_date": "2026-10-30",
"end_date": "2026-10-30",
"units": 10,
"minimum_units": 5,
"discount_percent": "10.00",
"cancel_at_period_end": true,
"end_after_cycles": null,
"label": "Acme – Team plan",
"invoice_reference": "PO-4471",
"renewal_value": "108.0000",
"created": "2026-09-30T04:12:00.000Z"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Provide a valid API key as `Authorization: Bearer <key>`.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "permission_error",
"code": "insufficient_scope",
"message": "This API key does not have the `subscriptions:write` scope.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "not_found",
"code": "subscription_not_found",
"message": "There is no subscription with that id.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "conflict",
"code": "idempotency_conflict",
"message": "This `Idempotency-Key` was used with a different request. Use a new key for a different request.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "`units`: Invalid input: expected number, received string",
"param": "units",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Try again in 12 seconds.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "Something went wrong on our side. Retry the request; if it keeps failing, quote the request id.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}End a subscription
curl --request POST \
--url https://app.saasybill.com/api/v1/subscriptions/{id}/end \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"when": "period_end"
}
'{
"id": "9d4e2b7a-13c5-4f8e-b6a0-2e1d7c9f5b33",
"object": "subscription",
"customer": "3b9f1c1e-6a52-4c0e-9d7e-1f6f2f0b7a11",
"customer_code": "ACME-001",
"plan": "b6c1e0a4-2f7d-4a61-8f0c-5d3e9a7b2c44",
"status": "active",
"currency": "AUD",
"interval": {
"unit": "month",
"count": 1
},
"timezone": "Australia/Sydney",
"start_date": "2026-09-30",
"renewal_date": "2026-10-30",
"end_date": "2026-10-30",
"units": 10,
"minimum_units": 5,
"discount_percent": "10.00",
"cancel_at_period_end": true,
"end_after_cycles": null,
"label": "Acme – Team plan",
"invoice_reference": "PO-4471",
"renewal_value": "108.0000",
"created": "2026-09-30T04:12:00.000Z"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Provide a valid API key as `Authorization: Bearer <key>`.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "permission_error",
"code": "insufficient_scope",
"message": "This API key does not have the `subscriptions:write` scope.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "not_found",
"code": "subscription_not_found",
"message": "There is no subscription with that id.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "conflict",
"code": "idempotency_conflict",
"message": "This `Idempotency-Key` was used with a different request. Use a new key for a different request.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_parameter",
"message": "`units`: Invalid input: expected number, received string",
"param": "units",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Try again in 12 seconds.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "Something went wrong on our side. Retry the request; if it keeps failing, quote the request id.",
"request_id": "req_4f1a9c2e7b8d3a605e1c9f02"
}
}subscriptions:write scope. See Authentication.Authorizations
An API key. Its scopes decide what it may call: customers:read (List and look up customers.) customers:write (Create customers, and Xero contacts where the organisation allows it.) catalogue:read (List plans and charges.) subscriptions:read (List and look up subscriptions.) subscriptions:write (Create subscriptions, change units, end and restore them.) invoices:read (List and look up invoices.)
Headers
1 to 255 printable characters. A retry with the same key and body returns the first response.
1 - 255"signup_8f3a2c1d"
Path Parameters
The Saasybill id of the subscription.
"9d4e2b7a-13c5-4f8e-b6a0-2e1d7c9f5b33"
Body
now, period_end With when: now: also delete the subscription's invoices that were never sent, in Xero. Default false.
With when: now: also void its approved, unpaid invoices in Xero. Default false.
Response
Success.
"subscription"pending, active, complete, ended Show child attributes
Show child attributes
YYYY-MM-DD, in the subscription's own timezone.
YYYY-MM-DD, in the subscription's own timezone.
YYYY-MM-DD, in the subscription's own timezone.
A decimal string, e.g. "19.9900".
A decimal string, e.g. "19.9900".
ISO 8601, UTC.
Was this page helpful?