Skip to content

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/invoices
Authorization: Bearer ACCESS_TOKEN
ItemValue
Required scopeinvoices: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
Terminal window
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
}
]
}
FieldDescription
numberInvoice number (the id when no custom number is set)
issued_on / due_date / paid_onIssue, due and paid dates (YYYY-MM-DD)
days_until_dueUnpaid invoices only; negative means overdue
overdueUnpaid and past due
subtotal / taxAmount before tax and the VAT
credit_appliedCredit applied to the invoice
totalInvoice total (before credit)
balance_dueAmount 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/credit
Authorization: Bearer ACCESS_TOKEN
ItemValue
Required scopebilling: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)

Terminal window
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

Terminal window
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

CodeBodyCause
400invalid_status / invalid_invoice_idInvalid filter value
401missing_token / inactive_token / invalid_audienceToken problem
403insufficient_scopeToken lacks invoices:read or billing:read
404invoice_not_foundInvoice doesn’t exist or isn’t yours
502backend_errorTemporary 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).