# Create a trip

> Creates a trip owned by the key's owner: blank, from a trip template (`templateId`, which brings the template's design and blocks), or from a `design` (a route: origin, stops with nights, transfers), which builds one itinerary day per trip day and derives `endDate`.

`POST /v1/trips`

Creates a trip owned by the key's owner: blank, from a trip template (`templateId`, which brings the template's design and blocks), or from a `design` (a route: origin, stops with nights, transfers), which builds one itinerary day per trip day and derives `endDate`. A design needs `startDate`. Optional `travelers`, `ownerId`, `presentation`, `profile` and `metadata` are set in the same change. With `?dryRun=true` nothing is written and a `trip_create_preview` comes back.

**Permissions:** `trips:write` · **Kind:** write · **Cost:** 1 unit · **Dry run:** `?dryRun=true` · MCP tool [`create_trip`](https://api.bymundi.com/docs/mcp/tools/create_trip.md)

Undoable: the response carries `Bymundi-Change-Id`; [revert it](https://api.bymundi.com/docs/guides/undo-and-dry-run.md) with `POST /v1/changes/{changeId}/revert`.

## Path parameters

_None._

## Body

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes |  |
| `startDate` | string \| null |  |  |
| `endDate` | string \| null |  |  |
| `templateId` | uuid |  |  |
| `design` | object |  |  |
| `design.version` | 1 | yes |  |
| `design.originCity` | string | yes |  |
| `design.stops` | object[] | yes | max 60 items |
| `design.stops[].id` | string | yes |  |
| `design.stops[].city` | string | yes |  |
| `design.stops[].nights` | integer | yes | 0–365 |
| `design.stops[].transferBefore` | object \| null | yes |  |
| `design.stops[].escala` | boolean |  | default false |
| `design.stops[].place` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.returnCity` | string \| null | yes |  |
| `design.returnTransfer` | object \| null | yes |  |
| `design.returnTransfer.id` | string | yes |  |
| `design.returnTransfer.departDate` | string \| null | yes |  |
| `design.returnTransfer.arriveDate` | string \| null | yes |  |
| `design.returnTransfer.days` | integer |  | 0–30, default 0 |
| `design.returnTransfer.departTime` | string |  | default "" |
| `design.returnTransfer.arriveTime` | string |  | default "" |
| `design.returnTransfer.flight` | object |  | default {"flightNo":"","airline":"","fromAirport":"","toAirport":"","source":"","fetchedAt":"","scheduleValidFor":""} |
| `design.originPlace` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.originPlace.placeId` | string |  | default "" |
| `design.originPlace.lat` | number \| null |  | default null |
| `design.originPlace.lng` | number \| null |  | default null |
| `design.originPlace.formattedAddress` | string |  | default "" |
| `design.returnPlace` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.returnPlace.placeId` | string |  | default "" |
| `design.returnPlace.lat` | number \| null |  | default null |
| `design.returnPlace.lng` | number \| null |  | default null |
| `design.returnPlace.formattedAddress` | string |  | default "" |
| `travelers` | integer |  | 1–40 |
| `ownerId` | uuid |  |  |
| `presentation` | object |  |  |
| `presentation.logoUrl` | uri \| null |  |  |
| `presentation.brandColor` | string \| null |  |  |
| `presentation.fontFamily` | "inter" \| "montserrat" \| "poppins" \| "lora" \| "playfair" \| "source-sans" \| null |  |  |
| `presentation.headerMedia` | object \| null |  |  |
| `presentation.headerMedia.type` | "image" \| "video" | yes |  |
| `presentation.headerMedia.url` | uri | yes |  |
| `profile` | object |  |  |
| `profile.pace` | "relajado" \| "equilibrado" \| "intenso" \| null |  |  |
| `profile.profiles` | "primera_vez" \| "repetidor" \| "familia_ninos" \| "pareja" \| "grupo" \| "senior" \| "movilidad_reducida" \| "cultural" \| "gastronomico" \| "naturaleza" \| "fotografia" \| "otaku" \| "compras" \| "presupuesto_ajustado" \| "premium"[] |  |  |
| `profile.mobility` | "normal" \| "reducida" |  |  |
| `profile.avoid` | string[] |  |  |
| `profile.notes` | string |  |  |
| `metadata` | object |  |  |

## Response `201`

One of:

### `trip`

| Field | Type | Required | Description |
|---|---|---|---|
| `object` | "trip" | yes |  |
| `id` | uuid | yes |  |
| `code` | string | yes |  |
| `title` | string | yes |  |
| `startDate` | string \| null | yes |  |
| `endDate` | string \| null | yes |  |
| `publication` | "draft" \| "published" | yes |  |
| `commercialState` | "nueva" \| "propuesta_enviada" \| "aceptada" \| "reserva_provisional" \| "reservada" \| "rechazada" \| "cancelada" | yes |  |
| `travelers` | integer | yes |  |
| `ownerId` | uuid \| null | yes |  |
| `design` | object \| null | yes |  |
| `design.version` | 1 | yes |  |
| `design.originCity` | string | yes |  |
| `design.stops` | object[] | yes | max 60 items |
| `design.stops[].id` | string | yes |  |
| `design.stops[].city` | string | yes |  |
| `design.stops[].nights` | integer | yes | 0–365 |
| `design.stops[].transferBefore` | object \| null | yes |  |
| `design.stops[].escala` | boolean |  | default false |
| `design.stops[].place` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.returnCity` | string \| null | yes |  |
| `design.returnTransfer` | object \| null | yes |  |
| `design.returnTransfer.id` | string | yes |  |
| `design.returnTransfer.departDate` | string \| null | yes |  |
| `design.returnTransfer.arriveDate` | string \| null | yes |  |
| `design.returnTransfer.days` | integer |  | 0–30, default 0 |
| `design.returnTransfer.departTime` | string |  | default "" |
| `design.returnTransfer.arriveTime` | string |  | default "" |
| `design.returnTransfer.flight` | object |  | default {"flightNo":"","airline":"","fromAirport":"","toAirport":"","source":"","fetchedAt":"","scheduleValidFor":""} |
| `design.originPlace` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.originPlace.placeId` | string |  | default "" |
| `design.originPlace.lat` | number \| null |  | default null |
| `design.originPlace.lng` | number \| null |  | default null |
| `design.originPlace.formattedAddress` | string |  | default "" |
| `design.returnPlace` | object |  | default {"placeId":"","lat":null,"lng":null,"formattedAddress":""} |
| `design.returnPlace.placeId` | string |  | default "" |
| `design.returnPlace.lat` | number \| null |  | default null |
| `design.returnPlace.lng` | number \| null |  | default null |
| `design.returnPlace.formattedAddress` | string |  | default "" |
| `presentation` | object | yes |  |
| `presentation.logoUrl` | uri \| null |  |  |
| `presentation.brandColor` | string \| null |  |  |
| `presentation.fontFamily` | "inter" \| "montserrat" \| "poppins" \| "lora" \| "playfair" \| "source-sans" \| null |  |  |
| `presentation.headerMedia` | object \| null |  |  |
| `presentation.headerMedia.type` | "image" \| "video" | yes |  |
| `presentation.headerMedia.url` | uri | yes |  |
| `profile` | object | yes |  |
| `profile.pace` | "relajado" \| "equilibrado" \| "intenso" \| null |  | default null |
| `profile.profiles` | "primera_vez" \| "repetidor" \| "familia_ninos" \| "pareja" \| "grupo" \| "senior" \| "movilidad_reducida" \| "cultural" \| "gastronomico" \| "naturaleza" \| "fotografia" \| "otaku" \| "compras" \| "presupuesto_ajustado" \| "premium"[] |  | default [] |
| `profile.mobility` | "normal" \| "reducida" |  | default "normal" |
| `profile.avoid` | string[] |  | default [] |
| `profile.notes` | string |  | default "" |
| `coverImageUrl` | string \| null | yes |  |
| `coverage` | object \| null | yes |  |
| `coverage.state` | "sin_cobros" \| "pago_parcial" \| "pagado" | yes |  |
| `coverage.percent` | integer | yes |  |
| `coverage.overpaid` | boolean | yes |  |
| `metadata` | object | yes |  |
| `appUrl` | string \| null | yes |  |
| `publicUrl` | string \| null | yes |  |
| `createdAt` | string | yes |  |
| `updatedAt` | string | yes |  |

### `trip_create_preview`

| Field | Type | Required | Description |
|---|---|---|---|
| `object` | "trip_create_preview" | yes |  |
| `title` | string | yes |  |
| `startDate` | string \| null | yes |  |
| `endDate` | string \| null | yes |  |
| `blocksAdded` | integer | yes |  |
| `days` | object[] | yes |  |
| `days[].date` | string | yes |  |
| `days[].title` | string | yes |  |


## Errors

Errors are [problem details](https://api.bymundi.com/docs/guides/errors.md). Besides the refusals described above, any call like this one can return:

- [`invalid_request`](https://api.bymundi.com/problems/invalid_request.md) — Invalid request
- [`unauthorized`](https://api.bymundi.com/problems/unauthorized.md) — Missing or invalid API key
- [`insufficient_scope`](https://api.bymundi.com/problems/insufficient_scope.md) — Missing permission
- [`rate_limited`](https://api.bymundi.com/problems/rate_limited.md) — Rate limit reached
- [`idempotency_key_reused`](https://api.bymundi.com/problems/idempotency_key_reused.md) — Idempotency-Key reused
- [`request_in_progress`](https://api.bymundi.com/problems/request_in_progress.md) — Request in progress

## Examples

#### curl

```bash
curl -X POST https://api.bymundi.com/v1/trips \
  -H "Authorization: Bearer $BYMUNDI_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"title":"string"}'
```

#### JavaScript

```javascript
const res = await fetch("https://api.bymundi.com/v1/trips", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BYMUNDI_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({"title":"string"}),
});
if (!res.ok) throw new Error((await res.json()).detail);
const data = await res.json();
```

#### Python

```python
import os, uuid, requests

res = requests.post(
    "https://api.bymundi.com/v1/trips",
    headers={"Authorization": f"Bearer {os.environ['BYMUNDI_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={"title":"string"},
)
res.raise_for_status()
data = res.json()
```
