Last updated

Try Cars out!

If you are a Booking.com Managed Affiliated Partner and are part of the early access pilot program you can start trying our Cars API in your client application


Quick guide

Follow this quick guide to start playing around with our /cars API endpoints.
By building requests based on a basic use case you will learn how to integrate with your application so that a traveller can:

  • Search for car rental provided by Booking.com.
  • Look at and navigates through results.

When the traveller sees a vehicle and supplier location that meets their requirements, and decides to book, is redirected to Booking.com to complete the booking.

Before you start

Before start trying out our car rental endpoints, make sure that:

Checklist
You are a registered Booking.com Managed Affiliate Partner and are part of the early access Cars pilot program.
Your dedicated Account Manager has granted you access to Partner Centre (after signing agreed contract).

From the Partner Centre you have generated:

  • A valid API key that allows you to use the endpoints.

  • An unique identifier id (X-Affiliate-Id) that identifies your requests.

You have a suitable API testing tool, such as cURL or Postman.

For more information, see Authentication and authorisation section.

Use case

This use case represents a typical Cars API scenario:

A traveller visiting your website wants to add car rental for their upcoming holiday in Edinburgh, Scotland.

They want to book a medium sized car for 8 days.

The traveller is in the Netherlands and is using your website from their mobile phone.

To get familiar with the Car API flow and the endpoints involved, take this use case as an example in every step of this guide.

Attention
  • Do not forget to authenticate every call that you make to our endpoints by using your API key - Token and your X-Affiliate-Id parameter.
  • For more information, see the Authentication and authorisation section.

Step 1: Search for available vehicles

→ Use the /cars/search request to let travellers search for car rentals and look at the price and list of available vehicles for the route they are interested on.

Create the search request body with the following mandatory fields:

  • booker.country: Specify the two-letter country code from which the search request is being made.
    • Get your two-letter country code using the List countries endpoint.
    • In this case for the use case provided, use (nl).
    • This is required to ensure that the response complies with relevant laws on the display of taxes and fees.

The country code must always be in lowercase.

  • currency: Specify the three-letter code that uniquely identifies the country's monetary currency.

  • driver age: This field determines if age related fees are required or not. Since the age can change the total price, we recommend:

    • If the customer’s age is known, send the actual age (Must be a number between 18 and 99)
    • If age is unknown, prompt the traveller to select a default age range or submit their age outside this range.
    • When the default age range is chosen, the age submitted in the search request is 30.
  • route.pickupand dropoff: Specify the traveller's requested pickup and dropoff dates and times. Use the YYYY-MM-DD 00:00:00 format.

  • route.location: Specify location where pickup/dropoff is taking place. You can either:

    • Use the IATA three-letter code to identify an airport.
      • In this case, would be: EDI for Edimburgh airport.
      • Find your IATA codes here.
    • Or add the latitude/longitude coordinates (see example below)

Currently only airports are accepted. No train stations or other locations are supported.

For the provided use case you should create a request body similar to this example:

{
  "booker": {
    "country": "nl"
  },
  "currency": "EUR",
  "driver": {
    "age": 36
  },
  "route": {
    "pickup": {
      "datetime": "2024-09-01T10:00:00",
      "location": {
        "airport": "EDI"
      }
    },
    "dropoff": {
      "datetime": "2024-09-08T11:05:00",
      "location": {
        "airport": "EDI"
      }
    }
  }
}

Example with latitude and longitude coordinates:

...
    "pickup": {
      "datetime": "2024-09-01T11:05:00",
      "location": {
        "coordinates": {
          "latitude": 52.309456,
          "longitude": 4.762266
    }
...

Try it yourself

Step 2: Get details

Before you show the search results to the traveller, you need to get additional content about each vehicle, the supplier and the depot(s).

You can do it in two different ways:

a) Using the local cache of static data (Refer to the Static data cache section for more details).

b) Alternatively you can call the static data endpoints:

  • /cars/details -- to get additional information about the available vehicles.
  • /cars/suppliers -- to return the list of available cars suppliers.
  • /cars/depots -- for information about the pickup and dropoff locations returned in the cars/search response.

Step 3: Display your search results page

You now have the necessary information to display the search results to the traveller.

Select the data from both the cars/search and car/details responses to provide the level of information that is appropriate for your particular business scenario.

Recommendations

Limiting results

For a better search experience, you can define the maximum number of displayed results.

{
  "last_modified": "2023-09-01T11:05:00+00:00",
  "maximum_results": 100
}

Updated content

For cached static data such as the returned from car/details response, we recommend querying the last modified date to get the latest information.

Timestamps are set using the ISO 8601 standard, hence the valid format is: YYYY-MM-DDTHH:MM:SSZ, and only Coordinated Universal Time (UTC) is supported.

Suppliers

When showing suppliers results, we recommend presenting the supplier logo rather than only the supplier name. This can be easily recognised by the traveller, helping on the decision-making.

Scores

We also suggest displaying on your search results the total score and score breakdown given to specific depots, as it also helps on the booking decision.

Refer to the endpoints examples page for tips and samples.

Step 4: Redirect the customer to complete the booking

After a traveller has chosen the vehicle they want to book, you should redirect them to the URL (either app or web link) returned in your /cars/search response.

  1. Go to the /cars/search response.
  2. Copy the returned Booking URL.
  3. Redirect the traveller to the selected URL.

For example:

"url": {
  "app": "booking://cars/search?affiliate_id=xxxxx&driver_age=25&do_time=2024-06-22T10:00&do_loc_iata=MAN&pu_time=2024-06-20T10:00&pu_loc_iata=LHR&pu_loc_name=London+Heathrow+Airport&expand_search=false",
  "web": "https://cars.booking.com/search-results?vehicleId=699340901&vehicleInfo.vehicle.id=699340901&aid=xxxxxxx&prefcurrency=USD&preflang=en&driversAge=25&doHour=10&doMinute=0&doDay=22&doMonth=6&doYear=2024&dropLocationIata=MAN&puHour=10&puMinute=0&puDay=20&puMonth=6&puYear=2024&locationIata=LHR&locationName=London+Heathrow+Airport"
}
info

Refer to the endpoints examples section for more tips and suggestions.