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.

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 were previously lists and are now objects, to match Order slice conditions.

Pared down webhook event payload

order.airline_initiated_change_detected event data no longer includes the changes field. Use data.object.id to get more information by listing the AICs for the order and finding the one matching data.object.aic_id.

Flights Order cancellation can have null amount and currency

Order cancellationrefund_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

Flights Create Order

  • passengers.type removed

Go to order creation on v2 API reference

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

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.

Stays Accommodation

  • cheapest_rate_currency removed from the Accommodation and moved to Search Result
  • cheapest_rate_total_amount removed from the Accommodation and moved to Search Result

Go to accommodation schema on v2 API reference

Stays Booking

Go to booking schema on v2 API reference

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

Stays Rate

  • payment_method removed in favour of available_payment_methods

Go to rate schema on v2 API reference

Stays Search Request

  • adults removed in favour of guests

Go to search request schema on v2 API reference

Stays Search Result

  • adults removed in favour of guests

Go to search result schema on v2 API reference

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

From v1 to v2