# Work Orders

Manage work orders linked to deals for tracking project execution. Work orders appear on the CRM Calendar, support team assignment, and scheduled dates.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /work-orders

List all work orders. Filter by deal_product_id, status_id, assigned_to (user UUID), or schedule_date (ISO date, exact match).

**Scopes:** `work-orders:read` — [full detail](./work-orders/get-work-orders.md)

### GET /work-orders/:id

Retrieve a single work order. Response includes schedule_date (ISO date), schedule_time (HH:MM:SS or null for all-day), and assigned_to (user UUID or null).

**Scopes:** `work-orders:read` — [full detail](./work-orders/get-work-orders-id.md)

### POST /work-orders

Create a work order. Pass "status" (string label, e.g. "Pending") to resolve a status by name, or "status_id" (UUID) directly. "status" performs a case-insensitive match against crm_work_order_statuses labels for the company. Use schedule_date + schedule_time to control when the work order appears on the calendar, and assigned_to to assign a team member.

**Scopes:** `work-orders:write` — [full detail](./work-orders/post-work-orders.md)

### PATCH /work-orders/:id

Update a work order. Pass "status" (string label) to resolve by name, or "status_id" (UUID) directly. Set assigned_to to null to unassign. Set schedule_time to null to clear a timed slot back to all-day.

**Scopes:** `work-orders:write` — [full detail](./work-orders/patch-work-orders-id.md)

### DELETE /work-orders/:id

Delete a work order.

**Scopes:** `work-orders:write` — [full detail](./work-orders/delete-work-orders-id.md)

### POST /work-orders/send-work-status

Send a PIN-protected Work Status Portal link to a client via email. The client receives a unique link where they can view the progress of all work orders on the deal. Requires the deal to have work orders and the company to have email configured. Returns success, portal_id, and token.

**Scopes:** `work-orders:write` — [full detail](./work-orders/post-work-orders-send-work-status.md)
