---
title: "Preview invoice for an org+period."
method: POST
path: "/usage/admin/invoice/preview/"
tags: ["usage"]
---

# Preview invoice for an org+period.

`POST /usage/admin/invoice/preview/`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/usage/admin/invoice/preview/`
- Auth: one of:
  - API key in header `X-Api-Key`
  - API key in header `X-Secret-Key`

Creates no invoice and deducts no credits, but does backfill missing
``UsageSummary`` rows for the usage period. Open to staff so the admin's
read-only Generate Invoice page can show what would be billed.

## Request body

- AdminInvoiceRequest
  - `organization_id` string, uuid, required
  - `period` string, required

## Response `200`

OK

- AdminInvoicePreviewResponse
  - `status` boolean, required
  - `result` AdminInvoicePreviewResult, required
    - `org_id` string, uuid, required
    - `period` string, required
    - `plan` string, required
    - `backfill_ran` boolean, required
    - `usage_summary_count` integer, required
    - `invoice_exists` boolean, required
    - `platform_fee` string, required
    - `usage_total` string, required
    - `credits_applied` string, required
    - `subtotal` string, required
    - `tax` string, required
    - `total` string, required
    - `line_items` AdminInvoiceLineItem[], required
      - `line_type` string, required
      - `dimension` string, nullable
      - `description` string, required
      - `quantity` string, required
      - `unit` string
      - `unit_price` string, required
      - `amount` string, required
      - `tier_breakdown` object, nullable

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `402`: Payment Required
- `403`: Forbidden
- `404`: Not Found
- `500`: Internal Server Error
- `default`: Default error response

---

[API](https://skmtc.dev/futureagi/apis/future-agi-management-api.md) · [All operations](https://skmtc.dev/futureagi/apis/future-agi-management-api/llms.txt) · [OpenAPI document](https://skmtc.dev/futureagi/apis/future-agi-management-api/revisions/c8684118e142?raw)
