---
title: "Buy prepaid credit with x402 or MPP (see Paying a 402 in docs/API.md)"
method: POST
path: "/api/credits"
---

# Buy prepaid credit with x402 or MPP (see Paying a 402 in docs/API.md)

`POST /api/credits`

## Request

- Base URL: `https://api.askingahuman.com`
- URL: `https://api.askingahuman.com/api/credits`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Without a payment, answers 402 with an x402 PAYMENT-REQUIRED header and MPP WWW-Authenticate: Payment challenges for amountCents. Retry with the payment (x402: PAYMENT-SIGNATURE; MPP: Authorization: Payment plus the key in X-API-Key) and the key is credited once. Credit pays for live sessions when the key has no card. Test keys can't buy credit.

## Request body

- object
  - `amountCents` integer, required

## Response `200`

Credited

- object
  - `creditedCents` integer
  - `alreadyCredited` boolean
  - `reference` string, nullable
  - `balanceCents` integer
  - `currency` string

## Other responses

- `400`: amountCents must be a whole number from 500 to 50000
- `401`: Missing or invalid API key
- `402`: Payment required: x402 and MPP challenges in the headers, the same in the body
- `403`: Test keys never pay
- `429`: Too many requests
- `503`: Buying credit isn't available on this API right now

---

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