Skip to main content
POST
Set an auto-reload

Authorizations

Authorization
string
header
required

Use a Bouclay secret key (sk_test_..., sk_live_...) or restricted key (rk_test_..., rk_live_...).

A secret key can call every endpoint. A restricted key can only call the endpoints its scopes cover. A scope is {resource}:{access}, for example customers:read or refunds:write, and write includes read. GET requests need read access and everything else needs write, except POST /subscriptions/{id}/items/{item}/preview, which only needs subscriptions:read. A request outside the key's scopes gets 403 permission_denied naming the missing scope, and its Idempotency-Key is not used up.

Publishable keys (pk_...) are rejected by server-side API endpoints. A key's mode scopes what it can see and charge: a test key can never reach a live card.

Headers

Idempotency-Key
string
required

Required for POST and PATCH requests. Replays identical method + path + body requests and rejects mismatched re-use.

Required string length: 1 - 255

Path Parameters

customer
string
required

Body

application/json
threshold
number
required

Buys when the projected credit is at or below this, in major units.

Required range: x >= 0
Example:

5000

amount
number
required

What each top-up costs and the credit it gives, in major units. At least the minimum charge.

Example:

20000

currency
string

Defaults to the customer's.

Example:

"NGN"

paymentMethod
string | null

A saved card of this customer's. Left out or null, their default card when it buys.

expiresAfterMonths
integer | null

How long the credit it buys lasts, from payment. Null never expires.

Required range: 1 <= x <= 120
enabled
boolean
default:true

Response

Auto-reload response.

data
object
required

A customer's auto-reload in one currency: when their projected credit is at or below threshold, it buys amount of prepaid credit on a saved card, once per fall.

meta
object
required