---
title: "Re-distribute a plan"
method: POST
path: "/plans/{planId}:redistribute"
tags: ["Live Plans"]
---

# Re-distribute a plan

`POST /plans/{planId}:redistribute`

## Request

- Base URL: `https://api.spoke.com/public/v1`
- URL: `https://api.spoke.com/public/v1/plans/{planId}:redistribute`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/spoke/apis/spoke-api/docs/plans/:planId:redistribute/post.ts> (a function with typed inputs; its response is checked against the schema)

Re-distribute a plan to its drivers. This endpoint should be used only after updating a live plan. This will apply the re-optimization changes and send the drivers their routes.

## Path parameters

- `planId` string, required

## Response `200`

The distributed plan

- PlanSchema: A plan.
  - `id` string, required
  - `title` string, required: The title of the plan.
  - `starts` DateSchema, required: A date.
    - `day` integer, required: The day of the date.
    - `month` integer, required: The month of the date.
    - `year` integer, required: The year of the date.
  - `depot` string, required
  - `distributed` boolean, required: Whether the plan has been distributed.
  - `writable` boolean, required: Whether the plan is writable using the normal Plan APIs. If this is false, you will need to use the [Live Plan APIs](/api/v1#tag/Live-Plans) to edit the plan. Any plan created before 2023-04-01 is not writable.
  - `optimization` 'creating' | 'editing' | 'preview' | 'optimized' | 'optimizing', nullable, required: The optimization state of the plan.
  - `drivers` DriverIdSchema[], required: The driver IDs of the plan, in the format drivers/<id>.
  - `routes` RouteIdSchema[], required: The route IDs of the plan, in the format routes/<id>.
  - `routeOverrides` object, nullable, required: Settings for this plan to override default route configurations.
    - `startTime` object, nullable, required: Time of day in hours and minutes. Uses a 24 hour clock.
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `endTime` object, nullable, required: Time of day in hours and minutes. Uses a 24 hour clock.
      - `hour` integer, required: Hour of the day
      - `minute` integer, required: Minute of the hour
    - `startAddress` object, nullable, required: The address of the stop.
      - `address` string, required: The address of the stop.
      - `addressLineOne` string, required: The first line of the address.
      - `addressLineTwo` string, required: The second line of the address.
      - `latitude` number, nullable, required: The latitude of the address in decimal degrees.
      - `longitude` number, nullable, required: The longitude of the address in decimal degrees.
      - `placeId` string, nullable, required: The identifier of the place corresponding to this stop on Google Places
      - `placeTypes` string[], required: Array of strings that is provided by the Google AutoCompleteAPI
    - `endAddress` object, nullable, required: The address of the stop.
      - `address` string, required: The address of the stop.
      - `addressLineOne` string, required: The first line of the address.
      - `addressLineTwo` string, required: The second line of the address.
      - `latitude` number, nullable, required: The latitude of the address in decimal degrees.
      - `longitude` number, nullable, required: The longitude of the address in decimal degrees.
      - `placeId` string, nullable, required: The identifier of the place corresponding to this stop on Google Places
      - `placeTypes` string[], required: Array of strings that is provided by the Google AutoCompleteAPI
    - `maxStops` integer, nullable, required: Maximum number of Stops per route.
    - `drivingSpeed` 'slower' | 'average' | 'faster', nullable, required: The relative driving speed compared to others.
    - `deliverySpeed` 'slower' | 'average' | 'faster', nullable, required: The relative delivery speed compared to others.
    - `vehicleType` 'bike' | 'scooter' | 'car' | 'small_truck' | 'truck' | 'electric_cargo_bike', nullable, required: The vehicle type used for deliveries.
    - `optimizationSettings` object, required: Optimization settings for the plan.
      - `objective` 'minimize_drivers' | 'distribute_services', required: The primary optimization objective.
      - `subObjective` 'equalize_workload' | 'equalize_time' | 'maximize_efficiency', nullable: The secondary optimization objective.

## Other responses

- `400`: ID format is invalid
- `401`: Unauthorized
- `403`: Plan is no longer accessible due to data access restrictions. Upgrade to a plan that supports a longer delivery history period to access it.
- `404`: The provided plan id does not exist
- `409`: The plan is not yet optimized, is optimizing, was already distributed or was modified whilst processing request.
- `500`: An internal server error occurred
- `default`: The default error model

---

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