---
title: "Preview invoice lines for a contract period."
method: POST
path: "/v2/contracts/{contract_id}/invoice-preview"
tags: ["Invoice Preview"]
---

# Preview invoice lines for a contract period.

`POST /v2/contracts/{contract_id}/invoice-preview`

## Path parameters

- `contract_id` string, required

## Request body

- InvoicePreviewRequest
  - `period_start_at` integer, required — Unix timestamp in seconds.
  - `period_end_at` integer, required — Unix timestamp in seconds.

## Response `200`

Success.

- InvoicePreview
  - `contract_id` string, required — LedgerUp resource identifier.
  - `period_start_at` integer, required — Unix timestamp in seconds.
  - `period_end_at` integer, required — Unix timestamp in seconds.
  - `currency_code` string, required
  - `lines` InvoicePreviewLine[], required
    - `contract_line_id` string, required — LedgerUp resource identifier.
    - `product_id` string, required — LedgerUp resource identifier.
    - `price_id` string, required — LedgerUp resource identifier.
    - `rate_card_id` string, required — LedgerUp resource identifier.
    - `invoice_group_key` string, nullable, required — Grouping key from the contributing rate card rates, when multiple converted sources are combined into one line.
    - `stripe_product_id` string, nullable, required
    - `stripe_price_id` string, nullable, required
    - `description` string, required
    - `quantity` string, required
    - `unit_amount_minor_units` integer, nullable, required
    - `amount_minor_units` integer, required
    - `currency_code` string, required
    - `service_period_start_at` integer, required — Unix timestamp in seconds.
    - `service_period_end_at` integer, required — Unix timestamp in seconds.
    - `source_breakdown` unknown, required

## Other responses

- `400` — Bad request, invalid header, invalid amount/quantity/currency, or text validation failure.
- `401` — Missing or invalid API key.
- `403` — API key lacks the required permission, or reset was attempted outside the test namespace.
- `408` — Request exceeded the 30 second timeout.
- `413` — Request body exceeded the 256 KiB limit.
- `415` — Write request content type was not application/json.
- `422` — Semantically invalid request, such as a service period with start greater than end.
- `429` — Rate limit exceeded.
- `500` — Internal server error or queue failure.

---

[API](https://skmtc.dev/ledgerup/apis/ledgerup-api.md) · [All operations](https://skmtc.dev/ledgerup/apis/ledgerup-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ledgerup/ledgerup-api/revisions/be257191807b/schema)
