---
title: "Set the workspace auto-refill settings"
method: PUT
path: "/v1/billing/auto-refill"
tags: ["billing"]
---

# Set the workspace auto-refill settings

`PUT /v1/billing/auto-refill`

## Request

- Base URL: `https://api.patricia.app` (the document declares no server; this is the origin it was published from)
- URL: `https://api.patricia.app/v1/billing/auto-refill`
- Auth: HTTP bearer

Create or replace the tenant's auto-refill config (enable/threshold/amount/cap).

## Headers

- `X-Tenant-Id` string, nullable

## Request body

- AutoRefillConfigUpdate: PUT body: set (upsert) a tenant's auto-refill config. A full replace of the tenant's single config (1:1), so the dashboard's "save" posts the whole desired state. ``amount`` must equal a ladder rung's credit count (that's the price we charge off-session); ``monthly_cap >= amount >= MIN_AUTO_REFILL_CREDITS`` and ``threshold >= 0`` mirror the model validators.
  - `enabled` boolean, required
  - `threshold` union, required
    - number
    - string
  - `amount` union, required
    - number
    - string
  - `monthly_cap` union, required
    - number
    - string

## Response `200`

Successful Response

- AutoRefillConfigView: GET view of a tenant's auto-refill config (the dashboard toggle + thresholds). ``enabled`` is derived from ``enabled_at`` (opt-in gate); ``armed_at`` is never exposed (engine-internal). All credit values are whole-credit ints for display.
  - `enabled` boolean, required
  - `threshold` integer, required
  - `amount` integer, required
  - `monthly_cap` integer, required

## Other responses

- `400`: Malformed request (unknown plan, or no billing account yet).
- `401`: Unauthorized
- `403`: Forbidden. Inspect response body `code` for the specific reason (for example: PERMISSION_DENIED, EMAIL_NOT_VERIFIED, TENANT_ACCESS_REQUIRED, ROLE_UNRESOLVED)
- `409`: Conflict
- `422`: Validation error
- `502`: The payment provider call failed.
- `503`: Billing is not configured on this deployment.

---

[API](https://skmtc.dev/patricia/apis/patricia-api.md) · [All operations](https://skmtc.dev/patricia/apis/patricia-api/llms.txt) · [OpenAPI document](https://skmtc.dev/patricia/apis/patricia-api/revisions/0dfb44495ea1?raw)
