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

# Purchase credits handler

> **Required scope:** billing:write

**Required scope:** `billing:write`

### Request body

`PurchaseCreditsRequest`

<ParamField body="amount_dollars" type="number (double)" required>
  Amount in dollars to purchase as prepaid credits.
</ParamField>

### Response

No response body. Credit purchase initiated.

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Credit purchase initiated                          |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `404` | No Stripe customer for this org                    |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/billing/credits/purchase' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "amount_dollars": 1.5
  }'
  ```
</RequestExample>
