# POST /opportunities/:opportunity_id/progress-invoices

**Resource:** [JOB_COSTING](./job-costing.md)  
**MCP tool:** `create_progress_invoice`  
**Scopes:** `invoices:write`  
**Write operation:** yes

Bill the next stage of a job with a progress invoice. Say how far the job is now, cumulatively: percent_complete for the whole contract (30, then 60, then 100), or lines to bill quote lines one by one. It bills only what has not been billed yet (an earlier progress invoice or a deposit invoice is taken off), holds back the job's retention (set_job_retention) as a minus line, and never goes backwards (void its invoice to take it back). The invoice is made from an invoice design (template_id, else the workspace default; it must be an invoice design that bills the full amount), which sets its page, email, due date and GST, and it goes into Xero like any new invoice. Variations are not part of the contract: bill them with create_invoice (deal_product_ids). Once a job has progress invoices, its contract lines can no longer be billed by create_invoice. The invoice is a draft unless status is "open". Send preview true first to show the figures.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `opportunity_id` | path | string | yes | UUID of the opportunity (the job), from list_opportunities. |
| `percent_complete` | body | number | no | How far the whole job is now, as a cumulative percent of the contract (for example 30, then 60 on the next progress invoice). Bills the difference from what has been billed so far. Send this OR lines. |
| `lines` | body | array | no | Bill quote lines one by one instead of the whole job: how far each named line is now (cumulative percent). Only the named lines are billed. Send this OR percent_complete. |
| `template_id` | body | string | no | Invoice design: the design the invoice is made from (an invoice design from list_invoice_templates that bills the full amount). It sets the page, the email, the due date and how GST is charged. Leave out for the workspace's default invoice design. |
| `status` | body | string | no | "draft" (default): the invoice is made but not issued, so it can be checked first. "open": issued now, ready to send and pay. |
| `due_date` | body | string | no | Due date on the invoice (YYYY-MM-DD). Used only when the invoice design sets no payment terms of its own. |
| `xero_integration_id` | body | string | no | Xero organisation - the connected Xero organisation this invoice is created in (its id from list_integrations, platform xero). Only needed when the workspace has more than one Xero organisation connected: left out, the invoice design’s Xero organisation is used, then the workspace default (Invoices > Settings), then the only connection; with several connected and none of those, nothing is made and you are asked to choose. |
| `send_to_xero` | body | boolean | no | Xero workspaces: also make the invoice in Xero, where it takes Xero's number and keeps its design and pay page. All or nothing: if Xero refuses it, nothing is made. Defaults to on when Xero is connected and the workspace setting invoices_to_xero (update_crm_settings) is on. false leaves it out of Xero for now; with that setting on it goes into Xero when it is sent. |
| `reference` | body | string | no | Reference on the invoice. Defaults to "Progress invoice N". |
| `note` | body | string | no | A note kept with the progress invoice for the team (not printed), 2000 characters at most. |
| `preview` | body | boolean | no | true: work the progress invoice out and return it (lines, amounts, retention, invoice lines, the design it will use and its GST) without creating anything. Use it to show the figures before billing. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/opportunities/:opportunity_id/progress-invoices"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"percent_complete":"...","lines":"...","template_id":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`