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

# Top Up Credits API

> Buy Smart Prospect top-up credits with your saved card, safely retryable with an Idempotency-Key - POST /billing/topup

> [!NOTE]
>
> **Credit cost:** Spends no Smart Prospect credits. It charges your saved card for a credit pack and adds those credits.

> [!NOTE]
>
> This endpoint requires your API key: pass it as the `api_key` query parameter, or in an `X-API-Key` or `Authorization: Bearer` header (see [Authentication](https://api.smartlead.ai/authentication.md)).

> [!WARNING]
>
> This call **charges your saved card**. With an API key you must send an `Idempotency-Key` header, so a retry after a timeout never charges twice.

## Headers

**Idempotency-Key** `string` *required*

A unique value per purchase, 1 to 255 visible ASCII characters. A UUID is the usual choice. Required for API-key callers.

* The same key from the same account within 24 hours returns the **first response again** (with the response header `Idempotent-Replayed: true`) and does not charge again.
* Every outcome is kept for the key, failures included, because a failed or timed-out charge may still have gone through. To try a new purchase after a failure, first check your top-up history, then use a **new** key.

## Request Body

Send an empty JSON object (`{}`). No fields are accepted.

```bash cURL theme={null}
curl -X POST "https://prospect-api.smartlead.ai/api/v1/search-email-leads/billing/topup" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Idempotency-Key: 6f1c2f8e-6a52-4d1b-9a0e-2c3d4e5f6a7b" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Response Fields

**success** `boolean`

`true` when the card was charged

**message** `string`

`Top-up successful.`

**data** `object`

**data**

**payment\_intent\_id** `string`

ID of the card payment

**amount\_paid\_cents** `integer`

Amount charged, in cents

**credits\_purchased** `integer`

Credits added

**plan\_credits\_remaining** `integer`

Plan credits left

**topup\_credits\_remaining\_after** `integer`

Top-up credits left after this purchase

**expires\_at** `string | null`

When the top-up credits expire

## Idempotency errors

| Status | `error` | Meaning | What to do |
| - | - | - | - |
| `400` | `idempotency_key_required` | API-key call without an `Idempotency-Key` header | Send one (for example a UUID) |
| `400` | `invalid_idempotency_key` | The key is empty, longer than 255 characters, or has characters outside visible ASCII | Use a valid key |
| `409` | `idempotency_key_in_progress` | A top-up with this key is still running, or its outcome is unknown | Retry with the **same** key in a minute to read its result. If it persists, check your top-up history before using a new key |
| `503` | `idempotency_unavailable` | The key could not be checked. Nothing was charged | Retry with the same key |

Other failures (no saved card, plan does not allow top-ups, top-up limit reached) return their own status and `error`, and are replayed for the same key like any other outcome.

```json 200 - Charged theme={null}
{
  "success": true,
  "message": "Top-up successful.",
  "data": {
    "payment_intent_id": "pi_example",
    "amount_paid_cents": 4900,
    "credits_purchased": 1000,
    "plan_credits_remaining": 250,
    "topup_credits_remaining_after": 1000,
    "expires_at": null
  }
}
```

```json 400 - No Idempotency-Key theme={null}
{
  "success": false,
  "message": "Send an Idempotency-Key header (for example a UUID) with every API top-up. Retrying with the same key never charges twice.",
  "error": "idempotency_key_required"
}
```

```json 409 - Same key still running theme={null}
{
  "success": false,
  "message": "A top-up with this Idempotency-Key is still in progress or its outcome is unknown. Retry with the same key in a minute to read its result; if this persists, check GET /billing/topup/history before using a new key.",
  "error": "idempotency_key_in_progress"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.