API Usage

Calling the API

You can extend the carquery javascript object by writing your own API calls. Here’s how:

//NOTE: Inside the carquery object, this.base_url will contain the location of the current version of the CarQuery API

$.getJSON(this.base_url+"?callback=?", {cmd:"getMakes", year:"2009"}, function(data) {

   //The 'data' variable contains all response data.
   var makes = data.Makes;
   for (var i = 0; i < makes.length; i++)
       //You can now do what you like with the response data

$.getJSON is a jQuery method with asynchronously retrieves data from a remote API. When the API response is received, the code inside the provided function is executed.
Please see the jQuery.getJSON() documentation for more information.

In this example the following parameters are passed to the CarQuery api:

cmd: specifies the API function. For information on the available functions see the API Functions section below.

year: specifies the year filter. The API will return all makes which produced a model in this year.

API Functions

Here are examples of how to use the function names.


Function: Retrieve range of available years from the CarQuery database.

Usage: http://www.carqueryapi.com/api/0.3/?callback=?&cmd=getYears


Years: {

Notes: The range of available years is determined by the available model data.


Function: Retrieve all makes which produced a model in the specified year




Notes: “sold_in_us” parameter is optional. Setting it to “1” will restrict results to models sold in the USA.


Function: Retrieve all model names produced by the specified manufacturer in the specified year.




“year” parameter is optional. Omitting it will retrieve all model names ever produced by the manufacturer.
“sold_in_us” parameter is optional. Setting it to “1” will restrict results to models sold in the USA.

“body” parameter is optional. Including it will restrict results to models of the specified body type (SUV, Sedan, etc)


Function: Retrieve trim data for models meeting specified criteria.


All parameters to getTrims are optional. You may include any of the following:

body=[Coupe, Sedan, SUV, Pickup, Crossover, Minivan, etc.]

doors=[number of doors]

drive=[Front, Rear, AWD, 4WD, etc]

engine_position=[Front, Middle, Rear]

engine_type=[V, in-line, etc]

fuel_type=[Gasoline, Diesel, etc]

full_results=[1 by default. Set to 0 to include only basic year / make /model / trim data (improves load times)]

keyword=[Keyword search. Searches year, make, model, and trim values]

make=[Make ID]

min_cylinders=[Minimum Number of cylinders]

min_lkm_hwy=[Maximum fuel efficiency (highway, l/100km)]

min_power=[Minimum engine power (PS)]

min_top_speed=[Minimum Top Speed (km/h)]

min_torque=[Minimum Torque (nm)]

min_weight=[Minimum Weight (kg)]

min_year=[Earliest Model Year]

max_cylinders=[Maximum Number of cylinders]

max_lkm_hwy=[Minimum fuel efficiency (highway, l/100km)]

max_power=[Minimum engine power (HP)]

max_top_speed=[Maximum Top Speed (km/h)]

max_torque=[Maximum Torque (nm)]

max_weight=[Maximum Weight (kg)]

max_year=[Latest Model Year]

model=[Model Name]

seats=[Number of Seats]

sold_in_us=[1(sold in US), 0(not sold in US)]

year=[Model Year]


Trims: [
  ,...(all available model fields are included)
  ,...(all available model fields are included)

Notes: All parameters to getTrims are optional. Results are sorted by year, make, model, and trim. Results are limited to 500 records.


Function: Retrieve all available data on the specified model.

Usage: http://www.carqueryapi.com/api/0.3/?callback=?&cmd=getModel&model=11459


   "model_name":"Viper SRT10",
   "model_engine_fuel":"Gasoline - unleaded 95",
   "ExtColors":[],  //Note, Color options are only available for select vehicles.