# Update automatic payments

`PATCH https://console.advinservers.com/api/v1/client/billing/autopay`

### Overview

Send `default` with the `uuid` of a saved card or PayPal account to make it the default method, `pays_from_credit` to choose whether the account credit pays as much of every invoice as it can, and `enabled` to turn automatic payments for the whole account on or off. All are optional. Turning them on is refused while the account has no saved method, and charges anything already due. Each change applies to every service. Turning automatic payments on or off stops every automatic payment a service set up on its own, so the default method pays for it while they are on and nothing does while they are off. Setting `pays_from_credit` to false turns off the account credit setting of each service. If a service cannot be changed, the setting is still saved and the request answers with an error naming that service. Returns the updated setting.

### 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.

## Body

Sent as `application/json`.

- `enabled` (boolean): The value of `enabled`.
- `default` (string<uuid>): The value of `default`.
- `pays_from_credit` (boolean): The value of `pays_from_credit`.

## Response 200

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

- `enabled` (boolean, required): Whether every service and postpaid invoice is charged to the default method.
- `pays_from_credit` (boolean, required): Whether the account credit pays as much of every invoice as it can when it is due, with automatic payments on or off.
- `credit_available` (boolean, required): Whether that can be chosen: account credit is offered and the billing system can apply it to every service.
- `methods` (object[], required): Saved cards and PayPal accounts, the default first.
  - `uuid` (string, required): The uuid UUID.
  - `uuid_short` (string, required): The value of `uuid_short`.
  - `type` (string, required): `card` or `paypal`.
  - `label` (string, required): How the method is named, such as "Visa ending 4242" or the PayPal account's email address.
  - `brand` (string | null, required): The card network as Stripe names it, such as `visa` or `amex`. Null for PayPal.
  - `last_four` (string | null, required): A card's last four digits, null for PayPal.
  - `expires` (string | null, required): A card's expiry as `MM/YY`, null for PayPal.
  - `is_default` (boolean, required): Whether everything is charged to this method while automatic payments are on for the whole account.
  - `service_ids` (integer[], required): The services whose renewals are charged to it on their own.
  - `created_at` (string, required): The date and time for created at, in UTC.
- `cards_available` (boolean, required): Whether a card can be added, and whether a PayPal account can.
- `paypal_available` (boolean, required): The value of `paypal_available`.

```json
{
  "enabled": true,
  "pays_from_credit": true,
  "credit_available": true,
  "methods": [
    {
      "uuid": "b71cfb0d-abab-4721-9254-622be47149cb",
      "uuid_short": "Uuid short",
      "type": "Type",
      "label": "Label",
      "brand": "Brand",
      "last_four": "Last four",
      "expires": "Expires",
      "is_default": true,
      "service_ids": [
        1
      ],
      "created_at": "2026-09-14T16:42:09.000000Z"
    }
  ],
  "cards_available": true,
  "paypal_available": true
}
```

## 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.
- `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 PATCH \
  --url 'https://console.advinservers.com/api/v1/client/billing/autopay' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "enabled": true,
  "default": "7fe48e10-0de5-4155-96c6-2bbb86202e50",
  "pays_from_credit": true
}'
```
