> For the complete documentation index, see [llms.txt](https://docs.meganova.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meganova.ai/api-reference/platform-api/get-credit-balance/auto-pay.md). Agents can also search and read this documentation through its [MCP server](https://docs.meganova.ai/~gitbook/mcp).

# Auto-Pay Settings

Read and update auto-top-up settings so your balance never runs out mid-workload.

Auto-pay automatically charges your default payment method when your credit balance drops below a threshold, topping you up by a fixed amount. Use these endpoints to read and change your configuration.

> **Prerequisite:** Enabling auto-pay requires a default Stripe payment method on file. Attempting to enable without one returns `400`.

## Get Auto-Pay Settings

### HTTP Request

`GET` `{API_URL}/payment/auto-pay`

### Response

```json
{
  "data": {
    "enabled": true,
    "top_up_threshold": "100.00",
    "top_up_amount": "50.00"
  },
  "message": "Auto-pay settings retrieved successfully",
  "status": "success"
}
```

If you've never configured auto-pay, the endpoint auto-creates defaults and returns them (`enabled=false`, `top_up_threshold=100.00`, `top_up_amount=50.00`).

### Example

```bash
curl -X GET '{API_URL}/payment/auto-pay' \
  -H 'Authorization: Bearer {TOKEN/KEY}'
```

## Update Auto-Pay Settings

### HTTP Request

`PUT` `{API_URL}/payment/auto-pay`

### Body Parameters

| Parameter          | Required | Type    | Description                                      |
| ------------------ | -------- | ------- | ------------------------------------------------ |
| `enabled`          | Yes      | bool    | Turn auto-pay on or off                          |
| `top_up_threshold` | Yes      | decimal | Balance at or below which a top-up fires, in USD |
| `top_up_amount`    | Yes      | decimal | Amount to charge per top-up, in USD              |

### Example

```bash
curl -X PUT '{API_URL}/payment/auto-pay' \
  -H 'Authorization: Bearer {TOKEN/KEY}' \
  -H 'Content-Type: application/json' \
  -d '{
    "enabled": true,
    "top_up_threshold": 50.00,
    "top_up_amount": 100.00
  }'
```

### Errors

| Status | Reason                                                               |
| ------ | -------------------------------------------------------------------- |
| `400`  | Account inactive, or `enabled=true` without a default payment method |

## Related

* [Low-Balance Alerts](https://docs.meganova.ai/api-reference/platform-api/get-credit-balance/low-balance-alert.md) — Non-charging email/notification alerts at a balance threshold
* [User Credit Balance](https://docs.meganova.ai/api-reference/platform-api/get-credit-balance.md)
* [Get Payment History](https://docs.meganova.ai/api-reference/platform-api/get-credit-balance/get-payment-history.md)
