> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flouci.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Subscription

> Stop a subscription immediately or at the end of the period the customer has already paid for.

Cancels a subscription. By default the cancellation is immediate; with `at_period_end: true` the customer keeps what they paid for and no further charge is made once the current period ends.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://developers.flouci.com/api/v2/subscriptions/s7Qm3kLpTq2e9hZx0bYw1A/cancel' \
    -H 'Authorization: Bearer <PUBLIC_KEY>:<PRIVATE_KEY>' \
    -H 'Content-Type: application/json' \
    -d '{ "at_period_end": true }'
  ```
</RequestExample>

### Path Parameters

<ParamField path="subscription_id" type="string" required>
  The subscription to cancel.
</ParamField>

### Body

<ParamField body="at_period_end" type="boolean" default="false">
  `false` cancels now: the subscription becomes `canceled` at once and, if the first charge was still unpaid, the checkout can no longer be paid. `true` only flags the subscription (`cancel_at_period_end: true`); it stays `active` until `current_period_end`, then is canceled instead of renewed. Allowed only on `active` or `past_due` subscriptions.
</ParamField>

<ResponseExample>
  ```json Canceled now theme={null}
  {
    "success": true,
    "result": {
      "subscription_id": "s7Qm3kLpTq2e9hZx0bYw1A",
      "status": "canceled",
      "cancel_at_period_end": false,
      "canceled_at": "2026-10-12T10:41:07+01:00",
      "cancellation_initiator": "merchant",
      "cancellation_reason": null,
      "next_charge_at": null,
      "current_period_start": "2026-09-30T14:05:48+01:00",
      "current_period_end": "2026-10-30T00:00:00+01:00"
    },
    "name": "developers",
    "code": 0,
    "version": "v2"
  }
  ```

  ```json Scheduled at period end theme={null}
  {
    "success": true,
    "result": {
      "subscription_id": "s7Qm3kLpTq2e9hZx0bYw1A",
      "status": "active",
      "cancel_at_period_end": true,
      "canceled_at": null,
      "cancellation_initiator": "merchant",
      "cancellation_reason": null,
      "next_charge_at": "2026-10-30T09:00:00+01:00"
    },
    "name": "developers",
    "code": 0,
    "version": "v2"
  }
  ```

  ```json Error (409) theme={null}
  {
    "success": false,
    "message": "subscription_terminal",
    "name": "developers",
    "code": 1,
    "version": "v2"
  }
  ```
</ResponseExample>

The `result` object is the full subscription, as on [Get Subscription](/api-reference/recurring-payments/get-subscription) — the examples above are abridged.

### Errors

| HTTP | `message` | Meaning |
| - | - | - |
| 404 | `subscription_not_found` | Unknown `subscription_id` for your merchant. |
| 409 | `subscription_terminal` | The subscription is already `canceled` or `incomplete_expired`. |
| 409 | `subscription_not_active` | `at_period_end: true` on a subscription that is not `active` or `past_due` (an `incomplete` one has no period to end — cancel it immediately instead). |

<Info>
  You receive `subscription.canceled` for an immediate cancel and `subscription.updated` when a period-end cancel is scheduled — see [Webhooks](/api-reference/recurring-payments/webhooks). The customer is notified in the Flouci app in both cases.
</Info>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.