Cars Bookings
A booking for a rental car quote.
Schema
Metadata contains a set of key-value pairs you passed in the request when you created the booking. Duffel does not use this information. This field should not be used for storing sensitive information. The purpose of this field is to allow you to store additional information about the booking in a structured format that you can use for your own purposes.
{"custom_field":"custom_value_123"}Endpoint
POST https://api.duffel.com/cars/bookings/{id}/actions/cancel
Request
curl -X POST --compressed "https://api.duffel.com/cars/bookings/{id}/actions/cancel" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
Response
{"data": {"users": ["icu_0000B0nwceAOyWuOFJ23NJ"],"total_currency": "GBP","total_amount": "101.34","supplier": {"name": "Duffel Test Drive","logo_url": "https://duffel.com/logo.jpg"},"status": "confirmed","reference": "DTD-ABC123","quote_id": "qut_0000Bx4Af0b5l45AT50eqO","privacy_policies": [{"text": "Your data may be shared with the supplier to process your booking.","title": "Customer Data Use"}],"pickup_time": "10:30","pickup_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"pickup_date": "2024-01-15","payment_type": "guarantee","metadata": {"custom_field": "custom_value_123"},"live_mode": false,"id": "boo_0000Cx4Af0b5l45AT50eqO","dropoff_time": "15:00","dropoff_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"dropoff_date": "2024-01-20","driver": {"user_id": "icu_0000B0nwceAOyWuOF3pz1M","phone_number": "+441234567890","given_name": "Amelia","family_name": "Earheart","date_of_birth": "1990-01-01"},"confirmed_at": "2022-12-20T15:45:01.000000Z","conditions": [{"title": "Cancellation Policy","text": "Free cancellation up to 24 hours before pickup."}],"charges": [{"amount": "5.00","currency": "GBP","description": "Insurance fee"}],"car": {"type": "four_door","transmission": "automatic","name": "Kia Picanto","max_passengers": 5,"images": [{"url": "https://car.com/kia_picanto.jpg"}],"fuel": "petrol","code": "CDAV","category": "compact","baggage": {"small": 2,"large": 3},"air_conditioning": true},"base_currency": "GBP","base_amount": "95.22"}}
Create a Booking
Creates a booking for a rental car from a Quote
Body parameters
Metadata contains a set of key-value pairs that you can attach to an object. It can be useful for storing additional information about the object, in a structured format. Duffel does not use this information. You should not store sensitive information in this field. The metadata is a collection of key-value pairs, both of which are strings. You can store a maximum of 50 key-value pairs, where each key has a maximum length of 40 characters and each value has a maximum length of 500 characters. Keys must only contain numbers, letters, dashes, or underscores.
{"custom_field":"custom_value_123"}Endpoint
POST https://api.duffel.com/cars/bookings
Request
curl -X POST --compressed "https://api.duffel.com/cars/bookings" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \-d '{"data": {"users": ["icu_0000B0nwceAOyWuOFJ23NJ"],"quote_id": "qut_0000Bx4Af0b5l45AT50eqO","payment": {"method": "card","card_id": "crd_0000A3t2sL46m5eDF45kWW"},"metadata": {"custom_field": "custom_value_123"},"driver": {"user_id": "icu_0000B0nwceAOyWuOF3pz1M","phone_number": "+442080160509","given_name": "Amelia","family_name": "Earheart","email": "[email protected]","date_of_birth": "1990-01-01"}}}'
Response
{"data": {"users": ["icu_0000B0nwceAOyWuOFJ23NJ"],"total_currency": "GBP","total_amount": "101.34","supplier": {"name": "Duffel Test Drive","logo_url": "https://duffel.com/logo.jpg"},"status": "confirmed","reference": "DTD-ABC123","quote_id": "qut_0000Bx4Af0b5l45AT50eqO","privacy_policies": [{"text": "Your data may be shared with the supplier to process your booking.","title": "Customer Data Use"}],"pickup_time": "10:30","pickup_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"pickup_date": "2024-01-15","payment_type": "guarantee","metadata": {"custom_field": "custom_value_123"},"live_mode": false,"id": "boo_0000Cx4Af0b5l45AT50eqO","dropoff_time": "15:00","dropoff_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"dropoff_date": "2024-01-20","driver": {"user_id": "icu_0000B0nwceAOyWuOF3pz1M","phone_number": "+441234567890","given_name": "Amelia","family_name": "Earheart","date_of_birth": "1990-01-01"},"confirmed_at": "2022-12-20T15:45:01.000000Z","conditions": [{"title": "Cancellation Policy","text": "Free cancellation up to 24 hours before pickup."}],"charges": [{"amount": "5.00","currency": "GBP","description": "Insurance fee"}],"car": {"type": "four_door","transmission": "automatic","name": "Kia Picanto","max_passengers": 5,"images": [{"url": "https://car.com/kia_picanto.jpg"}],"fuel": "petrol","code": "CDAV","category": "compact","baggage": {"small": 2,"large": 3},"air_conditioning": true},"base_currency": "GBP","base_amount": "95.22"}}
Endpoint
GET https://api.duffel.com/cars/bookings/{id}
Request
curl -X GET --compressed "https://api.duffel.com/cars/bookings/{id}" \-H "Accept-Encoding: gzip" \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Duffel-Version: v2" \-H "Authorization: Bearer <YOUR_ACCESS_TOKEN>"
Response
{"data": {"users": ["icu_0000B0nwceAOyWuOFJ23NJ"],"total_currency": "GBP","total_amount": "101.34","supplier": {"name": "Duffel Test Drive","logo_url": "https://duffel.com/logo.jpg"},"status": "confirmed","reference": "DTD-ABC123","quote_id": "qut_0000Bx4Af0b5l45AT50eqO","privacy_policies": [{"text": "Your data may be shared with the supplier to process your booking.","title": "Customer Data Use"}],"pickup_time": "10:30","pickup_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"pickup_date": "2024-01-15","payment_type": "guarantee","metadata": {"custom_field": "custom_value_123"},"live_mode": false,"id": "boo_0000Cx4Af0b5l45AT50eqO","dropoff_time": "15:00","dropoff_location": {"phone_number": "+44 1234 567890","opening_hours": [{"to": "20:00","from": "08:00"}],"name": "Duffel Test Drive Dropoff","geographic_coordinates": {"longitude": -0.4543,"latitude": 51.47},"address": {"region": "England","postal_code": "W1J 9BR","line_one": "150 Piccadilly","country_code": "GB","city_name": "London"},"additional_information": [{"title": "Pickup Instructions","text": "Please follow the signs to the rental car area."}]},"dropoff_date": "2024-01-20","driver": {"user_id": "icu_0000B0nwceAOyWuOF3pz1M","phone_number": "+441234567890","given_name": "Amelia","family_name": "Earheart","date_of_birth": "1990-01-01"},"confirmed_at": "2022-12-20T15:45:01.000000Z","conditions": [{"title": "Cancellation Policy","text": "Free cancellation up to 24 hours before pickup."}],"charges": [{"amount": "5.00","currency": "GBP","description": "Insurance fee"}],"car": {"type": "four_door","transmission": "automatic","name": "Kia Picanto","max_passengers": 5,"images": [{"url": "https://car.com/kia_picanto.jpg"}],"fuel": "petrol","code": "CDAV","category": "compact","baggage": {"small": 2,"large": 3},"air_conditioning": true},"base_currency": "GBP","base_amount": "95.22"}}