Skip to content

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 ​

EndpointReturns
GET /apiv2/billing/invoicesall your documents, newest first
GET /apiv2/billing/invoices/{id}one document with its charges
GET /apiv2/billing/invoices/{id}/pdfthe PDF of the document
GET /apiv2/billing/invoices/{id}/usagethe 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 ​

HeaderRequiredDescription
X-API-KEYyesAPI key with the billing.read permission
X-Netts-Billing-Formatnothe response format; the PDF and the usage statement do not depend on it

Documents ​

kindNumberWhat it is
proformaPF-…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
invoiceINV-…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_noteCN-…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.

bash
curl -s 'https://netts.io/apiv2/billing/invoices/1' \
  -H 'X-API-KEY: your-api-key'
json
{
  "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 ​

FieldDescription
idthe identifier of the document in the API — use it in the URLs above
kindproforma, invoice or credit_note — see documents
numberthe document number, as on the PDF: PF-2026-000001, INV-2026-000001, CN-2026-000001
currencythe currency of the document; all its amounts are in it
totalthe document total
paidan invoice: how much of its charges is paid. A proforma: the payments received for it. A credit note: always zero
creditedan invoice: the total of its credit notes. Zero for the other kinds
amountDuewhat is still payable: total − paid − credited. null for a credit note
statussee statuses
issuedAtwhen the document was issued, UTC
dueAtan 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, periodEndan invoice: the billing period, UTC. null for a proforma and a credit note
validUntila proforma: until when it can be paid. null for the other kinds
creditsInvoiceIda credit note: the id of the invoice it reduces. null for the other kinds
creditNotesan invoice only: its credit notes — number, total and status
chargesonly 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
compositiononly 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 ​

statusMeaning
issuedissued, not delivered to you yet. A proforma stays issued until it is paid
deliveredan invoice or a credit note delivered to you; for an invoice the payment term has started and dueAt is set
partially_paidpart of it is paid
paidan invoice: fully covered by payments and credit notes. A proforma: paid in full
expireda proforma that was not paid before validUntil
voidcancelled; 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.

FieldDescription
chargeIdthe id of the charge in usage
orderId, product, quantity, addressthe order, the product, the units and the TRON address
fulfilledAtwhen the service was supplied, UTC
txHashthe TRON transaction, when there is one
quoteIdthe quote the order used, if any
baseAmount, baseCurrencythe price of this component in its original currency
ratethe exchange rate recorded for this component
amount, currencythe amount of this component in the document
latetrue — supplied before this billing period but not invoiced earlier, so it is in this invoice
breakdowncomplete, or incomplete — baseAmount and rate cannot be shown, amount is final

PDF of a document ​

bash
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 ​

bash
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.

csv
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,complete

The 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:

json
{
  "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"
}
FieldDescription
idthe identifier of the invoice in the API; the invoice number is on its PDF
periodStart, periodEndthe billing period, UTC
totalTrx, totalUsdcthe invoice total, in TRX and in the currency of your contract
paidUsdchow much is already paid, in the currency of your contract
statusissued, delivered, partially_paid, paid or void
issuedAtwhen the invoice was issued
dueAtthe date to pay by; null until the invoice is delivered — see due date
chargesonly 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 ​

HTTPcodeMeaning
401-1, -2the key is missing or invalid, or the IP is not whitelisted — answered by the API gateway, see response format
400unsupported_billing_formatunknown X-Netts-Billing-Format value
403billing_read_required, postpaid_requiredno permission, or no postpaid billing
403billing_format_not_enabledcontract-v1 is not enabled for your account yet
404not_foundno such document on your account
406billing_format_not_availablethe original format was requested, but your contract uses contract-v1 only
409invalid_requesta usage statement was requested for a proforma