--- title: routes.apply | Doing Work API description: Write a planned route back: new times, and optionally new workers, for up to 100 visits at once (owner or office). All or nothing: if any visit is not sche url: https://doingwork.work/docs/reference/routes-apply/ --- # routes.apply Write a planned route back: new times, and optionally new workers, for up to 100 visits at once (owner or office). All or nothing: if any visit is not scheduled (already on the way, there, started, done or cancelled), not this shop's, or the plan leaves a worker with overlapping visits, nothing changes and the problems come back in conflicts. Pass allow_overlaps true to save overlaps anyway, or dry_run true to check without saving. Each moved visit gets its appointment reminder planned again once. | | | |---|---| | Who | Agents can call this | | REST | `POST /v1/routes/apply` | | MCP tool | `routes_apply` | | Writes | yes, send an Idempotency-Key | | Area | [Shop](https://doingwork.work/docs/reference/#shop) | ## When to use it Write a planned route back: new times, and optionally new workers, for up to 100 visits at once (owner or office). All or nothing: if any visit is not scheduled (already on the way, there, started, done or cancelled), not this shop's, or the plan leaves a worker with overlapping visits, nothing changes and the problems come back in conflicts. ## What to tell the owner Say what you did in plain words and what happens next. ## Input | Field | Type | Required | |---|---|---| | `shop_id` | string (uuid) | yes | | `changes` | array | yes | | `changes[].visit_id` | string (uuid) | yes | | `changes[].starts_at` | string (date-time) | yes | | `changes[].ends_at` | string (date-time) | yes | | `changes[].person_ids` | array | no | | `allow_overlaps` | boolean | no | | `dry_run` | boolean | no | ## Example ```http POST https://doingwork.work/v1/routes/apply content-type: application/json Idempotency-Key: 3f1c... { "shop_id": "00000000-0000-4000-8000-000000000000", "changes": [ { "visit_id": "00000000-0000-4000-8000-000000000000", "starts_at": "...", "ends_at": "..." } ] } ``` ## Output JSON. The response shape isn't published yet; read the fields you need and ignore the rest. Errors are `{code, message, status}`. ## Errors | Code | Status | What to do | |---|---|---| | `invalid_input`, `invalid_token`, `rate_limited` | | Can happen on any call. See [errors](https://doingwork.work/docs/errors/). |