---
title: "Generate invoice from charges"
method: POST
path: "/v1/invoices/generate"
tags: ["Invoices"]
---

# Generate invoice from charges

`POST /v1/invoices/generate`

Generate an invoice from charges within a billing period.
Automatically aggregates charges by usage type into line items.

The invoice is created in DRAFT status. Use the issue endpoint to finalize it.

## Request body

- object
  - `customerId` string, required — Customer ID to generate invoice for
  - `periodStart` string, date-time, required — Start of billing period (ISO 8601)
  - `periodEnd` string, date-time, required — End of billing period (ISO 8601)
  - `dueDate` string, date-time — Payment due date (ISO 8601)
  - `includeSettledOnly` boolean — Only include settled (confirmed) charges
  - `notes` string — Internal notes (not visible to customer)
  - `customerNotes` string — Notes visible to customer on invoice

## Response `201`

Invoice generated successfully

- object — Invoice generated successfully
  - `id` string
  - `invoiceNumber` string
  - `customerId` string
  - `periodStart` string
  - `periodEnd` string
  - `totalUsdc` string
  - `status` string
  - `lineItems` object[]
    - `id` string
    - `description` string
    - `usageType` string
    - `quantity` string
    - `unitPrice` string
    - `amountUsdc` string
  - `createdAt` string

## Other responses

- `400` — Validation error
- `401` — Unauthorized
- `404` — Customer not found

---

[API](https://skmtc.net/usedrip/apis/drip-api.md) · [All operations](https://skmtc.net/usedrip/apis/drip-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/usedrip/drip-api/revisions/2cb1567969ca/schema)
