Create a new work order.
**Required Permission:** `create_work_orders`
## Required Fields
- `customer_id` - UUID (must exist in customers table)
- `location_id` - UUID (customer location)
- `service_id` - UUID (links work order to a service from the service catalog)
- `category` - Enum: scheduled, emergency, warranty, contract, inspection, installation, repair, delivery, consultation, follow_up, recall, upgrade
- `priority` - Enum: low, normal, high, urgent, emergency, critical
- `source` - Enum: customer_request, scheduled_maintenance, emergency_call, contract, inspection, internal, warranty_claim, follow_up, system_generated, mobile_app, web_portal, call_center
## Optional Fields
- `current_status` - Enum: draft, pending_approval, approved, scheduled, dispatched, en_route, arrived, in_progress, on_hold, completed, cancelled, rescheduled, requires_parts, requires_approval, quality_check, invoiced, closed
- `scheduled_start` - datetime (Y-m-d H:i:s) - Scheduled start date and time
- `scheduled_end` - datetime (Y-m-d H:i:s) - Scheduled end date and time (must be after scheduled_start)
- `requested_completion_by` - datetime (Y-m-d H:i:s)
- `completion_percentage` - integer (0-100)
- `work_started_at` - datetime
- `work_completed_at` - datetime
- `special_instructions` - string
- `completion_summary` - string
- `primary_contact_id` - UUID
- `customer_presence_required` - boolean
- `customer_notification_sent` - boolean
- `customer_notified_at` - datetime
- `preferred_communication_methods` - array (phone, email, sms, app)
- `estimated_labor_cost` - numeric, min:0
- `estimated_parts_cost` - numeric, min:0
- `actual_labor_cost` - numeric, min:0
- `actual_parts_cost` - numeric, min:0
- `customer_signature_required` - boolean
- `customer_signature_received` - boolean
- `customer_signed_at` - datetime
- `quality_check_required` - boolean
- `quality_check_passed` - boolean
- `quality_checked_by` - UUID
- `quality_checked_at` - datetime
- `customer_satisfaction_score` - integer (1-5)
- `customer_feedback` - string
- `requires_follow_up` - boolean
- `follow_up_date` - date
- `follow_up_completed` - boolean
- `warranty_applicable` - boolean
- `warranty_days` - integer
- `warranty_expires_at` - date
- `assigned_supervisor_id` - UUID
- `external_work_order_id` - string
- `customer_po_number` - string
- `contract_number` - string
- `external_references` - array
- `response_time_minutes` - integer
- `resolution_time_minutes` - integer
- `completed_on_time` - boolean
- `completed_within_estimate` - boolean
- `callback_count` - integer
- `requires_manager_approval` - boolean
- `approved_by` - UUID
- `approved_at` - datetime
- `approval_notes` - string
- `risk_level` - Enum: low, medium, high, critical
- `safety_incident_occurred` - boolean
- `safety_requirements` - array
- `permit_required` - boolean
- `permit_number` - string
## Auto-Calculated Fields (do not send these)
- `estimated_total` - Automatically calculated from estimated_labor_cost + estimated_parts_cost
- `actual_total` - Automatically calculated from actual_labor_cost + actual_parts_cost
- `actual_duration_minutes` - Automatically calculated from work_started_at and work_completed_at
Request
This endpoint expects a multipart form.
sourcestringRequired
Required: Enum - customer_request|scheduled_maintenance|emergency_call|contract|inspection|internal|warranty_claim|follow_up|system_generated|mobile_app|web_portal|call_center - Work order source
categorystringRequired
Required: Enum - scheduled|emergency|warranty|contract|inspection|installation|repair|delivery|consultation|follow_up|recall|upgrade - Work order category
prioritystringRequired
Required: Enum - low|normal|high|urgent|emergency|critical - Work order priority level
service_idstringRequired
Required: UUID - Service UUID from service catalog
customer_idstringRequired
Required: UUID - Customer UUID (must exist in customers table)
location_idstringRequired
Required: UUID - Customer location UUID
scheduled_endstringRequired
Optional: datetime - Scheduled end date and time (must be after scheduled_start)
current_statusstringRequired
Optional: Enum - scheduled|dispatched|en_route|arrived|in_progress|on_hold|completed|cancelled|rescheduled|requires_parts|invoiced|closed - Initial work order status
scheduled_startstringRequired
Optional: datetime - Scheduled start date and time
Response
Successful response