Commit emergency insert + cascade reschedule
Applies the cascade previewed by /emergency/preview: assigns the emergency job to the technician and pushes the displaced jobs back (or, with `displacement_mode=reassign`, re-staffs them onto their previewed alternates first), atomically. Supports Idempotency-Key. The server recomputes the plan under a lock and fences each job on its status_version — if anything changed since the preview it returns 409 EMERGENCY_RESCHEDULE_PLAN_DRIFTED (re-preview). Same body as preview + optional `emergency_expected_version`. `after_hours_override=true` must match the preview it followed — it drops the non-working-day rejection (this endpoint never runs the technician's working-hours/time-off feasibility check; that only happens on /candidates), and the response carries an AFTER_HOURS warning; the committed job's activity feed also records who authorized the after-hours placement. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_PLAN_DRIFTED — the schedule changed between your preview and this commit (another booking/move won a lane); `data.drifted[]` names the job(s) whose status_version moved when the fence can attribute it (absent, never empty, when only a length mismatch is known): call /preview again, show the fresh plan, then commit. EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — landing window blocked by an immovable anchor (P0/crew/multi-day); `data.conflicts[]` names it: another tech or time. Other codes — same remedies and `data` shapes as /candidates. EMERGENCY_RESCHEDULE_NO_WORKING_DAY does NOT fire when after_hours_override=true.
Arguments
curl -X POST "https://api.crisphive.com/v1/job-requests/emergency/commit" \ -H "Authorization: Bearer chsk_test_4eC8xQ9mZ2pL7Ka0rT" \ -H "Content-Type: application/json" \ -d '{ "after_hours_override": true, "displacement_mode": "reschedule", "emergency_expected_version": 1, "emergency_job_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01", "expected_move_ids": [ "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01" ], "mode": "overtime", "start_at": "2030-06-14T09:00:00", "technician_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01" }'