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

# Update auto top-off settings

` PUT /api/v1/credits/auto-topoff `

Update auto top-off settings

## Servers

- ` https://littledemo.com ` — Production

## Authentication

The operation accepts these alternatives. Schemes within one alternative are required together.

### Alternative 1

- ` bearerAuth `: ` http `

  - HTTP scheme: ` bearer `

  - Live API key, for example `Authorization: Bearer ld_live_...`.

### Alternative 2

- ` cookieAuth `: ` apiKey `

  - Credential: ` better-auth.session_token ` in ` cookie `

  - Dashboard session cookie.

## Request body (optional)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` enabled `, ` packId `

  - ` enabled `: type ` boolean `

  - ` packId `: type ` string `

    - enum: ` ["5","20","50","100"] `

## Responses

### ` 200 ` — Updated auto top-off config

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` enabled `, ` packId `

  - ` enabled `: type ` boolean `

  - ` packId `: type ` string `

    - enum: ` ["5","20","50","100"] `

### ` 400 ` — Invalid pack

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

### ` 401 ` — Unauthorized

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` error `

  - ` error `: type ` string `

## Request examples

### cURL

```curl
curl -X PUT 'https://littledemo.com/api/v1/credits/auto-topoff' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "enabled": true,
  "packId": "5"
}'
```

### JavaScript

```javascript
const response = await fetch('https://littledemo.com/api/v1/credits/auto-topoff', {
  method: 'PUT',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "enabled": true,
    "packId": "5"
  })
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.put('https://littledemo.com/api/v1/credits/auto-topoff', headers=headers, json={
  "enabled": true,
  "packId": "5"
})
print(response.json())
```