Skip to main content
POST
Give promotional credit

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

Body

application/json
customerId
string
required
Example:

"ctm_123"

amount
number
required

Major units of currency.

Example:

2000

reason
string
required
Maximum string length: 255
Example:

"Launch promotion"

currency
string
Example:

"NGN"

expiresAt
string<date-time> | null

In the future. Leave out for credit that never expires.

customData
object | null

Response

Credit grant response.

data
object
required

A lot of granted credit. What is left on it is the sum of its movements, so remaining is what the next invoice can spend.

meta
object
required