# Migrating API Version from v1 to v2

## Refresher on API versions

Every request to Duffel's API must have the version specified. This determines the requests, responses, and overall behaviour. Over time we improve our API. Generally this doesn't require migration. When it does, we provide a migration guide, such as this document. You can read more about how we do [versioning in our API reference](/content/docs/api/overview/versioning/index.html).

## From v1 to v2

Migration requires changing the `Duffel-Version` header in your requests from `Duffel-Version: v1` to `Duffel-Version: v2`.

Listed below are the breaking changes to v2.

### Flights Order airline-initiated changes (AIC)

#### Conditions are an object instead of a list

`added.conditions` and `removed.conditions` on [airline-initiated changes](/content/docs/api/v2/airline-initiated-changes/schema/index.html) were previously `list`s and are now `object`s, to match Order slice conditions.

#### Pared down webhook event payload

[`order.airline_initiated_change_detected` event data](/content/docs/api/v2/webhook-events#webhook-events-schema-data-data-airline-initiated-changes-webhook-event-data/index.html) no longer includes the `changes` field. Use `data.object.id` to get more information by [listing the AICs for the order](/content/docs/guides/docs/api/v2/airline-initiated-changes/get-airline-initiated-changes/index.html) and finding the one matching `data.object.aic_id`.

### Flights Order cancellation can have null amount and currency

[Order cancellation](/content/docs/api/v2/order-cancellations/index.html)`refund_amount` and `refund_currency` can be null in cases where the refund amount is unknown. This only applies in cases where we are unable to get a refund quote from the carrier, and does not apply to any of the carriers where cancellation is supported in v1.

### Previously deprecated fields have been removed

#### Flights Offer

- `accepted_loyalty_programmes` removed in favour of `supported_loyalty_programmes`
- `allowed_passenger_identity_document_types` removed in favour of `supported_passenger_identity_document_types`

[Go to offer schema on v2 API reference](/content/docs/api/v2/offers/index.html)

#### Flights Create Order

- `passengers.type` removed

[Go to order creation on v2 API reference](/content/docs/api/v2/orders/create-order/index.html)

#### Flights Order

- `slices.changeable` removed in favour of the top-level `available_actions`
- `slices.segments.arrival_datetime` removed in favour of `slices.segments.arriving_at`
- `slices.segments.arrival_terminal` removed in favour of `slices.segments.destination_terminal`
- `slices.segments.departure_datetime` removed in favour of `slices.segments.departing_at`
- `slices.segments.departure_terminal` removed in favour of `slices.segments.origin_terminal`

[Go to order schema on v2 API reference](/content/docs/api/v2/orders/index.html)

Caution

If you have used card payment in a previous version of the API, please consult the API documentation carefully for changes in behaviour. Especially with regards to the new response codes documented [here](/content/docs/api/overview/response-handling/order-and-booking-creation/index.html).

#### Stays Accommodation

- `cheapest_rate_currency` removed from the Accommodation and moved to [Search Result](/content/docs/api/v2/search-result/index.html)
- `cheapest_rate_total_amount` removed from the Accommodation and moved to [Search Result](/content/docs/api/v2/search-result/index.html)

[Go to accommodation schema on v2 API reference](/content/docs/api/v2/accommodation/index.html)

#### Stays Booking

- `key_collection` removed from Booking and moved to [Accommodation](/content/docs/api/v2/accommodation/index.html)

[Go to booking schema on v2 API reference](/content/docs/api/v2/booking/index.html)

#### Stays Quote

- `adults` removed in favour of `guests`
- `card_component_key` removed in favour of the `/identity/component_client_keys` endpoint

[Go to quote schema on v2 API reference](/content/docs/api/v2/quote/index.html)

#### Stays Rate

- `payment_method` removed in favour of `available_payment_methods`

[Go to rate schema on v2 API reference](/content/docs/api/v2/search-result/schema#search-result-schema-accommodation-accommodation-rooms-accommodation-rooms-rates/index.html)

#### Stays Search Request

- `adults` removed in favour of `guests`

[Go to search request schema on v2 API reference](/content/docs/api/v2/search/index.html)

#### Stays Search Result

- `adults` removed in favour of `guests`

[Go to search result schema on v2 API reference](/content/docs/api/v2/search/index.html)

#### Cards Request

- `save` removed in favour of `multi_use`

#### Cards Response

- `saved` removed in favour of `multi_use`

#### Places Suggestion

- `name` removed in favour of `query`

[Refresher on API versions](/content/docs/guides/migrating-api-version-from-v1-to-v2#refresher-on-api-versions/index.html)

[From v1 to v2](/content/docs/guides/migrating-api-version-from-v1-to-v2#from-v1-to-v2/index.html)
