Billing API
Subscription, payment methods, and invoices (accept.blue). Dual auth: Bearer or dashboard session. Billing is for organization owners and admins: an API key sees it only while the user who created it is an owner or admin of the key's organization (a platform super-admin creator counts as an owner), checked on every request. Any other key is refused with 403 BILLING_ROLE_REQUIRED.
- GET
/billing/subscriptionGet current subscription - POST
/billing/subscription/upgradeUpgrade plan - POST
/billing/subscription/upgrade-previewPreview an upgrade - POST
/billing/subscription/downgradeDowngrade plan - POST
/billing/subscription/cancelCancel subscription - GET
/billing/payment-methodsList payment methods - POST
/billing/payment-methodsAdd a payment method - PATCH
/billing/payment-methods/{id}Update a payment method - DELETE
/billing/payment-methods/{id}Remove a payment method - PATCH
/billing/payment-methods/{id}/defaultSet default payment method - GET
/billing/invoicesList invoices - POST
/billing/invoices/payPay the oldest open invoice - GET
/billing/invoices/{id}Get an invoice - GET
/billing/tokenization-configGet hosted-tokenization config
GET /billing/subscription
Get current subscription
Auth: API key (Authorization: Bearer). Scopes: billing:read, billing:manage.
Returns the org's current subscription and plan snapshot.
Requires one of the following scopes: billing:read, billing:manage. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Responses
200 Success
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | Current subscription + plan snapshot. |
data.plan_type | string | |
data.plan_name | string | |
data.billing_interval | string | Example |
data.price_monthly | number | |
data.status | string | Example |
data.current_period_start | string (date-time) | null | |
data.current_period_end | string (date-time) | null | |
data.pending_plan_change | string | null | |
data.pending_plan_change_at | string (date-time) | null | |
data.payment_provider | string | null | |
data.has_payment_method | boolean |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/subscription/upgrade
Upgrade plan
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Upgrades the plan. Only monthly billing is available (annual was removed).
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Request body application/json required
| Field | Type | Description |
|---|---|---|
plan | string required | |
interval | string | Always |
expected_charge_cents | integer | null | What the caller states it disclosed to the customer, in cents — the Optional for Bearer callers, until tax applies. An API client has no page, so omitting the field skips the comparison and the upgrade proceeds — unless the upgrade carries sales tax (California, from 2027-01-01), which is never charged undisclosed: that request is refused Required in practice of a browser. A session-authenticated request that omits it is answered The value is never charged. It is only compared against the server's own recomputed proration; if they differ the upgrade is refused with |
Responses
200 Upgraded
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | Accepts any keys |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
409 Refused before the gateway; nothing was charged by this request and no subscription row was touched.
- disclosure_required — a session-authenticated (browser) request omitted expected_charge_cents. The page is stale: reload it, re-read the price, and retry. From 2027-01-01 a Bearer request that omits it is also refused this way when the upgrade carries sales tax: error.details.charge_amount_cents is the taxed total and error.details.tax_cents the tax — show the customer that total, then retry sending it as expected_charge_cents. Not refused this way: a same-day retry of an upgrade that already charged (it completes on that charge) or a sandbox gateway; if an earlier upgrade charge may still be in flight the request is refused with a prior-attempt error instead.
- amount_changed — the disclosed figure no longer matches the server's recomputed proration. error.details.charge_amount_cents carries the current figure; re-disclose it before retrying. When the only difference is sales tax added to a pre-tax figure, error.details.tax_cents carries the tax.
The code is in error.code.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string | Which refusal fired. Both are refused before the gateway. One of: |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/subscription/upgrade-preview
Preview an upgrade
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Answers "what happens if I upgrade to this plan, and what does it cost me today" without charging or writing anything.
The sentence and the figure come back together, from one server-side decision, so a caller cannot show one number and send another: echo disclosed_charge_cents back as expected_charge_cents on POST /billing/subscription/upgrade and the server refuses to charge anything else.
Always 200, including for a refusal. disclose: false is a successful answer to the question — render message and keep the confirm control disabled.
POST rather than GET because it reads an org's billing state and so is CSRF-protected for the browser path. Requires the billing:manage scope.
Request body application/json required
| Field | Type | Description |
|---|---|---|
plan | string required | Target plan key. |
interval | string | Always |
Responses
200 The disclosure to show before offering the upgrade.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.disclose | boolean required |
|
data.reason | string | null | Why the upgrade was refused, or |
data.message | string required | The complete sentence to show the customer. True whether or not the upgrade can proceed. |
data.disclosed_charge_cents | integer | null required | Exactly what |
data.charge_label | string | null |
|
data.monthly_label | string | null | The plan's recurring monthly price, formatted. |
data.plan_name | string | null | Display name for the target plan. |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/subscription/downgrade
Downgrade plan
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Request body application/json required
| Field | Type | Description |
|---|---|---|
plan | string required |
Responses
200 Downgrade scheduled/applied
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | Accepts any keys |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/subscription/cancel
Cancel subscription
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Request body application/json
| Field | Type | Description |
|---|---|---|
reason | string |
Responses
200 Cancelled
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | Accepts any keys |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
GET /billing/payment-methods
List payment methods
Auth: API key (Authorization: Bearer). Scopes: billing:read, billing:manage.
Payment methods belong to the org's billing account (shared across member orgs). Only active methods are listed. A key with billing:read but not billing:manage gets each row without billing_address_line1 and billing_address_line2; city, state and ZIP are still returned.
Requires one of the following scopes: billing:read, billing:manage. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Responses
200 Success
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | array of object required | |
data[].id | integer | |
data[].type | string | One of: |
data[].is_default | boolean | integer | |
data[].card_brand | string | null | |
data[].card_last_four | string | null | |
data[].card_exp_month | integer | string | null | |
data[].card_exp_year | integer | string | null | |
data[].bank_name | string | null | |
data[].bank_last_four | string | null | |
data[].billing_name | string | null | |
data[].status | string | |
data[].created_at | string (date-time) | |
data[].billing_address_line1 | string | null | Omitted when the calling API key does not hold |
data[].billing_address_line2 | string | null | Omitted when the calling API key does not hold |
data[].billing_address_city | string | null | |
data[].billing_address_state | string | null | |
data[].billing_address_zip | string | null | |
data[].address_problem | object | null | Set when the billing address needs fixing, otherwise |
data[].address_problem.code | string | |
data[].address_problem.message | string | |
data[].is_expired | boolean | |
data[].can_make_default | boolean |
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/payment-methods
Add a payment method
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Request body application/json required
| Field | Type | Description |
|---|---|---|
payment_token | string required | |
method | string | One of: |
billing_name | string | |
card_brand | string | |
card_last_four | string | |
card_exp_month | integer | |
card_exp_year | integer | |
bank_name | string | |
bank_last_four | string | |
billing_address_line1 | string required | Street address. PO boxes are refused ( max length 200 |
billing_address_line2 | string | Optional second address line. max length 100 |
billing_address_city | string required | max length 100 |
billing_address_state | string required | Two-letter US state, DC, territory or military ( |
billing_zip | string required | Billing ZIP code. Note the name: the create body uses |
set_default | boolean | Make this the default payment method. The first payment method on the account is always the default. |
Responses
201 Payment method added
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | A short summary of the stored method, not the full |
data.id | integer required | |
data.type | string required |
One of: |
data.is_default | boolean required | |
data.card_brand | string | null required | |
data.card_last_four | string | null required | |
data.existing | boolean | Present only when the card was already on file and that row was updated instead of a new one being created. Always |
data.address_pending | boolean required |
|
data.address_problem | object | Present only when the card was stored but its billing address has a problem to fix. Never sent together with |
data.address_problem.code | string | |
data.address_problem.message | string |
400 Refused. error.code is one of:
- an address code (street_required, street_invalid, street_too_long, po_box, line2_invalid, line2_too_long, city_required, city_invalid, city_too_long, state_required, state_invalid, zip_required, zip_invalid), or another reason code when the address cannot be matched to a tax location. Nothing was stored.
- billing_email_required: the account has no billing email. Add one, then retry.
- billing_email_unavailable: the billing email could not be loaded. Retry.
- card_not_recorded: the card could not be saved, or the processor's answer was not known. Check GET /billing/payment-methods before retrying.
- bad_request: anything else, for example a payment_token that does not start with nonce-, tkn-, pm- or ref- ("Invalid payment token").
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
PATCH /billing/payment-methods/{id}
Update a payment method
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Edits a saved card's cardholder name, expiry or billing address. The card number cannot be changed. Only the fields present in the body are touched. Sending any address field re-validates the whole address, merged with the stored one. A body with no recognised change returns 400 "Nothing to update"; make_default on its own counts as no change. An unknown id returns 400 "Payment method not found", not 404. The key's creator must be an organization owner or admin (403 BILLING_ROLE_REQUIRED).
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | path | integer required | Payment method id |
Request body application/json required
| Field | Type | Description |
|---|---|---|
billing_name | string | Cardholder name. Trimmed; must not be empty. Cut to 255 characters. |
card_exp_month | integer | min 1 · max 12 |
card_exp_year | integer | The resulting month and year must not be in the past. A missing half is taken from the stored card. min 2000 · max 2099 |
billing_address_line1 | string | max length 200 |
billing_address_line2 | string | max length 100 |
billing_address_city | string | max length 100 |
billing_address_state | string | |
billing_address_zip | string | Note the name: the create body uses |
make_default | boolean | Must be exactly |
Responses
200 Payment method updated
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.id | integer | |
data.billing_name | string | null | |
data.card_exp_month | integer | string | null | |
data.card_exp_year | integer | string | null | |
data.billing_address_zip | string | null | |
data.billing_address_line1 | string | null | |
data.billing_address_line2 | string | null | |
data.billing_address_city | string | null | |
data.billing_address_state | string | null | |
data.address_pending | boolean |
|
data.is_default | boolean |
400 Refused. A refused address carries its own error.code (street_required, street_invalid, street_too_long, po_box, line2_invalid, line2_too_long, city_required, city_invalid, city_too_long, state_required, state_invalid, zip_required, zip_invalid, or another reason code when the address cannot be matched to a tax location). Every other refusal has code bad_request and one of these messages: "Payment method not found", "Cardholder name is required", "Expiry month must be between 1 and 12", "Expiry year is not valid", "That expiry date has already passed", "Nothing to update", "This card was just changed somewhere else. Please reload and try again.", "Could not save those changes", or the payment processor's own error text.
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
DELETE /billing/payment-methods/{id}
Remove a payment method
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | path | integer required | Payment method id |
Responses
204 Removed
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
PATCH /billing/payment-methods/{id}/default
Set default payment method
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | path | integer required | Payment method id |
Responses
200 Default set
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.id | integer |
400 Invalid request (validation errors under error.details.validation_errors).
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
GET /billing/invoices
List invoices
Auth: API key (Authorization: Bearer). Scopes: billing:read, billing:manage.
Invoices for the org's billing account. Pagination is returned inside data (items/total/limit/offset), not the top-level meta.
Requires one of the following scopes: billing:read, billing:manage. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
limit | query | integer | Max items to return (1-100). Default |
offset | query | integer | Number of items to skip. Default |
Responses
200 Success
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.items | array of object | |
data.items[].id | integer | |
data.items[].invoice_number | string | null | |
data.items[].status | string | One of: |
data.items[].reversal_kind | string | null | How the invoice was reversed. One of: |
data.items[].source | string | null | |
data.items[].created_by_admin | integer | null | |
data.items[].period_start | string (date) | null | |
data.items[].period_end | string (date) | null | |
data.items[].subtotal_cents | integer | null | |
data.items[].tax_cents | integer | null | |
data.items[].total_cents | integer | null | |
data.items[].reversed_total_cents | integer | null | Cents reversed on this invoice. |
data.items[].currency | string | null | |
data.items[].paid_at | string (date-time) | null | |
data.items[].due_date | string (date) | null | |
data.items[].created_at | string (date-time) | |
data.items[].line_items | array of object | Only on the single-invoice GET. |
data.total | integer | |
data.limit | integer | |
data.offset | integer | |
data.account_id | integer |
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
POST /billing/invoices/pay
Pay the oldest open invoice
Auth: API key (Authorization: Bearer). Scope: billing:manage.
Charges the oldest open invoice on the organization's billing account. It never charges any other invoice. invoice_id and amount_cents confirm what the caller was shown; they do not select an invoice. If either is missing, or they do not match the oldest open invoice's id and total_cents, nothing is charged and the request fails with amount_changed. If the account owes nothing the result is nothing_due, whatever the body holds.
This operation has its own limit of 3 requests per minute and 10 per hour per organization, for Bearer and session callers alike. Over it the response is 429 with a Retry-After header and the body {"success": false, "error": "Rate limit exceeded. Try again in N seconds.", "retry_after": N}, which is not the usual error envelope.
The key's creator must be an organization owner or admin (403 BILLING_ROLE_REQUIRED).
Requires the billing:manage scope. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Request body application/json
| Field | Type | Description |
|---|---|---|
invoice_id | integer | Id of the invoice the caller expects to pay. Needed for any charge to run. |
amount_cents | integer | The invoice's |
Responses
200 Paid, or nothing was owed. Read state.
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.state | string required |
One of: |
data.message | string required | Customer-facing text. |
data.reinstated | boolean required |
|
data.invoice_number | string | The invoice charged. Not sent for |
data.amount_cents | integer | The amount charged. Not sent for |
data.balance_unread | boolean | Only for |
400 Not paid. error.code is the outcome and error.message is customer-facing text; no details are sent.
- amount_changed: invoice_id and amount_cents were missing or no longer match the oldest open invoice, or the invoice was reissued with sales tax. Nothing was charged. Re-read the invoice and retry.
- declined: the card was declined.
- no_payment_method: there is no usable payment method on file.
- needs_billing_address: the payment method needs a billing address before it can be charged.
- in_flight: a payment for this invoice is already in progress.
- unrecorded: the card WAS charged but the payment is not recorded yet. Do not pay again.
- gateway_unavailable: the payment processor could not be reached.
- account_closed: the billing account is closed.
- no_account: no billing account was found for the organization.
- error: the payment could not be completed for another reason; see error.message.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string | One of: |
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded. This operation's own limit (3 per minute, 10 per hour per organization) answers with the first body shape, where error is a plain string; the per-key limit answers with the usual envelope.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | string required | Human-readable message, for example |
retry_after | integer required | Seconds to wait before retrying. Same value as the |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
GET /billing/invoices/{id}
Get an invoice
Auth: API key (Authorization: Bearer). Scopes: billing:read, billing:manage.
Returns the full invoice with its decoded line_items.
Requires one of the following scopes: billing:read, billing:manage. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | path | integer required | Invoice id |
Responses
200 Success
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | A billing invoice. List responses return the summary columns below; the single-invoice GET returns the full row plus a decoded line_items array. |
data.id | integer | |
data.invoice_number | string | null | |
data.status | string | One of: |
data.reversal_kind | string | null | How the invoice was reversed. One of: |
data.source | string | null | |
data.created_by_admin | integer | null | |
data.period_start | string (date) | null | |
data.period_end | string (date) | null | |
data.subtotal_cents | integer | null | |
data.tax_cents | integer | null | |
data.total_cents | integer | null | |
data.reversed_total_cents | integer | null | Cents reversed on this invoice. |
data.currency | string | null | |
data.paid_at | string (date-time) | null | |
data.due_date | string (date) | null | |
data.created_at | string (date-time) | |
data.line_items | array of object | Only on the single-invoice GET. |
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
404 Resource not found (also returned for cross-tenant ids to avoid existence leaks).
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
GET /billing/tokenization-config
Get hosted-tokenization config
Auth: API key (Authorization: Bearer). Scopes: billing:read, billing:manage.
Frontend config for accept.blue hosted card tokenization (script URL + public tokenization key). Use this to collect a payment_token for POST /billing/payment-methods.
Requires one of the following scopes: billing:read, billing:manage. Session authentication also works for browser (dashboard) contexts; this operation documents the Bearer path.
Responses
200 Success
Headers: X-Request-ID, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-API-Key-Expires-At, X-API-Key-Expires-In-Days
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
data | object required | |
data.provider | string | |
data.tokenization_key | string | |
data.public_key | string | |
data.script_url | string | |
data.mode | string | |
data.configured | boolean |
401 Missing or invalid API key.
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
403 Authenticated but not permitted (insufficient scope uses the auth envelope with code INSUFFICIENT_SCOPE; policy/plan denials use the router envelope).
Headers: X-Request-ID
Response fields
Shape 1 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.code | string required | e.g. MISSING_AUTH, INVALID_API_KEY, INSUFFICIENT_SCOPE, RATE_LIMIT_EXCEEDED. |
error.message | string required | |
error.retry_after | integer | Seconds; present on 429 only. |
Shape 2 of 2
| Field | Type | Description |
|---|---|---|
success | boolean required | Always |
error | object required | |
error.message | string required | |
error.code | string required | Machine-readable error code, e.g. bad_request, not_found. |
error.details | object | null | Optional; validation failures put field errors under details.validation_errors. Accepts any keys |
429 Rate limit exceeded.
Headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Request-ID
Ready to build on Vosy?
API access is included with the Business and Enterprise plans. Sign up, choose a plan with API access, and create your own keys from the Vosy API page in your account. Compare plans
Get Started