How to Search for Pickup Locations
Before searching for available rental cars, you need geographic coordinates for the pickup and drop-off locations. The Autocomplete endpoint lets users search by city or airport name and returns matching locations with the coordinates required by the search endpoint.
Endpoint
GET /cars/api/v2/autocomplete?key={search_term}
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Partial or full name of a city or airport. |
key parameter supports partial matching, so results will appear as the user types. For example, key=new yo will return results for New York area locations.
Example Request
HTTP
GET /cars/api/v2/autocomplete?key=new yo
x-api-key: YOURAPIKEY
x-correlation-id: 550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer YOUR_SIGNATURE
Example Response
JSON
{
"message": "success",
"data": [
{
"id": "1001",
"name": "John F. Kennedy International Airport",
"city_name": "New York",
"country_name": "United States",
"iata_code": "JFK",
"type": "airport",
"coordinates": {
"lat": 40.6413,
"lon": -73.7781
},
"region_id": "us-east"
},
{
"id": "1002",
"name": "New York City",
"city_name": "New York",
"country_name": "United States",
"iata_code": null,
"type": "city",
"coordinates": {
"lat": 40.7128,
"lon": -74.006
},
"region_id": "us-east"
},
{
"id": "1003",
"name": "LaGuardia Airport",
"city_name": "New York",
"country_name": "United States",
"iata_code": "LGA",
"type": "airport",
"coordinates": {
"lat": 40.7772,
"lon": -73.8726
},
"region_id": "us-east"
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the location. |
name | string | Full name of the airport or city. |
cityname | string | City where the location is situated. |
countryname | string | Country name. |
iatacode | string | IATA airport code. Present for airport results, null for cities. |
type | string | Either "airport" or "city". |
coordinates | object | Contains lat (latitude) and lon (longitude). |
regionid | string | Internal region identifier. |
City vs. Airport Results
The type field distinguishes between two kinds of results:
"airport"— A specific airport location. These results include aniata_codeand correspond to on-airport rental counters. Use airport coordinates when the traveler is picking up directly at the terminal."city"— A general city location. The coordinates represent the city center. Use city coordinates when the traveler wants to search for rental locations near a city area, which may include off-airport branches.
Using Coordinates in the Search Endpoint
The lat and lon values from the autocomplete response map directly to the pickupcode and returncode parameters in the Search Rentals endpoint:
GET /cars/api/v2/rentals?pickuptype=geo&pickupcode=40.7128,-74.006&returntype=geo&returncode=40.7128,-74.006&...
The coordinates are passed as a comma-separated lat,lon pair.
Best Practices
- Trigger autocomplete after 2-3 characters to reduce unnecessary API calls while still providing relevant suggestions.
- Display the
typefield in your UI so users can distinguish between airport and city results (for example, with an airplane icon for airports). - Store the selected coordinates — you will need them for the search request in the next step.
- Allow different pickup and return locations by running two separate autocomplete queries and passing different coordinates for
pickupcodeandreturncode.