# Cancel an automatic payment

`POST https://console.advinservers.com/api/v1/client/billing/subscriptions/{subscription}/cancel`

### Overview

Stops a subscription at the end of its paid period. The service continues to run, and future invoices must be paid manually. To stop the service, use the service cancellation endpoint. `can_cancel` indicates whether cancellation is allowed. Subscriptions belonging to another account return 404.

### Permissions

Requires the account permission `billing.manage` (Manage billing).

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Path parameters

- `subscription` (string, required): The subscription ID.

## Response 200

The record, as a JSON object. There is no envelope.

- `uuid` (string, required): The uuid UUID.
- `uuid_short` (string, required): The value of `uuid_short`.
- `provider` (string, required): The payment provider, such as `card`, `paypal`, or `stripe`.
- `status` (string, required): The payment provider's current status.
- `is_healthy` (boolean, required): Whether the resource is healthy.
- `is_cancelled` (boolean, required): Whether the resource is cancelled.
- `is_ending` (boolean, required): Whether the resource is ending.
- `description` (string | null, required): What it was bought as. The fallback name for a row whose services have gone away.
- `billing_cycle` (string | null, required): How often the service renews and is billed.
- `amount` (string | null, required): Excludes tax.
- `currency` (string | null, required): The three-letter currency code used for monetary amounts.
- `next_charge_at` (string | null, required): The next charge date, or null if no further payments are scheduled. Ending subscriptions have no next charge date. If the payment provider has not reported a date, this is the next due date of the earliest service covered.
- `ends_at` (string | null, required): When the agreed cancellation actually takes effect.
- `cancelled_at` (string | null, required): The date and time for cancelled at, in UTC.
- `last_paid_at` (string | null, required): The date and time for last paid at, in UTC.
- `can_cancel` (boolean, required): Whether the subscription can still be cancelled through its payment provider.
- `services` (object[], required): The value of `services`.
  - `service_id` (integer, required): The service id ID.
  - `name` (string | null, required): The name shown to customers.
  - `hostname` (string | null, required): The fully qualified hostname.
  - `status` (string | null, required): The value of `status`.
  - `next_due_date` (string | null, required): The value of `next_due_date`.
  - `server_id` (string | null, required): The server id ID.
  - `server` (object | null, required): The machine itself, where the account still holds one for this service. Null for anything else a subscription pays for, and for a server that has since been handed back.
    - `id` (string, required): The id ID.
    - `name` (string, required): The name shown to customers.
    - `hostname` (string, required): The fully qualified hostname.
    - `location` (string, required): The city the server stands in, e.g. "Nuremberg, DE".
    - `windows` (boolean, required): The value of `windows`.
    - `template_name` (string | null, required): The value of `template_name`.
    - `template_icon_url` (string | null, required): The value of `template_icon_url`.
  - `is_known` (boolean, required): Whether the resource is known.
- `cancellation_service_id` (integer | null, required): For external payments, use the service autopay cancellation endpoint.
- `paypal_account` (string | null, required): The email address of the saved PayPal account it is charged to, when it is one.

```json
{
  "uuid": "a216c52c-ccea-430f-b3bf-09aaf1025a44",
  "uuid_short": "Uuid short",
  "provider": "card",
  "status": "active",
  "is_healthy": true,
  "is_cancelled": false,
  "is_ending": true,
  "description": "Standard 4 GB · Kansas City, MO · Monthly",
  "billing_cycle": "monthly",
  "amount": "12.00",
  "currency": "USD",
  "next_charge_at": null,
  "ends_at": "2026-10-02T19:15:08+00:00",
  "cancelled_at": null,
  "last_paid_at": "2026-09-02T19:15:08+00:00",
  "can_cancel": false,
  "services": [
    {
      "service_id": 7312,
      "name": "Standard 4 GB",
      "hostname": "lambda-core.blackmesa.example.com",
      "status": "Active",
      "next_due_date": "2026-10-02",
      "server_id": "ecc6f4f1",
      "server": {
        "id": "ecc6f4f1",
        "name": "lambda-core",
        "hostname": "lambda-core.blackmesa.example.com",
        "location": "Kansas City, MO",
        "windows": false,
        "template_name": "Ubuntu 24.04",
        "template_icon_url": "/assets/icons/ubuntu.png"
      },
      "is_known": true
    }
  ],
  "cancellation_service_id": null,
  "paypal_account": "Paypal account"
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `404`: The resource was not found in the selected team. Resources in another account or team also return 404.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/billing/subscriptions/{subscription}/cancel' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json'
```
