Accounts — Core API
Account management endpoints. An Account is your billing and administrative entity in AuthPI—it contains Issuers, manages billing, and holds administrative memberships.
Base URL: https://api.authpi.com — explore every endpoint in the
interactive Core API reference.
GET/v1/accounts
List Accounts
List all accounts the authenticated user has access to
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | Optional | |
cursor | string | Optional |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Accounts retrieved successfully | object |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
GET/v1/accounts/{account_id}
Get Account
Retrieve an account by ID
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Account retrieved successfully | object |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
PATCH/v1/accounts/{account_id}
Update Account
Update an account's settings
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Request body
Content type: application/json
| Property | Type | Required | Description |
|---|---|---|---|
owner_user_id | string | Optional | User ID |
domains | object[] | Optional | |
metadata | Metadata | Optional | |
name | string | null | Optional | A name for the resource. |
description | string | null | Optional | A description for the resource. Markdown supported. |
logo_url | string | null | Optional | A URL |
contact | object | null | Optional |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Account updated successfully | object |
| 400 | Bad Request - The request is malformed or contains invalid data. | ApiError |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
| 412 | Precondition Failed - The resource has been modified since the provided ETag. | PreconditionFailedError |
GET/v1/accounts/{account_id}/credits/ledger
List Account Credit Ledger
List account credit ledger entries, most recent first
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | Optional | |
cursor | string | Optional |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Credit ledger retrieved successfully | object |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
GET/v1/accounts/{account_id}/usage
Get Account Usage by Dimension
Usage-by-dimension billing rollup for a UTC month (YYYY-MM): the rated amount per pricing dimension (from the posted statement lines) plus the metered unit count, for reconciliation. Statement lines are posted by the monthly billing run; for an in-progress period the rated amounts may be empty while counts are still available.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
period | string | Required | Billing period (UTC month) |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Usage rollup retrieved successfully | UsageByDimension |
| 400 | Bad Request - The request is malformed or contains invalid data. | ApiError |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
GET/v1/accounts/{account_id}/usage/estimate
Get Current-Period Usage Estimate
Month-to-date view of the in-progress billing period (AUT-220), shaped by the period's billing profile:
- postpaid_subscription →
estimate: true: live metered counts and capacity intervals dry-run through the same rating engine the monthly billing run uses, including the trial waiver. A projection, not a statement — nothing is written to the ledger, and late-arriving events may still shift the final statement. - prepaid_credit →
estimate: false: month-to-date actuals summed from the real-time credit-ledger draw-down (prepaid accounts are billed as usage happens; the monthly run skips them).
Use GET /v1/accounts/:id/usage?period=YYYY-MM for CLOSED periods — that reads the posted statement lines, which are the billable record.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Usage estimate retrieved successfully | object |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
GET/v1/accounts/{account_id}/invoices
List Account Invoices
Billed periods for the account, newest first — one row per period the monthly billing run has settled (AUT-220). Each row carries the settlement status (pending | settled | uncollectible | skipped), the signed period total (μUSD), and — when the period was settled through Stripe — the hosted_invoice_url (where the invoice is viewed and paid; open invoices can be paid there) and the invoice_pdf download link.
Link fields are fetched from the payment provider best-effort: the list still renders (with null links) if the provider is unreachable or the period settled without an external invoice (e.g. a no-charge trial month).
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | Optional | Max periods to return |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Invoices retrieved successfully | object |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
POST/v1/accounts/{account_id}/credits/topups
Create Account Credit Top-up
Settle an x402 payment and add prepaid credits to the account
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Request body
Content type: application/json
| Property | Type | Required | Description |
|---|---|---|---|
amount_μusd | integer | Required |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Credit top-up settled successfully | object |
| 400 | Invalid request | — |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 402 | x402 payment required (challenge), payer wallet not in the method's allowlist, or settlement failed at the facilitator | — |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
| 409 | Payment method was revoked or its allowlist tightened between the on-chain settlement and the credit write. The payment is recorded on-chain (response includes payment_reference) and queued for manual reconciliation; do not retry — contact support with the payment_reference. | — |
| 502 | x402 facilitator unavailable | — |
POST/v1/accounts/{account_id}/payment-methods
Add x402 Payment Method
Register an x402 payment method on the account. At most one active x402 method per account.
Implicit billing_mode change: billing_mode is derived from the count of active payment methods (gated when ≥1, ungated when 0), unless an operator override is set. Adding the first method on an account flips the derived billing_mode to "gated" automatically; removing the only method flips it back to "ungated". There is no public API to write billing_mode directly — operators with a need to pin it (e.g. force-ungated for a grandfathered customer) use the internal setGatingOverride RPC.
Stripe methods are not customer-creatable through this endpoint. Stripe binding requires a Setup Intent flow (not yet exposed); for now, AuthPI staff provision Stripe methods directly via internal tooling. Sending a Stripe payload here returns 400.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Request body
Content type: application/json
| Property | Type | Required | Description |
|---|---|---|---|
type | x402 | Required | |
label | string | Optional | |
allowed_payer_wallets | string[] | Optional | |
auto_topup_increment_μusd | integer | Optional |
Responses
| Code | Description | Schema |
|---|---|---|
| 201 | x402 payment method added | object |
| 400 | Bad Request - The request is malformed or contains invalid data. | ApiError |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
POST/v1/accounts/{account_id}/payment-methods/stripe/setup-intent
Create Stripe Setup Intent
Start the add-card flow for Stripe billing (AUT-220). Returns a SetupIntent client_secret the console confirms with Stripe.js (card entry happens client-side; card data never touches AuthPI).
On successful confirmation, Stripe delivers setup_intent.succeeded to the AuthPI webhook, which provisions the account's Stripe payment method (at most one active per account — re-carding replaces the previous method). The saved card is then auto-charged by the monthly billing run; accounts without a card receive an emailed hosted invoice instead.
Returns 400 when Stripe payments are not configured for this environment.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
Responses
| Code | Description | Schema |
|---|---|---|
| 201 | Setup intent created | object |
| 400 | Bad Request - The request is malformed or contains invalid data. | ApiError |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
PATCH/v1/accounts/{account_id}/payment-methods/{method_id}
Update Account Payment Method
Update mutable fields on a payment method (label, enabled state, x402 batching/restrictions). Disabling a method starts a 15-second grace window during which in-flight settlements still complete.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
method_id | string | Required | Payment Method ID |
Request body
Content type: application/json
| Property | Type | Required | Description |
|---|---|---|---|
label | string | null | Optional | |
enabled | boolean | Optional | |
allowed_payer_wallets | array | null | Optional | |
auto_topup_increment_μusd | integer | null | Optional |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Payment method updated | object |
| 400 | Bad Request - The request is malformed or contains invalid data. | ApiError |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |
DELETE/v1/accounts/{account_id}/payment-methods/{method_id}
Remove Account Payment Method
Soft-remove a payment method. Terminal — the method is retained in the list for audit but no longer accepted for settlements.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | Required | Account ID |
method_id | string | Required | Payment Method ID |
Responses
| Code | Description | Schema |
|---|---|---|
| 204 | Payment method removed | — |
| 401 | Unauthorized - Authentication is required or has failed. | ApiError |
| 403 | Forbidden - You don't have permission to perform this action. | ApiError |
| 404 | Not Found - The requested resource does not exist. | ApiError |