---
title: "Buy credit now: charges the card on file, or answers with a payment link when there is none [admin or billing role]"
method: POST
path: "/preview/billing/credits"
tags: ["billing"]
---

# Buy credit now: charges the card on file, or answers with a payment link when there is none \[admin or billing role\]

`POST /preview/billing/credits`

## Request

- Base URL: `https://autoresearch.sfcompute.com`
- URL: `https://autoresearch.sfcompute.com/preview/billing/credits`
- Auth: HTTP bearer

Buy credit now (admin or billing role): `amount_usd` in whole cents, $10 to $10,000. Credit is the only way compute is paid for: the balance is the limit at every door, compute stops at zero with every disk kept, and credit starts it again on the next run_command or create. A new account starts with $0 and no card. With a verified card on file, the card is charged and the answer carries the new balance; `pending: true` means the card network is still settling the charge and the credit appears when it does - never buy again before get_billing shows it. With no card on file, nothing is charged: the answer carries `payment_url`, a payment page for that amount. Give it to the person who pays. One payment there adds the credit and saves the card, and after that buy_credits charges the card directly and set_auto_topup works. Calling again for the same amount returns the same open link. A decline names the reason; the card itself changes on the billing page (the refusal carries the link). set_auto_topup keeps the balance funded without asking every time.

## Query parameters

- `workspace` string

## Request body

- object
  - `amount_usd` number, double, required: Dollars to add now: whole cents, $10 to $10,000 (e.g. 100, or 49.99). Charged to the card on file; with no card on file, the amount of the payment link the answer carries.
  - `org` string, nullable: Organization (uuid or name); omitted = your active org.

## Response `200`

The capability's JSON result.

- Result: The capability's result: the same object the MCP tool returns as structuredContent. Resources carry an `object` type discriminator and an immutable id; money is integer micro-dollars in `*_usd_micros` fields.
  - `object` string: The resource type, when the result is one resource.

## Other responses

- `400`: Malformed request: bad JSON, a parameter that does not parse, or a value outside its range. Code `invalid`.
- `401`: No bearer token, or one this API cannot verify. Code `unauthenticated`.
- `403`: Authenticated, but the token's scopes or the account's role do not reach this operation. The message names the scope word to request. Code `forbidden`.
- `404`: No such route. Code `not_found`; the body names the OpenAPI document.
- `422`: A well-formed request the platform declined: no such node, a cap reached, a state that forbids the move. The message says which, and what to do instead. Code `refused`.
- `429`: Over this door's per-customer budget. Wait `Retry-After` seconds. Code `rate_limited`.
- `500`: Our fault. Retry; if it persists, quote the request-id. Code `internal`.

---

[API](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api.md) · [All operations](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/givemeanode/apis/autoresearch-customer-api/revisions/f88dcb70ac6c?raw)
