GET /apiv2/billing/invoices
Your postpaid billing documents: proformas, invoices and credit notes. Each document has its own number and a PDF, and an invoice or a credit note comes with its usage statement. Part of postpaid billing.
Endpoints
| Endpoint | Returns |
|---|---|
GET /apiv2/billing/invoices | all your documents, newest first |
GET /apiv2/billing/invoices/{id} | one document with its charges |
GET /apiv2/billing/invoices/{id}/pdf | the PDF of the document |
GET /apiv2/billing/invoices/{id}/usage | the usage statement of an invoice or a credit note, CSV |
{id} is the numeric id of the document in the API. It is not the document number: the number, for example INV-2026-000001, is the number field.
Request headers
| Header | Required | Description |
|---|---|---|
X-API-KEY | yes | API key with the billing.read permission |
X-Netts-Billing-Format | no | the response format; the PDF and the usage statement do not depend on it |
Documents
kind | Number | What it is |
|---|---|---|
proforma | PF-… | a request for an advance payment. It does not charge any service. paid shows the payments received for it. The money pays your unpaid charges, oldest first; what is left stays on your account as credit for the next charges |
invoice | INV-… | the services of a billing period: the charges supplied in the period and charges supplied earlier but not invoiced yet. paid is how much of these charges is already paid, by payments or by credit |
credit_note | CN-… | reduces one invoice, creditsInvoiceId: it cancels some or all of its charges. A credit note is not paid, its amountDue is null |
A document never changes after it is issued: its amounts, its exchange rates and its PDF stay as issued. Paying it or crediting it changes only paid, credited, amountDue and status. A correction is a new document — a credit note, or a new invoice.
Example
The examples use BTC. Your responses show the currency of your contract, with its own number of decimal places.
curl -s 'https://netts.io/apiv2/billing/invoices/1' \
-H 'X-API-KEY: your-api-key'{
"success": true,
"data": {
"id": 1,
"periodStart": "2026-10-19T00:00:00+00:00",
"periodEnd": "2026-10-26T00:00:00+00:00",
"currency": "BTC",
"total": { "amount": "0.00001468", "currency": "BTC" },
"paid": { "amount": "0.00001000", "currency": "BTC" },
"amountDue": { "amount": "0.00000158", "currency": "BTC" },
"status": "partially_paid",
"issuedAt": "2026-10-26T09:00:04.748437+00:00",
"dueAt": "2026-11-02T10:12:30.766846+00:00",
"kind": "invoice",
"number": "INV-2026-000001",
"credited": { "amount": "0.00000310", "currency": "BTC" },
"validUntil": null,
"creditsInvoiceId": null,
"creditNotes": [
{ "number": "CN-2026-000001", "total": { "amount": "0.00000310", "currency": "BTC" }, "status": "issued" }
],
"charges": [
{
"id": 1,
"orderId": "1H0b5da50629",
"productCode": "energy_1h",
"address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"quantity": 65000,
"unitPriceSun": "22.000000",
"discount": null,
"baseAmount": { "amount": "1.43", "currency": "TRX" },
"amount": { "amount": "0.00000579", "currency": "BTC" },
"paid": { "amount": "0.00000579", "currency": "BTC" },
"exchangeRate": { "base": "TRX", "quote": "BTC", "rate": "0.00000405", "at": "2026-10-19T01:00:00+00:00" },
"breakdown": "complete",
"quoteId": null,
"txHash": "00484ee218af650b3c918b58c2e7f316ae48653f0f3c2dd122fc6cb9ed578312",
"fulfilledAt": "2026-10-19T01:00:00+00:00",
"status": "paid",
"invoiceId": 1,
"reversesId": null
}
],
"composition": [
{
"chargeId": 1,
"orderId": "1H0b5da50629",
"product": "energy_1h",
"quantity": 65000,
"address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"fulfilledAt": "2026-10-19T01:00:00+00:00",
"txHash": "00484ee218af650b3c918b58c2e7f316ae48653f0f3c2dd122fc6cb9ed578312",
"quoteId": null,
"baseAmount": "1.430000",
"baseCurrency": "TRX",
"rate": { "base": "TRX", "quote": "BTC", "rate": "0.00000405", "at": "2026-10-19T01:00:00+00:00" },
"amount": "0.00000579",
"currency": "BTC",
"late": false,
"breakdown": "complete"
}
]
},
"timestamp": "2026-10-28T11:20:00+00:00"
}The example shows one charge of three. Here amountDue = 0.00001468 − 0.00001000 − 0.00000310 = 0.00000158.
A document
| Field | Description |
|---|---|
id | the identifier of the document in the API — use it in the URLs above |
kind | proforma, invoice or credit_note — see documents |
number | the document number, as on the PDF: PF-2026-000001, INV-2026-000001, CN-2026-000001 |
currency | the currency of the document; all its amounts are in it |
total | the document total |
paid | an invoice: how much of its charges is paid. A proforma: the payments received for it. A credit note: always zero |
credited | an invoice: the total of its credit notes. Zero for the other kinds |
amountDue | what is still payable: total − paid − credited. null for a credit note |
status | see statuses |
issuedAt | when the document was issued, UTC |
dueAt | an invoice: the date to pay by, UTC. null until the invoice is delivered to you — see due date. Always null for a proforma and a credit note |
periodStart, periodEnd | an invoice: the billing period, UTC. null for a proforma and a credit note |
validUntil | a proforma: until when it can be paid. null for the other kinds |
creditsInvoiceId | a credit note: the id of the invoice it reduces. null for the other kinds |
creditNotes | an invoice only: its credit notes — number, total and status |
charges | only in /invoices/{id}: the charges of the document with their current status and payments, the same fields as a charge in usage. A proforma has none |
composition | only in /invoices/{id}: the charges exactly as they were when the document was issued, see composition |
The list endpoint returns the same fields without charges and composition. An account with no documents gets an empty list.
Statuses
status | Meaning |
|---|---|
issued | issued, not delivered to you yet. A proforma stays issued until it is paid |
delivered | an invoice or a credit note delivered to you; for an invoice the payment term has started and dueAt is set |
partially_paid | part of it is paid |
paid | an invoice: fully covered by payments and credit notes. A proforma: paid in full |
expired | a proforma that was not paid before validUntil |
void | cancelled; it is not payable. Its charges, if any, go into a new invoice |
Due date
The payment term of your contract starts when the invoice is delivered to you, not when it is issued. Until then dueAt is null and the status is issued. On delivery dueAt is set to the delivery time plus the payment term in business days — paymentTermsDays in account.
Composition
composition is the list of charges stored in the document when it was issued. It does not change afterwards — not when the invoice is paid, not when a credit note cancels a charge, not when the invoice is cancelled. charges shows the same charges as they are now, with their current status and payments.
| Field | Description |
|---|---|
chargeId | the id of the charge in usage |
orderId, product, quantity, address | the order, the product, the units and the TRON address |
fulfilledAt | when the service was supplied, UTC |
txHash | the TRON transaction, when there is one |
quoteId | the quote the order used, if any |
baseAmount, baseCurrency | the price of this component in its original currency |
rate | the exchange rate recorded for this component |
amount, currency | the amount of this component in the document |
late | true — supplied before this billing period but not invoiced earlier, so it is in this invoice |
breakdown | complete, or incomplete — baseAmount and rate cannot be shown, amount is final |
PDF of a document
curl -s -o INV-2026-000001.pdf 'https://netts.io/apiv2/billing/invoices/1/pdf' \
-H 'X-API-KEY: your-api-key'The answer is the PDF stored when the document was issued, Content-Type: application/pdf, file name {number}.pdf. Every download returns the same file. The same key permission billing.read and the IP whitelist apply.
Usage statement
curl -s -o INV-2026-000001-usage.csv 'https://netts.io/apiv2/billing/invoices/1/usage' \
-H 'X-API-KEY: your-api-key'The charges of an invoice or a credit note as a CSV file, Content-Type: text/csv; charset=utf-8, file name {number}-usage.csv. It is built from the composition of the document, so it is the same file every time, also after payments, credit notes or a cancellation. A proforma has no usage statement: the request is refused with 409 invalid_request.
charge_id,order_id,product,quantity,receive_address,fulfilled_at_utc,delegation_hash,quote_id,base_amount,base_currency,rate,rate_base,rate_quote,rate_at_utc,amount,currency,late,breakdown
1,1H0b5da50629,energy_1h,65000,TXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,2026-10-19T01:00:00+00:00,00484ee218af650b3c918b58c2e7f316ae48653f0f3c2dd122fc6cb9ed578312,,1.430000,TRX,0.00000405,TRX,BTC,2026-10-19T01:00:00+00:00,0.00000579,BTC,no,completeThe columns are the fields of the composition; late is yes or no. Commas and line breaks inside a value are replaced with spaces. A value that a spreadsheet would run as a formula starts with an apostrophe.
The original format
Accounts that use the original response format get only invoices — no proformas and no credit notes — and these fields:
{
"success": true,
"data": {
"id": 12,
"periodStart": "2026-10-12T00:00:00+00:00",
"periodEnd": "2026-10-19T00:00:00+00:00",
"totalTrx": "3778.500000",
"totalUsdc": "1250.400000",
"paidUsdc": "0.000000",
"status": "delivered",
"issuedAt": "2026-10-19T09:00:03+00:00",
"dueAt": "2026-10-26T09:12:40+00:00",
"charges": [
{
"id": 1024,
"orderId": "AB2EF201B582AA1",
"productCode": "energy_1h",
"amountTrx": "1.300000",
"amountUsdc": "0.430096",
"status": "invoiced"
}
]
},
"timestamp": "2026-10-19T20:31:10+00:00"
}| Field | Description |
|---|---|
id | the identifier of the invoice in the API; the invoice number is on its PDF |
periodStart, periodEnd | the billing period, UTC |
totalTrx, totalUsdc | the invoice total, in TRX and in the currency of your contract |
paidUsdc | how much is already paid, in the currency of your contract |
status | issued, delivered, partially_paid, paid or void |
issuedAt | when the invoice was issued |
dueAt | the date to pay by; null until the invoice is delivered — see due date |
charges | only in /invoices/{id}: the charges of the invoice, the fields of a charge in usage; the example shows a few of them |
The PDF and the usage statement work the same way in both formats.
Errors
| HTTP | code | Meaning |
|---|---|---|
| 401 | -1, -2 | the key is missing or invalid, or the IP is not whitelisted — answered by the API gateway, see response format |
| 400 | unsupported_billing_format | unknown X-Netts-Billing-Format value |
| 403 | billing_read_required, postpaid_required | no permission, or no postpaid billing |
| 403 | billing_format_not_enabled | contract-v1 is not enabled for your account yet |
| 404 | not_found | no such document on your account |
| 406 | billing_format_not_available | the original format was requested, but your contract uses contract-v1 only |
| 409 | invalid_request | a usage statement was requested for a proforma |