---
title: "Start Dispatch Plan Optimization"
method: POST
path: "/v1/plans/{planId}/optimizations"
tags: ["Dispatch plans"]
---

# Start Dispatch Plan Optimization

`POST /v1/plans/{planId}/optimizations`

## Request

- Base URL: `https://api.sandbox.usenash.com`
- URL: `https://api.sandbox.usenash.com/v1/plans/{planId}/optimizations`
- Auth: none declared

Queue a run that re-solves a snapshot plan's routes on their own trucks. Nothing changes until the run is taken; the lease is not held while it runs. Fails with 409 `PLAN_LEASE_HELD` (naming `heldBy`) while anyone has the plan open in the Planner, and with 409 `PLAN_REVISION_STALE` (naming `currentRevision`) when the plan changed since `expectedRevision`.

## Path parameters

- `planId` string, required

## Request body

- StartDispatchPlanOptimization
  - `expectedRevision` integer, required: The `revision` of the plan you last read.
  - `params` DispatchPlanOptimizationParams
    - `outOfServiceRouteIds` string[]: Draft routes whose truck is out: their orders go to the other trucks.

## Response `202`

Accepted

- DispatchPlanOptimizationStarted
  - `activityId` string, required: Poll it until it is `succeeded` or `failed`, and take a `succeeded` one.

## Other responses

- `422`: Unprocessable Content

---

[API](https://skmtc.dev/nash/apis/nash-api.md) - [All operations](https://skmtc.dev/nash/apis/nash-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nash/apis/nash-api/revisions/e3713837c5c9?raw)
