Every call needs Authorization: Bearer lh_… unless marked No key needed ; the example uses $API for https://api.localhost.co.zw and $LH_API_KEY for your key. A * marks a required field.
#
Account Entitlements
billing:read
GET /billing/entitlements
What the account may have from what it pays for (null: no limit), and what it has now.
Responses
200 EntitlementsOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/billing/entitlements" \
-H "Authorization: Bearer $LH_API_KEY"
GET /billing/invoices
Responses
200 list[InvoiceOut ]
401 no key, or a key that was revoked
Example request
curl -X GET "$API/billing/invoices" \
-H "Authorization: Bearer $LH_API_KEY"
#
Subscriptions
billing:read
GET /billing/subscriptions
Everything that renews from the wallet.
Responses
200 list[SubscriptionOut ]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/billing/subscriptions" \
-H "Authorization: Bearer $LH_API_KEY"
#
Transactions
billing:read
GET /billing/transactions
Wallet movements, newest first (up to 500).
Parameters
Name Type Notes
limit query
integer
default 100
Responses
200 list[TransactionOut ]
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/billing/transactions" \
-H "Authorization: Bearer $LH_API_KEY"
GET /billing/wallet
Responses
200 WalletOut
401 no key, or a key that was revoked
Example request
curl -X GET "$API/billing/wallet" \
-H "Authorization: Bearer $LH_API_KEY"
GET /billing/invoices/{number}
Parameters
Name Type Notes
number * in path
string
Responses
200 InvoiceOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X GET "$API/billing/invoices/<number>" \
-H "Authorization: Bearer $LH_API_KEY"
#
Subscription Auto Renew
billing:write
POST /billing/subscriptions/{pk}/auto-renew
Renew by itself from the wallet, or not. Turning it on also undoes a cancel.
Parameters
Name Type Notes
pk * in path
integer
Request body AutoRenewIn
Name Type Notes
on *
boolean
Responses
200 SubscriptionOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/billing/subscriptions/<pk>/auto-renew" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"on": true
}'
#
Subscription Cancel
billing:write
POST /billing/subscriptions/{pk}/cancel
Stop it renewing: it keeps working until renews_at, then it is paused. Undo with auto-renew on.
Parameters
Name Type Notes
pk * in path
integer
Responses
200 SubscriptionOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/billing/subscriptions/<pk>/cancel" \
-H "Authorization: Bearer $LH_API_KEY"
#
Subscription Level
billing:write
POST /billing/subscriptions/{pk}/level
Move a package to another level now. The difference for the rest of the paid period is charged (or credited back when it is cheaper); the renewal date stays.
Parameters
Name Type Notes
pk * in path
integer
Request body LevelIn
Name Type Notes
level *
string
Responses
200 ChangeOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/billing/subscriptions/<pk>/level" \
-H "Authorization: Bearer $LH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"level": "<level>"
}'
#
Subscription Pay
billing:write
POST /billing/subscriptions/{pk}/pay
Pay a missed or paused renewal from the wallet now; anything paused comes back. 402 when the wallet is short.
Parameters
Name Type Notes
pk * in path
integer
Responses
200 SubscriptionOut
401 no key, or a key that was revoked403 the key lacks the permission
Example request
curl -X POST "$API/billing/subscriptions/<pk>/pay" \
-H "Authorization: Bearer $LH_API_KEY"
Shapes
The objects these endpoints send and receive.
AutoRenewIn
Name Type Notes
on *
boolean
EntitlementsOut
Name Type Notes
allowed *
object
used *
object
InvoiceOut
Name Type Notes
number *
string
status *
string
currency *
string
total *
string
issued_at *
string | null
paid_at *
string | null
lines *
list[object]
LevelIn
Name Type Notes
level *
string
SubscriptionOut
Name Type Notes
id *
integer
kind *
string
label *
string
price *
string
period *
string
renews_at *
string
auto_renew *
boolean
status *
string
grace_until *
string | null
paused_at *
string | null
delete_after *
string | null
TransactionOut
Name Type Notes
kind *
string
amount *
string
description *
string
balance_after *
string | null
reference *
string
created_at *
string
WalletOut
Name Type Notes
balance *
string
currency *
string
auto_renew *
boolean