Developer documentation

Cancel subscription

post https://app.iteras.dk/api/customers/cancelsubscription/

The /api/customers/cancelsubscription/ endpoint stops a subscription, either immediately or later. Stopping a subscription requires computing what's been delivered and what's owed. There is usually an amount up until the given stop time which should still be paid, and an amount afterwards which may have already been invoiced. The latter is credited automatically by the stop.

If the stop is in the future, there's the question of when the stop is executed. Generally, Iteras tries to execute the stop as soon as possible, computing and setting a future end date on the relevant period.

Parameters

  • id string required
    ID of the customer the subscription belongs to.
  • subscription_id string required
    ID of the subscription to stop.
  • stop_at string
    When the subscription should stop, e.g. 2026-11-30T22:41:08. The default is now.
  • exclude_from_webhooks bool Defaults to false
    Set to true to keep every event the request causes from being sent to webhooks, invoice and payment events included, e.g. "exclude_from_webhooks": true. The events are still added to the history.

Examples

POST /api/customers/cancelsubscription/ HTTP/1.1
Content-Type: application/json{
  "id": "12345",
  "subscription_id": "32142532",
  "stop_at": "2026-11-30T22:41:08"
}

Return value

On success the endpoint returns the ID of the cancelled subscription:

{ "subscription_id": "32142532" }

Errors

Invalid requests due to programming error, e.g. invalid JSON, returns 400.

A well-formed operation where a supplied value is invalid is not executed and returns an HTTP 422 error. The response is a JSON object with the errors keyed by the field they concern, e.g. an invalid stop_at:

{
  "stop_at": ["Cannot be a date in the past"]
}

Errors that are not specific to a field are returned with the empty string as key, e.g. an unknown subscription:

{
  "": ["Subscription does not exist."]
}