Skip to main content
POST
Add a charge to a plan

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

plan
string
required

Body

application/json
name
string
required
code
string | null
Pattern: ^[A-Za-z0-9_-]+$
firstChargeName
string

Names the plan's first charge when it is still unnamed.

taxCategory
enum<string> | null
Available options:
standard,
zero_rated,
exempt,
null
revenueCode
string | null
unitLabel
string | null

What one of the charge's quantity is called ("learner"). Empty or null removes it, and its plural with it.

Maximum string length: 40
unitLabelPlural
string | null

The plural ("learners"); left out, it is unitLabel with an "s".

Maximum string length: 40
customData
object | null

Response

Charge response.

data
object
required
meta
object
required