> For the complete documentation index, see [llms.txt](https://bountyv.gitbook.io/vdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bountyv.gitbook.io/vdocs/account/topup.md).

# Top up balance

Create a crypto payment invoice that credits your account balance once the payment confirms on-chain.

```
POST /api/v1/topup
```

Synchronous — the call itself returns immediately with an invoice link. Crediting the balance happens later, asynchronously, when the payment provider confirms the on-chain transaction (typically 1–15 minutes).

## Authentication

Requires a Bearer API key. See [Authentication](/vdocs/authentication.md).

## Request

**Content-Type:** `application/json`

| Field          | Type   | Required | Default       | Description                                                                                     |
| -------------- | ------ | -------- | ------------- | ----------------------------------------------------------------------------------------------- |
| `amount_usd`   | number | ✅        | —             | USD amount to credit. Minimum `25`, maximum `10000`                                             |
| `crypto_asset` | string | —        | `"usdttrc20"` | Which coin to pay with. Supported: `usdttrc20`, `usdterc20`, `btc`, `eth`, `ltc`, `sol`, `doge` |

`usdttrc20` (Tether on Tron) has the fastest confirmation and the lowest network fees — use it unless you specifically need another asset.

## Response

```json
{
  "topup_id": "abc123",
  "invoice_url": "https://substance-api.com/api/v1/pay/abc123",
  "amount_usd": 100,
  "status": "pending",
  "message": "Visit invoice_url to complete payment. Balance credited automatically on confirmation."
}
```

| Field         | Type   | Description                                                                       |
| ------------- | ------ | --------------------------------------------------------------------------------- |
| `topup_id`    | string | Reference ID for this top-up                                                      |
| `invoice_url` | string | URL on our domain to open in a browser to pay — proxies the upstream payment page |
| `amount_usd`  | number | The amount you requested                                                          |
| `status`      | string | Always `"pending"` on creation                                                    |
| `message`     | string | Human-readable instructions                                                       |

HTTP status: `200 OK`.

## Completing payment

`invoice_url` points at `GET /api/v1/pay/{topup_id}` — a public link with no Bearer auth required (the `topup_id` itself is the unguessable token, so it's safe to open directly in a browser or hand off to whoever is actually paying).

```
GET /api/v1/pay/{topup_id}
```

* Open it in a browser — it `302`s to the upstream payment page (card/crypto address and exact amount).
* Pay from your wallet and wait for on-chain confirmation.
* Once confirmed, your balance is credited automatically server-side — no polling or notification call is required from you.
* Confirm the credit landed by calling [`GET /api/v1/credits`](/vdocs/account/credits.md).

Requesting the pay link again after the payment has already completed, or after it has failed/expired, returns `410 Gone` instead of redirecting.

## Example

```bash
curl -X POST https://substance-api.com/api/v1/topup \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": 100, "crypto_asset": "usdttrc20"}'
```

## Errors

| Status | When                                                                                 |
| ------ | ------------------------------------------------------------------------------------ |
| `400`  | `amount_usd` outside 25–10,000, or the request body fails validation — see `details` |
| `401`  | Missing, malformed, or revoked API key                                               |
| `403`  | Account disabled — contact support                                                   |
| `429`  | Rate limit exceeded for your key                                                     |
| `502`  | Invoice creation failed at the payment provider — safe to retry                      |
| `503`  | Top-up temporarily unavailable (payment provider not configured)                     |

The `GET /api/v1/pay/{topup_id}` redirect additionally returns `404` if the ID doesn't exist, and `410` once the payment has already been completed, has failed, or has expired.

See [Errors](/vdocs/errors.md) for the full error format.

## Pricing

Billed per call — see [Credits & pricing](/vdocs/account/credits.md) for current rates. Note that `topup` itself isn't a billable action; it's how you add funds, not spend them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bountyv.gitbook.io/vdocs/account/topup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
