Feature Request
Add an API to retrieve billing invoices programmatically.
Problem Statement
Invoices are currently only accessible through the web dashboard or email. This prevents automation of accounting workflows, monthly reconciliation, and integration with internal finance systems. Manual downloads are slow, error-prone, and donβt scale.
Proposed Solution
Introduce a Billing / Invoices API with the ability to:
-
List invoices (
GET /v1/billing/invoices) with filters (date range, status). -
Retrieve a single invoice (
GET /v1/billing/invoices/{invoice_id}). -
Download invoice PDFs via direct or pre-signed URLs.
-
Enforce proper permissions (e.g.,
billing.readscope).
Example use case:
A monthly automated job fetches all invoices, downloads PDFs, and syncs them to internal accounting tools.
API Impact
-
Affects the billing layer, not model APIs.
-
Requires new endpoints and possibly a new auth scope (
billing.read). -
No breaking changes to existing APIs.
Alternatives Considered
-
Manual dashboard downloads (slow, error-prone).
-
Email parsing (fragile).
-
Browser automation/scraping (insecure and brittle).
None provides a reliable programmatic solution.
Additional Context
This would greatly improve financial automation for teams using usage-based billing.