---
title: "Edit the plan"
method: POST
path: "/api/v2/itineraries/{externalId}/edits"
tags: ["Itineraries (v2)"]
---

# Edit the plan

`POST /api/v2/itineraries/{externalId}/edits`

## Request

- Base URL: `https://www.endlesstravelplans.com`
- URL: `https://www.endlesstravelplans.com/api/v2/itineraries/{externalId}/edits`
- Auth: HTTP bearer

One of the Build step's hand edits, autosaved: `op` is `add_day`, `remove_day` (`date`), `move_activity`
(`activityId`, `fromDate`, `toDate`, `index` optional), `reorder` (`activityId`, `date`, `index`),
`add_custom` (`date`, `title`, `time`, `notes`, `address`, `location`), `update_custom` (`date`,
`activityId`, same fields), `remove_activity` (`date`, `activityId`; a suggestion goes back to the pool),
`restore_from_pool` (`activityId`, `date`), `swap` (`date`, `activityId`; a like-for-like idea from the
pool), `set_price` (`date`, `activityId`, `price`), `set_quantity` (`date`, `activityId`, `quantity`,
`groupRate`). Travel legs are recomputed for the days touched; the answer is the document with
`dirty_days` and the step's `label` for the client's own undo. A refused edit answers 422 with the
step's words; a row another editor moved on from answers 409 with the current document.

## Request body

- object
  - `op` string, required: The operation.
  - `editVersion` integer, nullable: The version the client loaded.
  - `date` string, nullable: Must be a valid date in the format <code>Y-m-d</code>.
  - `fromDate` string, nullable: The day it leaves (Y-m-d).
  - `toDate` string, nullable: The day it goes to (Y-m-d).
  - `activityId` string, nullable: The activity.
  - `index` integer, nullable: Its position in the day; the free slot when left out.
  - `title` string, nullable: Must not be greater than 255 characters.
  - `time` string, nullable: Must not be greater than 20 characters.
  - `notes` string, nullable: Must not be greater than 2000 characters.
  - `address` string, nullable: Must not be greater than 500 characters.
  - `location` object, nullable
    - `lat` number: This field is required when <code>location</code> is present.
    - `lng` number: This field is required when <code>location</code> is present.
  - `price` number, nullable: Must be at least 0. Must not be greater than 1000000.
  - `quantity` integer, nullable: Must be at least 1. Must not be greater than 99.
  - `groupRate` boolean, nullable
  - `category` 'custom' | 'sightseeing' | 'adventure' | 'cultural' | 'food' | 'shopping' | 'relaxation' | 'nature' | 'nightlife', nullable

## Response `200`

- object
  - `external_id` string
  - `state` string
  - `plan` object
    - `days` unknown[]
      - unknown
    - `markers` object[]
      - `id` string
      - `name` string
      - `lat` number
      - `lng` number
      - `category` string
      - `day` integer
      - `order` integer
  - `dirty_days` string[]
  - `label` string
  - `edit_version` integer

## Other responses

- `401`: unauthenticated: No valid bearer token was sent.
- `409`: another editor moved on
- `422`
- `429`: rate_limited: A throttle or a per-account allowance refused the request; `retry_after` or `remaining` may be present.
- `500`: server_error: Unhandled failure; quote `request_id` to support.

---

[API](https://skmtc.dev/endlesstravelplans/apis/endless-travel-plans-api.md) · [All operations](https://skmtc.dev/endlesstravelplans/apis/endless-travel-plans-api/llms.txt) · [OpenAPI document](https://skmtc.dev/endlesstravelplans/apis/endless-travel-plans-api/revisions/ae82ed3e4a8f?raw)
