Billing — API reference
The plan, subscription, invoices, billing profile and AI credits. Keys need the `account` scope (app session tokens have every scope). Invoices, the billing profile and the account's usage need `billing:read`; changes and credit purchases need `billing:manage` (403 `billing_forbidden`). Subscriptions renew automatically; there are no refunds.
← All groups
AI credits: balance, packs, purchases and usage
With `billing:read` the usage and purchases are the account's (`usage_scope: account`); otherwise the person's own usage only (`mine`).
Scope: account
· billing.credits
Parameter In Type Description
feature query string provider query string kind query string usage | purchase | … from query string (date-time) to query string (date-time) limit query integer Usage rows, default 50, at most 500
Responses 200 · 401 · 403 · 429
200 Success
credits *
AiCredits
fields
AiCredits
available
number
balance
number
can_buy
boolean
held
number
low
boolean
malaleem_connected
boolean
out
boolean
packs
[object]
fields
amount_minor
integer
credits
number
currency
string
key
string
name
string
prices
any
The price table
purchases
[AiCreditPurchase]
The last 10 (empty without billing:read)
fields
AiCreditPurchase
amount_minor
integer
approval
object | null
fields
expires_at
string | null
message
string
poll
string
Where to poll
type
string
created_at
string (date-time)
credits
number
currency
string
failure_reason
string | null
id
string (uuid)
pack
string
paid_at
string | null
status
string
paid | pending | failed
tax_minor
integer
total_minor
integer
terms
[string]
totals
object
fields
calls
integer
cost_minor
number
credits
number
tokens_in
integer
tokens_out
integer
usage
[AiCreditEntry]
fields
AiCreditEntry
at
string (date-time)
balance_after
number
cost_usd
number | null
credits
number
Negative for usage
credits_exact
string
feature
string | null
feature_label
string
id
string (uuid)
kind
string
model
string | null
provider
string | null
tier
string | null
tokens_in
integer | null
tokens_out
integer | null
unit
string | null
units
number | null
user_id
string | null
usage_scope
"account" | "mine"
401 Problem details (401)
403 Problem details (403)
429 Problem details (429)
Example
POST
/api/v1/ai/credits/purchase
Buy an AI credit pack
Paid from the account's connected Malaleem account. 201 when paid and credited; 202 when the payment waits for approval in the Malaleem app (poll `GET /api/v1/ai/credits/purchases/{id}`). A retry with the same idempotency key returns the same purchase. Needs `billing:manage`.
Scope: account
· Idempotency-Key
· billing.purchase
Parameter In Type Description
Idempotency-Key header string Alternative to `idempotency_key`
Request body application/json
idempotency_key
string
pack *
string
A pack key from `GET /api/v1/ai/credits`
Responses 201 · 401 · 402 · 403 · 409 · 422 · 429
201 Success
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
purchase *
AiCreditPurchase
fields
AiCreditPurchase
amount_minor
integer
approval
object | null
fields
expires_at
string | null
message
string
poll
string
Where to poll
type
string
created_at
string (date-time)
credits
number
currency
string
failure_reason
string | null
id
string (uuid)
pack
string
paid_at
string | null
status
string
paid | pending | failed
tax_minor
integer
total_minor
integer
401 Problem details (401)
402 `payment_failed` …
Problem
code *
string
Stable machine-readable code (snake_case)
detail
string
A sentence an app can show
error
object | string
Legacy member kept for existing clients (deprecated)
errors
object
Field → messages, for validation errors
instance
string
The request path
message
string
Legacy member of the mobile sign-in errors (deprecated)
request_id
string
status *
integer
title *
string
type
string (uri)
A URI identifying the problem type (https://recordsender.com/problems/<code>)
403 Problem details (403)
409 `malaleem_not_connected` (+`connect_path`)
Problem
code *
string
Stable machine-readable code (snake_case)
detail
string
A sentence an app can show
error
object | string
Legacy member kept for existing clients (deprecated)
errors
object
Field → messages, for validation errors
instance
string
The request path
message
string
Legacy member of the mobile sign-in errors (deprecated)
request_id
string
status *
integer
title *
string
type
string (uri)
A URI identifying the problem type (https://recordsender.com/problems/<code>)
422 `unknown_pack`, `billing_country_required` or `billing_subdivision_required` (+`profile_path`)
Problem
code *
string
Stable machine-readable code (snake_case)
detail
string
A sentence an app can show
error
object | string
Legacy member kept for existing clients (deprecated)
errors
object
Field → messages, for validation errors
instance
string
The request path
message
string
Legacy member of the mobile sign-in errors (deprecated)
request_id
string
status *
integer
title *
string
type
string (uri)
A URI identifying the problem type (https://recordsender.com/problems/<code>)
429 Problem details (429)
Example
GET
/api/v1/ai/credits/purchases/{id}
One credit purchase
Scope: account
· billing.purchase_show
Parameter In Type Description
id * path string (uuid)
Responses 200 · 401 · 403 · 404 · 429
200 Success
purchase *
AiCreditPurchase
fields
AiCreditPurchase
amount_minor
integer
approval
object | null
fields
expires_at
string | null
message
string
poll
string
Where to poll
type
string
created_at
string (date-time)
credits
number
currency
string
failure_reason
string | null
id
string (uuid)
pack
string
paid_at
string | null
status
string
paid | pending | failed
tax_minor
integer
total_minor
integer
401 Problem details (401)
403 Problem details (403)
404 Problem details (404)
429 Problem details (429)
Example
The account's plan, subscription and renewal
Scope: account
· billing.show
Responses 200 · 401 · 403 · 429
200 Success
billing *
BillingSummary
fields
BillingSummary
account_kind
"individual" | "business"
connection
object | null
The Malaleem connection
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
ends_at
any
When a cancelled subscription ends (false otherwise)
plan
object | null
fields
key
string
name
string
price
string
read_only
boolean
read_only_reason
string | null
renewal
object | null
fields
at
string | null
currency
string
items
[object]
reverse_charge
boolean
seats
integer
subtotal_minor
integer
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
any
total_minor
integer
status
string
The account's billing status (trialing, active, retrying, unpaid …)
subscription
object | null
fields
addons
object
cancel_at_period_end
boolean
cancelled_at
string | null
current_period_end
string | null
current_period_start
string | null
dunning_attempts
integer
last_failure_reason
string | null
next_attempt_at
string | null
seats
integer
status
string
trial_ends_at
string | null
tax
any
tax_place_ready
boolean
The billing profile has what tax needs
terms
any
trial
object | null
fields
ai_needs_credits
boolean
days_left
integer
ends_at
string (date-time)
first_charge_at
string | null
plan_chosen
boolean
401 Problem details (401)
403 Problem details (403)
429 Problem details (429)
Example
POST
/api/v1/billing/cancel
Cancel at the end of the period
Scope: account
· Idempotency-Key
· billing.cancel
Request body application/json
Responses 200 · 401 · 402 · 403 · 409 · 422 · 429
200 Success
billing *
BillingSummary
fields
BillingSummary
account_kind
"individual" | "business"
connection
object | null
The Malaleem connection
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
ends_at
any
When a cancelled subscription ends (false otherwise)
plan
object | null
fields
key
string
name
string
price
string
read_only
boolean
read_only_reason
string | null
renewal
object | null
fields
at
string | null
currency
string
items
[object]
reverse_charge
boolean
seats
integer
subtotal_minor
integer
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
any
total_minor
integer
status
string
The account's billing status (trialing, active, retrying, unpaid …)
subscription
object | null
fields
addons
object
cancel_at_period_end
boolean
cancelled_at
string | null
current_period_end
string | null
current_period_start
string | null
dunning_attempts
integer
last_failure_reason
string | null
next_attempt_at
string | null
seats
integer
status
string
trial_ends_at
string | null
tax
any
tax_place_ready
boolean
The billing profile has what tax needs
terms
any
trial
object | null
fields
ai_needs_credits
boolean
days_left
integer
ends_at
string (date-time)
first_charge_at
string | null
plan_chosen
boolean
401 Problem details (401)
402 Problem details (402)
403 Problem details (403)
409 Problem details (409)
422 Problem details (422)
429 Problem details (429)
Example
GET
/api/v1/billing/invoices
The account's invoices
Needs `billing:read`.
Scope: account
· paginated
· billing.invoices
Parameter In Type Description
limit query integer Default 50, at most 200 cursor query string The `next_cursor` of the previous page
Responses 200 · 401 · 403 · 429
200 Success
has_more
boolean
invoices *
[BillingInvoice]
fields
BillingInvoice
currency
string
customer
object
id
string (uuid)
issued_at
string | null
kind
string
lines
[object]
number
string
paid_at
string | null
period_end
string | null
period_start
string | null
reverse_charge
boolean
status
string
subtotal_minor
integer
tax_country
string | null
tax_lines
[object]
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
string | null
Decimal
tax_subdivision
string | null
total_minor
integer
usage
object | null
next_cursor
string | null
Pass as `cursor` for the next page; null on the last
401 Problem details (401)
403 Problem details (403)
429 Problem details (429)
Example
GET
/api/v1/billing/invoices/{id}/pdf
An invoice as PDF
Needs `billing:read`. Sent as an attachment named `<number>.pdf`.
Scope: account
· billing.invoice_pdf
Parameter In Type Description
id * path string (uuid)
Responses 200 · 401 · 403 · 404 · 429
401 Problem details (401)
403 Problem details (403)
404 Problem details (404)
429 Problem details (429)
Example
POST
/api/v1/billing/pay-now
Retry a failed renewal now
Scope: account
· Idempotency-Key
· billing.pay_now
Request body application/json
Responses 200 · 401 · 402 · 403 · 409 · 422 · 429
200 Success
billing *
BillingSummary
fields
BillingSummary
account_kind
"individual" | "business"
connection
object | null
The Malaleem connection
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
ends_at
any
When a cancelled subscription ends (false otherwise)
plan
object | null
fields
key
string
name
string
price
string
read_only
boolean
read_only_reason
string | null
renewal
object | null
fields
at
string | null
currency
string
items
[object]
reverse_charge
boolean
seats
integer
subtotal_minor
integer
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
any
total_minor
integer
status
string
The account's billing status (trialing, active, retrying, unpaid …)
subscription
object | null
fields
addons
object
cancel_at_period_end
boolean
cancelled_at
string | null
current_period_end
string | null
current_period_start
string | null
dunning_attempts
integer
last_failure_reason
string | null
next_attempt_at
string | null
seats
integer
status
string
trial_ends_at
string | null
tax
any
tax_place_ready
boolean
The billing profile has what tax needs
terms
any
trial
object | null
fields
ai_needs_credits
boolean
days_left
integer
ends_at
string (date-time)
first_charge_at
string | null
plan_chosen
boolean
401 Problem details (401)
402 Problem details (402)
403 Problem details (403)
409 Problem details (409)
422 Problem details (422)
429 Problem details (429)
Example
GET
/api/v1/billing/profile
The billing profile
The invoice's customer; tax follows its country and state/province. Needs `billing:read`.
Scope: account
· billing.profile
Responses 200 · 401 · 403 · 429
200 Success
profile *
BillingProfile
fields
BillingProfile
address
string | null
country
string | null
email
string | null
legal_name
string | null
needs_subdivision
boolean
subdivision
string | null
subdivisions
[object]
fields
tax_id
string | null
tax_id_label
string
The tax id's local name (VAT number, GSTIN …)
401 Problem details (401)
403 Problem details (403)
429 Problem details (429)
Example
PUT
/api/v1/billing/profile
Change the billing profile
Fields at the top level or under `profile`. Needs `billing:manage`.
Scope: account
· billing.update_profile
Request body application/json
address
string
country
string
ISO 3166-1 alpha-2
email
string (email)
Where invoices go
legal_name
string
profile
object
The same fields, nested
subdivision
string
State / province code, where the country needs one
tax_id
string
Responses 200 · 401 · 402 · 403 · 422 · 429
200 Success
billing
BillingSummary
fields
BillingSummary
account_kind
"individual" | "business"
connection
object | null
The Malaleem connection
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
ends_at
any
When a cancelled subscription ends (false otherwise)
plan
object | null
fields
key
string
name
string
price
string
read_only
boolean
read_only_reason
string | null
renewal
object | null
fields
at
string | null
currency
string
items
[object]
reverse_charge
boolean
seats
integer
subtotal_minor
integer
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
any
total_minor
integer
status
string
The account's billing status (trialing, active, retrying, unpaid …)
subscription
object | null
fields
addons
object
cancel_at_period_end
boolean
cancelled_at
string | null
current_period_end
string | null
current_period_start
string | null
dunning_attempts
integer
last_failure_reason
string | null
next_attempt_at
string | null
seats
integer
status
string
trial_ends_at
string | null
tax
any
tax_place_ready
boolean
The billing profile has what tax needs
terms
any
trial
object | null
fields
ai_needs_credits
boolean
days_left
integer
ends_at
string (date-time)
first_charge_at
string | null
plan_chosen
boolean
profile
BillingProfile
fields
BillingProfile
address
string | null
country
string | null
email
string | null
legal_name
string | null
needs_subdivision
boolean
subdivision
string | null
subdivisions
[object]
fields
tax_id
string | null
tax_id_label
string
The tax id's local name (VAT number, GSTIN …)
401 Problem details (401)
402 Problem details (402)
403 Problem details (403)
422 `invalid_profile` (+`fields`)
Problem
code *
string
Stable machine-readable code (snake_case)
detail
string
A sentence an app can show
error
object | string
Legacy member kept for existing clients (deprecated)
errors
object
Field → messages, for validation errors
instance
string
The request path
message
string
Legacy member of the mobile sign-in errors (deprecated)
request_id
string
status *
integer
title *
string
type
string (uri)
A URI identifying the problem type (https://recordsender.com/problems/<code>)
429 Problem details (429)
Example
POST
/api/v1/billing/resume
Resume a cancelled subscription
Scope: account
· Idempotency-Key
· billing.resume
Request body application/json
Responses 200 · 401 · 402 · 403 · 409 · 422 · 429
200 Success
billing *
BillingSummary
fields
BillingSummary
account_kind
"individual" | "business"
connection
object | null
The Malaleem connection
credits
AiCreditBalance
fields
AiCreditBalance
available
number
balance
number
held
number
Reserved by calls in flight
low
boolean
out
boolean
AI features are stopped
ends_at
any
When a cancelled subscription ends (false otherwise)
plan
object | null
fields
key
string
name
string
price
string
read_only
boolean
read_only_reason
string | null
renewal
object | null
fields
at
string | null
currency
string
items
[object]
reverse_charge
boolean
seats
integer
subtotal_minor
integer
tax_minor
integer
tax_name
string | null
tax_note
string | null
tax_rate
any
total_minor
integer
status
string
The account's billing status (trialing, active, retrying, unpaid …)
subscription
object | null
fields
addons
object
cancel_at_period_end
boolean
cancelled_at
string | null
current_period_end
string | null
current_period_start
string | null
dunning_attempts
integer
last_failure_reason
string | null
next_attempt_at
string | null
seats
integer
status
string
trial_ends_at
string | null
tax
any
tax_place_ready
boolean
The billing profile has what tax needs
terms
any
trial
object | null
fields
ai_needs_credits
boolean
days_left
integer
ends_at
string (date-time)
first_charge_at
string | null
plan_chosen
boolean
401 Problem details (401)
402 Problem details (402)
403 Problem details (403)
409 Problem details (409)
422 Problem details (422)
429 Problem details (429)
Example