Billing data

Everything the Billing page of the client area shows can be read from a program: how much money is on the account, what has accrued since the last invoice, what is owed and until when, every invoice with its lines and its PDF, top-up receipts, payments and every movement of the balance. A separate call forecasts what each project will have cost by the end of its billing period. Use it to feed your accounting, to alert before a service is suspended, or to bill your own customers.

Nothing in this guide creates, pays or changes an invoice: every call here is a GET. Getting started covers calls, answers and errors.

1. A key with billing access

Money of the account is read with an account key that has billing access. On the API tokens page, issue an account key and set Billing access to Read billing data. Read only access is enough for everything on this page. The default is no billing access, so an account key you already have does not read money until you issue one with it. Paying through the API is not published yet, so the client area offers no billing access beyond reading.

export FBX_BILLING_KEY=fbx_...

2. Balance, debt and the deadline

curl -H "Authorization: Bearer $FBX_BILLING_KEY" https://api.fiberax.com/v1/billing/balance
{ "data": {
    "credit": "9007.59", "currency": "EUR",
    "accrued": { "total": "116.56334", "by_project": [
        { "project_id": 1313, "product": "vdc", "name": "vdc-main", "status": "active",
          "accrued": "111.63996", "period_start": "2026-10-10T09:00:00Z" },
        { "project_id": 1387, "product": "s3", "name": "objectstorage", "status": "active",
          "accrued": "4.92338", "period_start": "2026-10-10T07:00:00Z" },
        { "project_id": 1330, "product": "apitokens", "name": "apitokens", "status": "active",
          "accrued": "0.00000", "period_start": "2026-06-25T12:04:46Z" } ] },
    "unpaid":  { "total": "0.00", "count": 0 },
    "overdue": { "total": "0.00", "count": 0 },
    "debt": { "blocked": false, "amount": "0.00", "threshold": "5.00" },
    "suspension_expected_on": null, "termination_expected_on": null,
    "estimated": true, "generated_at": "2026-10-31T10:30:00Z" } }

A simple alert: call this once an hour and raise it when overdue.count is above zero, or when suspension_expected_on is a few days away.

3. Invoices

curl -H "Authorization: Bearer $FBX_BILLING_KEY" \
     "https://api.fiberax.com/v1/billing/invoices?status=unpaid,paid&limit=50"

Newest first, at most limit per call (1 to 500, default 100). To read further back, repeat the call with before_id set to the id of the oldest invoice you got. start and end limit the day of issue and go only as a pair - one of them alone is refused with 422 invalid_request; project_id keeps the invoices that charge one project; overdue=true keeps those past their due day; status takes any of the states an invoice shows (unpaid, paid, cancelled, refunded, collections, chargeback, processing, credited, credit_note), comma-separated.

One invoice with its lines:

curl -H "Authorization: Bearer $FBX_BILLING_KEY" https://api.fiberax.com/v1/billing/invoices/1648

Usage lines carry quantity, unit and unit_price as the document prints them ("209.84 IP-hours at 0.00278"). A line that cannot be read reliably has them null rather than a guess; its amount is always exact.

The document itself:

curl -H "Authorization: Bearer $FBX_BILLING_KEY" -o invoice.pdf \
     https://api.fiberax.com/v1/billing/invoices/1648/pdf

The body is the PDF (application/pdf), not the JSON envelope; a refusal still comes as JSON. An invoice of another account and an unknown id both answer 404 invoice_not_found.

4. Receipts, payments and the balance

All three are bounded lists like the invoices: newest first, limit, before_id, and an optional time window (start and end, as a pair).

5. Forecast of the month

curl -H "Authorization: Bearer $FBX_ACCOUNT_KEY" https://api.fiberax.com/v1/account/forecast

For every live project: what it has charged in its current billing period (accrued), what it charged in its last recorded hour (hourly_rate), the hours left until the period closes, and forecast = accrued + hourly_rate x remaining_hours. A project key reads its own project with GET /v1/project/costs/forecast. A forecast is usage, not account money, so it needs no billing access.

6. Costs of the account, per project and per customer

curl -H "Authorization: Bearer $FBX_ACCOUNT_KEY" \
     "https://api.fiberax.com/v1/account/costs?start=2026-10-01T00:00:00Z&end=2026-11-01T00:00:00Z&group_by=label&label_prefix=cust-"

What every project of the account has run up, in one call. Each project comes with the same buckets and total that GET /v1/projects/{id}/costs gives for the same window, and total of the answer is exactly their sum. With start and end projects closed within the window are there too (deleted: true) - they were charged. Without them every project is read over its own current billing period. Like the forecast, this is usage and needs no billing access.

7. Price before you create

curl -H "Authorization: Bearer $FBX_PROJECT_KEY" \
     "https://api.fiberax.com/v1/server-types/4/quote?cores=4&memory_mb=8192&disk_gb=80&public_ip=true"

What a server would cost, line by line, before you create it: the same fields you would send to create it, the same refusals creation would give. Prices follow the billing: every line is an hourly rate, and its monthly price is that rate x 720, rounded to the cent, as in the type's pricing. The monthly total is the sum of those rounded lines, so it can differ from hourly x 720 by a cent or two. Discounts of your account are not taken off.

8. What is not here yet

Paying an invoice from the balance, topping up and redeeming vouchers through the API are not published yet: pay in the client area.

Notifications about invoices and a low balance come as webhooks: see Webhooks and budgets.