---
title: "Generate invoice for shipment"
method: POST
path: "/shipments/{id}/invoice/generate"
tags: ["Shipments"]
---

# Generate invoice for shipment

`POST /shipments/{id}/invoice/generate`

Generate an invoice PDF for the shipment.

## What happens

- Invoice PDF is generated
- Invoice document is attached to the shipment
- Shipment billing status changes to INVOICED

## Prerequisites

- Shipment must be in READY_TO_INVOICE status

## Path parameters

- `id` string, required

## Query parameters

- `by` 'id' | 'key'

## Response `200`

Invoice generated

- object
  - `shipmentId` string, uuid
  - `invoiceId` string, uuid — The generated invoice ID
  - `documentId` string, uuid — The invoice PDF document ID
  - `downloadUrl` string, uri — URL to download the invoice PDF

## Other responses

- `400` — Bad request - invalid input
- `401` — Unauthorized - invalid or missing access token
- `404` — Resource not found
- `409` — Shipment not in valid status for invoice generation

---

[API](https://skmtc.net/mvmnt/apis/mvmnt-api.md) · [All operations](https://skmtc.net/mvmnt/apis/mvmnt-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mvmnt/mvmnt-api/versions/c44e5e7a4256/schema)
