en
Bookings›Preview emergency insert + cascade reschedule

Preview emergency insert + cascade reschedule

Computes (WITHOUT writing) the cascade of inserting an emergency job onto a technician at a chosen time: where the emergency lands + every job pushed back, grouped per business-local day. `displacement_mode=reassign` instead hands each displaced job to another feasible technician at its ORIGINAL window (same-day promise) — jobs with no alternate capacity fall back to reschedule and stay in `days`. `mode=overtime` keeps everyone same-day (tech works late); `mode=next_day` rolls overflow to the next working day(s). `after_hours_override=true` — the coordinator has phoned the technician — drops the non-working-day rejection; the response then carries an AFTER_HOURS warning naming how far outside the window the insert sits. This endpoint never runs the technician's working-hours/time-off feasibility check (that only happens on /candidates) — it validates the named technician exists and builds the cascade. Read-only — safe to call repeatedly; commit is a separate endpoint. Isolated feature (see EMERGENCY_RESCHEDULE_DESIGN.md). 409 NEXT STEPS: EMERGENCY_RESCHEDULE_SLOT_OCCUPIED — the landing window is blocked by a job the cascade may NOT move (another P0, a crew or multi-day job); `data.conflicts[]` names each blocking job (short_code/start_at/end_at/frozen_because): choose another technician (walk the /candidates ranking) or another time; displacement never touches P0/crew/multi-day anchors. EMERGENCY_RESCHEDULE_NOT_ELIGIBLE / CREW_UNSUPPORTED / MULTIDAY_UNSUPPORTED / IN_PAST — same remedies and `data` shapes as /candidates. EMERGENCY_RESCHEDULE_NO_WORKING_DAY does NOT fire when after_hours_override=true.

Arguments

after_hours_overridebooleanbodyoptional
Place this P0 outside working hours / approved time-off — you have phoned the technician and they agreed. Drops the non-working-day rejection; the response then carries an AFTER_HOURS warning. Double-booking, service area, required skills and the lead-tier rule still reject.
displacement_modeenumbodyoptional
Fate of displaced jobs: reschedule (default — pushed to later windows) or reassign (handed to another feasible technician at their ORIGINAL time; no-capacity jobs fall back to reschedule).
emergency_job_idstringbodyrequired
ID of the P0 job to insert.
modeenumbodyrequired
Cascade mode: overtime = displaced jobs stay same-day (tech works late); next_day = overflow rolls to the next working day.
start_atstringbodyrequired
Desired start — business-local wall clock. Seconds may be omitted and a space may replace the T; an offset is accepted only when it agrees with the business timezone (a disagreeing one is refused with JOB_REQUEST_INVALID_INPUT rather than guessed). Must be in the future.
technician_idstringbodyrequired
Target technician (must belong to the business).
POST/v1/job-requests/emergency/preview
curl -X POST "https://api.crisphive.com/v1/job-requests/emergency/preview" \
  -H "Authorization: Bearer chsk_test_4eC8xQ9mZ2pL7Ka0rT" \
  -H "Content-Type: application/json" \
  -d '{
  "after_hours_override": true,
  "displacement_mode": "reschedule",
  "emergency_job_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01",
  "mode": "overtime",
  "start_at": "2030-06-14T09:00:00",
  "technician_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01"
}'
Request body
{
"after_hours_override": ,
"displacement_mode": ,
"emergency_job_id": ,
"mode": ,
"start_at": ,
"technician_id":
}

Responses