es
Reservas›Preview re-staffing a technician's whole day (sick call)

Preview re-staffing a technician's whole day (sick call)

Solves (WITHOUT writing) the re-staffing of every job on a technician's board for a date range: each job is handed to an ALTERNATE lead technician at its UNCHANGED window — the customer's appointment never moves, two overlapping jobs never land on the same alternate, and the absent technician is never a candidate. `date`/`until_date` are business-local calendar days (inclusive, ≤ 14 days). Jobs the planner cannot re-staff come back in `unresolved` with a `reason_code` (no qualified technician free / crew job / multi-day job / already in progress) — a partial plan is a normal 200, not an error. `solver.duration_ms` is server-side planner time; `solver.deterministic` is true (same input ⇒ same plan). Read-only, safe to repeat; copy `resolved[]` into the commit body. No time-off record is required to preview. When the strict pass leaves a job unresolved, its row ALSO carries `alternatives[]` — the relaxation ladder's priced options, cheapest constraint first (ABSENCE_RESOLVE_DESIGN.md §9): `reassign_out_of_area` (same window, a lead outside the job's zone — cost.distance_km/travel_minutes), then `reschedule_same_day` / `reschedule_later_day` (the earliest free window on a qualified lead, in-area before out-of-area, up to 3 working days past until_date — cost.customer_renotified, cost.day_offset, cost.sla_breached). Each option is a PROPOSAL: nothing is applied until the coordinator copies it into the commit body with its `alternative_kind` (+ `start_at`/`end_at` for a reschedule). `alternatives` is an empty array when even the ladder found nothing; `solver.alternatives_truncated` is true when the ladder's time budget cut the search short. Displacing another customer's job and overtime are deliberately NOT offered. See ABSENCE_RESOLVE_DESIGN.md.

Argumentos

datestringbodyobligatorio
First day of the absence — a business-local calendar day (YYYY-MM-DD).
job_idsarray<string>bodyopcional
Optional subset of the technician's jobs to plan for; every id must be on their board inside the range (else ABSENCE_RESOLVE_INVALID_INPUT with data.job_ids naming the strangers). Omitted = every job in the range.
technician_idstringbodyobligatorio
The absent technician (must belong to the business).
until_datestringbodyopcional
Last day of the absence, inclusive (YYYY-MM-DD). Omitted = date. Must not precede date; the range is capped at 14 days. Both rules are checked in the usecase (ABSENCE_RESOLVE_INVALID_INPUT, data.field) — a cross-field binding tag would answer before the code that names the problem.
POST/v1/job-requests/absence/preview
curl -X POST "https://api.crisphive.com/v1/job-requests/absence/preview" \
  -H "Authorization: Bearer chsk_test_4eC8xQ9mZ2pL7Ka0rT" \
  -H "Content-Type: application/json" \
  -d '{
  "date": "2030-06-15",
  "job_ids": [
    "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01"
  ],
  "technician_id": "9b2f6c3e-1a4d-4f0a-8f2e-7c5d1b3a9e01",
  "until_date": "2030-06-16"
}'
Cuerpo de la solicitud
{
"date": ,
"job_ids": [
],
"technician_id": ,
"until_date":
}

Respuestas