> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbit.devotel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Run and download reseller invoices for subaccounts

> Run a calendar-month usage rollup, reconcile reseller margins, and download a branded HTML invoice for each subaccount.

# Run and download reseller invoices for subaccounts

Use the reseller invoice run to review a calendar month's metered activity across your child subaccounts and download a separate invoice document for each one. The run reads usage and calculates the reseller price; it does not charge a wallet or collect payment.

## When to use an invoice run

Choose a calendar month (`YYYY-MM`) to review. Compare each subaccount's invoice against its usage statement when reconciling the amount you bill that customer with the underlying channel activity and reseller margin. For a wider parent-account view, the run's subaccount rows use the same usage rollup shown in the console.

The download is HTML rather than PDF so the invoice is a self-contained, printable document. Open it in a browser and use the browser's print or save-to-PDF action when your finance workflow needs a PDF copy.

## Open the invoice run

In the dashboard, open **Settings → Subaccounts** (`/settings/subaccounts`) and find **Reseller invoice run**. Only organization **owners** and **admins** can access this action. Generating an invoice is a money-meaning document, so use an authorized account; other roles do not see the card.

| Role | Open the card and run periods | Download invoices |
| - | - | - |
| Owner | Yes | Yes |
| Admin | Yes | Yes |
| Other roles | No | No |

Before the first subaccount has metered activity for a month, the card displays **Nothing to invoice**. Once a subaccount has billable activity in the selected month, it appears as a row. A month with no billable activity can show this same empty state; it does not indicate a failed run.

## Run a billing period

1. Open **Billing month**. The default is the current UTC calendar month.
2. Pick a month, or use **Previous month** and **Next month** to move through periods. The month picker cannot select a future month, and **Next month** is disabled at the current month.
3. Wait for the subaccount rows to load. The card requests the selected period's usage rollup across the child subaccounts and displays each subaccount's billed total and margin.
4. If the request fails, choose **Retry**. Change the month to revisit another period.

The card shows a loading state while it fetches the rollup; there is no separate job to submit or invoice batch to wait for. The time depends on the number of subaccounts and usage in the selected period. This is a usage read and calculation, not a payment, wallet debit, or externally-issued tax invoice.

## Download one invoice per subaccount

Each row represents one subaccount with metered activity in the selected month. Select **Download invoice** on that row to save its branded HTML file. The dashboard filename is:

```text theme={null}
invoice-{slug}-{period}.html
```

For example, a subaccount with slug `rahal-industries` for August 2026 downloads as `invoice-rahal-industries-2026-08.html`. The API responds with `Content-Type: text/html` and `Content-Disposition: attachment`; in the dashboard, the browser download uses the slug-based filename above.

The download action remains available for prior months. Select a past period and download the row again to retrieve a fresh document for that month. During a download, that row shows a spinner and its button is temporarily disabled.

## Revisit invoice history

Use the month picker or **Previous month** to revisit earlier periods. A period is selected by calendar month; the console requests the rollup for that month again and the invoice endpoint rebuilds the document from the corresponding usage statement. The period does not create a second invoice record or trigger another charge.

The figures are derived from current usage records, not a frozen invoice snapshot. Re-running a period with unchanged usage and pricing produces the same totals. If you backfill or correct usage, or change the pricing inputs used for that period, a later run can reflect those updated source values. Reconcile a changed total against the refreshed usage statement before distributing the document.

## What's in the invoice

The invoice header uses the reseller organization's branding, including its configured name, logo, and colors where provided. The billed-to party is the subaccount's organization name. If branding is missing, the document uses its default brand styling. The current download supplies the subaccount name but not a postal address, so do not expect an address block in this invoice.

The HTML lists usage descriptions, quantities, and marked-up amounts, followed by the invoice total and billing period. The related usage statement carries the detailed monetary values used for reconciliation: `quantity`, `baseCost`, `markedUpPrice`, and `marginEarned`, in the statement currency. The amount shown for a usage line is the marked-up price; use the statement when you need to inspect the wholesale cost and margin separately.

<figure>
  <figcaption>Illustrative HTML invoice excerpt for one subaccount (values are examples)</figcaption>

  <pre>
    <code>
      {`<!DOCTYPE html>
            <html lang="en">
            <head><title>Invoice INV-2026-08-rahal</title></head>
            <body>
              <header style="border-top:4px solid #325FEC">
                <strong>Rahal Communications</strong>
                <span>Invoice</span>
              </header>
              <section>
                <p>Billed to: Rahal Industries</p>
                <p>Billing period: 2026-08-01 – 2026-09-01</p>
              </section>
              <table>
                <thead><tr><th>Description</th><th>Qty</th><th>Amount</th></tr></thead>
                <tbody><tr><td>SMS usage</td><td>100</td><td>$12.00</td></tr></tbody>
              </table>
              <p>Subtotal: $12.00</p>
              <strong>Total due: $12.00 USD</strong>
            </body>
            </html>`}
    </code>
  </pre>
</figure>

In this example, the corresponding usage statement could report `quantity: 100`, `baseCost: 10.00`, `markedUpPrice: 12.00`, and `marginEarned: 2.00` USD. The HTML's single amount column shows the marked-up price; the statement is the source for the separate cost and margin figures.

### Reconcile against usage insights

Compare the invoice's period and subaccount total with the matching usage statement before billing your customer. For channel-level or time-series cost analysis, use [Insights costs](/guides/insights-costs) alongside the subaccount statement. These views help explain usage and cost; the invoice run itself does not settle a balance.

## Use the API

Download the same period's HTML invoice directly for one subaccount:

```bash theme={null}
curl -L "https://api.orbit.devotel.io/api/v1/subaccounts/org_sub_rahal_00x9/invoice.html?period=2026-08" \
  -H "X-API-Key: dv_live_sk_your_key_here" \
  -o invoice-rahal-industries-2026-08.html
```

The equivalent statement preview is `GET /api/v1/subaccounts/{id}/usage/statement?period=YYYY-MM`. The console's across-subaccount view uses `GET /api/v1/subaccounts/usage-rollup?period=YYYY-MM`. These reads share the same usage statement figures, so the rollup, statement, and invoice amount reconcile for a given source-data version.

See [Subaccounts API reference, §8: Download a branded invoice run](/api-reference/endpoints/subaccounts#8-download-a-branded-invoice-run) for the invoice response and headers, and [§12: Read the usage statement JSON](/api-reference/endpoints/subaccounts#12-read-the-usage-statement-json) for the per-subaccount preview.

## How reseller margin appears

The usage statement applies the subaccount's reseller margin to wholesale usage cost. For a line with a 20% applied margin and a `$10.00` base cost, the marked-up price is `$12.00` and the margin earned is `$2.00`:

```text theme={null}
markedUpPrice = baseCost × (1 + marginPct / 100)
marginEarned  = markedUpPrice − baseCost
```

A channel- or destination-specific reseller rate can determine the applied markup for that line; otherwise, the subaccount's `reseller_margin_pct` is the baseline. The statement reports the resolved values. At 0% margin, the marked-up price equals base cost and margin earned is zero. The subaccount can still appear in the run when it has billable usage.

## If something looks wrong

* **Nothing to invoice:** Confirm the selected month and whether the subaccount has metered activity in that period. A zero-usage period has no invoice row.
* **Branding is absent:** The invoice uses the reseller organization's configured branding. If a branding value is unset, default styling fills in; check the parent organization's branding settings.
* **A past total changed:** The run recomputes from usage and pricing inputs. Check whether usage was backfilled or corrected, then compare the current statement and [Insights costs](/guides/insights-costs).
* **The request is denied:** Sign in as an organization owner or admin and retry. API callers must also use credentials authorized to read that subaccount's usage.
* **The request failed to load or download:** Retry from the card. For API requests, verify the subaccount ID, the `YYYY-MM` period, and the authorization on the request.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.