# Save or replace the card auto top-up charges

> POST /v1/billing/auto-top-up/card. .

Source: https://legion.ambient.xyz/docs/api/billing/create-auto-top-up-card

`POST https://api.legion.ambient.xyz/v1/billing/auto-top-up/card`

Authenticate with an API key: `Authorization: Bearer $LEGION_API_KEY`.

. Returns a Stripe Checkout page (setup mode: nothing is charged) where the person saves a card for
auto top-up, with 3D Secure when the card supports it, so later charges made without the cardholder are
exempt where the bank allows. Stripe sends them back to the web app's Spend page. A new card replaces the
one on file and resumes a paused auto top-up; it does not turn auto top-up on. Requires `billing.topup`
(owners). At most 10 an hour per organization (429 `rate_limited`). A test organization cannot save a card
while Stripe runs with live keys (409 `test_org_live_payment`). Payments failing or not answering within 3
seconds is 503 `payments_unavailable`.

## Responses

### 201

The Checkout page.

- `checkout_url`, string (uri), required: Stripe Checkout's page for saving the card.
- `expires_at`, string (date-time), required: When the page stops working.

Example:

```json
{
  "checkout_url": "https://example.com",
  "expires_at": "2026-10-15T12:00:00Z"
}
```

### 401

Missing, unknown, expired or revoked credentials.

### 403

The caller lacks the permission this operation requires (`forbidden`),
or signed in without having joined an organization yet
(`no_organization`; `getOnboarding` and the invitation and
organization operations under it work), or could not sign in
(`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to
session tokens.

`access_not_approved`: a signed-in person who is not approved
for the beta yet. Every operation that takes a credential answers it to
them, except `getMe` and `joinMyWaitlist`; the problem carries
`access` (`waitlisted` or `not_requested`, and the email). Approved
means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.

`oauth_token_mcp_only`: the caller sent an OAuth access token (`lgo_`), which is accepted
only by `mcpMessage` and the tool calls it dispatches. Every other operation answers it, whatever
the token's scope. Use an API key or the Legion web app.

`org_suspended`: the caller's organization is suspended. Every operation that takes a
credential answers it, by session or API key, except `getMe` (which shows `org.suspended_at` and
`org.suspension_reason`) and the support operations under `/v1/support/`.

`terms_not_accepted`: an approved caller who has not accepted
the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, except `getMe`,
`acceptLegalDocuments`, `joinMyWaitlist` and the wind-down operations
(`listRentals`, `stopRental`, `deleteRental`, `listHosts`,
`updateListing` with `listed` false, `removeHost`); the problem
carries `legal`. An API key acts for the person who created it, so it
is refused until that person accepts. Terminal
operations also return
`session_required` (called with an API key) and `step_up_required`
(neither a sign-in nor a step-up challenge within the step-up window).

### 409

The resource's current state does not allow the operation. `legal_versions_stale`: a legal document version sent is not the current one; the
problem's `legal` holds the current documents.

### 429

Rate limited (`code` is `rate_limited`), or the organization asked the
pull-through mirror to copy in too many different tags or digests of one
repository today (`mirror_quota_exceeded`). Retry after the `Retry-After`
seconds.

### 500

An unexpected server error. Safe to retry.

### 503

The payments service failed or did not answer within 3 seconds
(`payments_unavailable`). Nothing changed; retry with backoff.

## Errors

- 403 [`no_organization`](https://legion.ambient.xyz/docs/errors#no_organization)
- 409 [`test_org_live_payment`](https://legion.ambient.xyz/docs/errors#test_org_live_payment)
- 429 [`rate_limited`](https://legion.ambient.xyz/docs/errors#rate_limited)
- 503 [`payments_unavailable`](https://legion.ambient.xyz/docs/errors#payments_unavailable)

## Example request

```sh
curl -s -X POST "https://api.legion.ambient.xyz/v1/billing/auto-top-up/card" \
  -H "Authorization: Bearer $LEGION_API_KEY"
```
