API Reference
Billing API (invoices & credit)
Copy page
GET /v1/invoices and GET /v1/billing/credit — invoices, amounts, payment status and credit balance
Returns the token owner’s invoices and account credit, read-only. These endpoints never pay, charge or move credit.
List invoices
GET https://api.hostino.ai/v1/invoicesAuthorization: Bearer ACCESS_TOKEN| Item | Value |
|---|---|
| Required scope | invoices:read |
status (optional) | Unpaid, Paid, Overdue (unpaid and past due), Cancelled, Refunded, Draft, Collections, Payment Pending (case-insensitive) |
invoice_id (optional) | Only this invoice, including its line items |
curl -s "https://api.hostino.ai/v1/invoices?status=Unpaid" -H "Authorization: Bearer $TOKEN"{ "count": 1, "invoices": [ { "id": 1683, "number": "1683", "status": "Unpaid", "issued_on": "2026-10-06", "due_date": "2026-10-06", "paid_on": null, "days_until_due": -15, "overdue": true, "currency": "IRR", "subtotal": 950000, "tax": 95000, "credit_applied": 0, "total": 1045000, "balance_due": 1045000, "total_toman": 104500, "balance_due_toman": 104500 } ]}| Field | Description |
|---|---|
number | Invoice number (the id when no custom number is set) |
issued_on / due_date / paid_on | Issue, due and paid dates (YYYY-MM-DD) |
days_until_due | Unpaid invoices only; negative means overdue |
overdue | Unpaid and past due |
subtotal / tax | Amount before tax and the VAT |
credit_applied | Credit applied to the invoice |
total | Invoice total (before credit) |
balance_due | Amount still to pay; 0 for paid/cancelled invoices |
items | (with invoice_id only) description and amount of each line |
Credit balance
GET https://api.hostino.ai/v1/billing/creditAuthorization: Bearer ACCESS_TOKEN| Item | Value |
|---|---|
| Required scope | billing:read |
{ "balance": 1960672, "currency": "IRR", "balance_toman": 196067 }Pay an invoice from credit
Pays an unpaid invoice (for example a hosting or domain renewal) from the account credit, in two steps and only with a phrase the account owner types themselves. Both steps need the orders:confirm and billing:pay scopes.
Step 1: prepare (no money moves)
curl -s -X POST https://api.hostino.ai/v1/invoices/1234/credit-payment -H "Authorization: Bearer $TOKEN"{ "request_id": "q7Yd…", "invoice_id": 1234, "amount_toman": 1250000, "credit_balance_toman": 3000000, "payable": true, "phrase": { "fa": "تایید پرداخت 1,250,000 تومان از اعتبار کد 4821", "en": "confirm paying 1,250,000 toman from credit code 4821" }}If the credit is not enough, you get payable: false with reason: "insufficient_credit" and a payment_url; if the invoice is not unpaid, reason: "not_unpaid".
Step 2: confirm
curl -s -X POST https://api.hostino.ai/v1/invoice-payments/q7Yd…/confirm -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" -d '{"confirmation":"confirm paying 1,250,000 toman from credit code 4821"}'A successful response is {"status":"paid", "invoice_id":1234, "amount_toman":1250000}. Errors on this path: 409 amount_changed (the invoice amount changed; the new phrase is in the response), 400 confirmation_mismatch (at most 5 attempts), 402 insufficient_credit and 410 request_expired (the request expires after about 15 minutes).
Errors
| Code | Body | Cause |
|---|---|---|
400 | invalid_status / invalid_invoice_id | Invalid filter value |
401 | missing_token / inactive_token / invalid_audience | Token problem |
403 | insufficient_scope | Token lacks invoices:read or billing:read |
404 | invoice_not_found | Invoice doesn’t exist or isn’t yours |
502 | backend_error | Temporary internal error |
In MCP
The list_invoices and get_credit_balance tools, and prepare_invoice_payment / pay_invoice_with_credit for paying from credit (guide).