The Vehicle Market Value API provides access to a library of vehicle market value data.

The Vehicle Market Value API estimates the market value for used and new cars by VIN based on millions of historical vehicle sales stored in CarsXE's sales database.

With the assumption that sale prices are normally distributed, CarsXE's market value model estimates the "below market" and "above market" values within a distribution.

---

<Row>
  <Col>

    This endpoint allows you to retrieve the market value for a specific vehicle based on its VIN.

    ## Required attributes

    <Properties>
      <Property name="key" type="string">
        Your CarsXE API key.
      </Property>
      <Property name="vin" type="string">
        The 17 character long vehicle identification number.
      </Property>
    </Properties>

    ## Optional attributes

    <Properties>
      <Property name="format" type="string">
        The format of the response. One of `json` or `xml`. Defaults to `json`.
      </Property>
    </Properties>

     ---

    ## Response attributes

    <Properties>
      <Property name="vin" type="string">
        The vehicle identification number.
      </Property>
      <Property name="success" type="boolean">
        Whether market value data has been retrieved.
      </Property>
      <Property name="retail" type="string">
        Retail price of the vehicle.
      </Property>
      <Property name="tradeIn" type="string">
        The trade in price of the vehicle.
      </Property>
      <Property name="roughTradeIn" type="string">
        The rough trade in price of the vehicle.
      </Property>
      <Property name="averageTradeIn" type="string">
        The average trade in of the vehicle.
      </Property>
      <Property name="loanValue" type="string">
        Loan value of vehicle.
      </Property>
      <Property name="msrp" type="string">
        Manufacturer suggested retail price of vehicle.
      </Property>
      <Property name="tradeInValues" type="array">
        A list of trade in values recorded for the vehicle.
      </Property>
      <Property name="auctionValues" type="object">
        Map of auction value ranges in a given data range.
      </Property>
    </Properties>


    <FAQ faqs={[{ question: "What VINs can I use for testing?", answer: <>You may be use the following VINs for test:<ul><li><code>JN1EV7AP6JM355294</code></li><li><code>WBAFR7C57CC811956</code></li></ul></>},{question: "Is the Vehicle Market Value API included in the free trial?", answer: <>No, The Vehicle Market Value API is not included in the 7-day free trial. For more information visit our <a href='/pricing'>pricing</a> page.</>}]} hidePadding />

  </Col>
  <Col sticky>

  <CodeGroup title="Request" tag="GET" label="/marketvalue">
    ```bash 
    curl -G https://api.carsxe.com/marketvalue \
    -d key=CARSXE_API_KEY \
    -d vin=WBAFR7C57CC811956
    ```

    ```js
    import { CarsXE } from "carsxe-api";
    const carsxe = new CarsXE("CARSXE_API_KEY");
    const vin = "WBAFR7C57CC811956";
    try {
      const vehicle = await carsxe.marketValue({ vin });
      console.log(vehicle);
    } catch (error) {
      console.error(error);
    }
    ```

    ```python
    import asyncio
    from carsxe_api import CarsXE

    carsxe = CarsXE('CARSXE_API_KEY')
    vin = 'WBAFR7C57CC811956'

    try:
        vehicle = asyncio.run(carsxe.market_value({"vin": vin}))
        print(vehicle)
    except Exception as e:
        print(f"Error: {e}")
    ```

    ```php
    <?php
    require_once __DIR__ . '/vendor/autoload.php';
    use CarsxeDeveloper\Carsxe\Carsxe;

    $API_KEY = 'CARSXE_API_KEY';
    $carsxe = new Carsxe($API_KEY);
    $vin = 'WBAFR7C57CC811956';

    try {
        $vehicle = $carsxe->marketValue(['vin' => $vin]);
        print_r($vehicle);
    } catch (Exception $error) {
        echo "Error: " . $error->getMessage();
    }
    ```

    ```ruby
    require 'carsxe'

    API_KEY = 'CARSXE_API_KEY'
    carsxe = Carsxe::CarsXE.new(api_key: API_KEY)
    vin = 'WBAFR7C57CC811956'

    begin
      vehicle = carsxe.market_value('vin' => vin)
      puts vehicle
    rescue StandardError => error
      puts "Error: #{error.message}"
    end
    ```

    ```go
    package main

    import (
    	"fmt"
    	"github.com/carsxe/carsxe-go-package"
    )

    func main() {
    	client := carsxe.New("CARSXE_API_KEY")
    	vin := "WBAFR7C57CC811956"
    	vehicle := client.MarketValue(map[string]string{"vin": vin})
    	fmt.Println(vehicle)
    }
    ```

    ```java
    import io.github.carsxe.CarsXE;
    import java.util.Map;
    import java.util.HashMap;

    public class Main {
        public static void main(String[] args) {
            CarsXE carsxe = new CarsXE("CARSXE_API_KEY");
            Map<String, String> params = new HashMap<>();
            params.put("vin", "WBAFR7C57CC811956");
            try {
                Map<String, Object> vehicle = carsxe.marketvalue(params);
                System.out.println(vehicle);
            } catch (Exception e) {
                System.err.println("Error: " + e.getMessage());
            }
        }
    }
    ```

    ```swift
    import carsxe

    let carsxe = CarsXE(apiKey: "CARSXE_API_KEY")
    let vin = "WBAFR7C57CC811956"

    do {
        let vehicle = try carsxe.marketValue(["vin": vin])
        print(vehicle)
    } catch {
        print("Error: \(error)")
    }
    ```

    ```csharp
    using carsxe;
    using System;
    using System.Collections.Generic;
    using System.Threading.Tasks;

    class Program
    {
        static async Task Main(string[] args)
        {
            string API_KEY = "CARSXE_API_KEY";
            CarsXE carsxe = new CarsXE(API_KEY);
            string vin = "WBAFR7C57CC811956";
            try
            {
                var vehicle = await carsxe.MarketValue(new Dictionary<string, string> { { "vin", vin } });
                Console.WriteLine(vehicle);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
    }

        url = URI("https://api.carsxe.com/marketvalue?key=CARSXE_API_KEY&vin=WBAFR7C57CC811956")

        https = Net::HTTP.new(url.host, url.port)
        https.use_ssl = true

        request = Net::HTTP::Get.new(url)

        response = https.request(request)
        puts response.read_body
        ```

    </CodeGroup>
    <CodeGroup title="Response">
    ```json showLineNumbers {{ title: 'Response' }}
    {
        "retail": "16075",
        "tradeIn": "13575",
        "roughTradeIn": "10250",
        "averageTradeIn": "12050",
        "loanValue": "12225",
        "uid": 1172227,
        "msrp": "52250",
        "tradeInValues": [
          {
            "date": "2018-08-01T00:00:00.000Z",
            "value": "13575",
          },
          {
            "date": "2018-07-01T00:00:00.000Z",
            "value": "13600",
          },
          {
            "date": "2018-06-01T00:00:00.000Z",
            "value": "14175",
          },
          {
            "date": "2018-05-01T00:00:00.000Z",
            "value": "14175",
          },
          {
            "date": "2018-04-01T00:00:00.000Z",
            "value": "14650",
          },
        ],
        "auctionValues": {
          "lowAuctionValue": 9050,
          "averageAuctionValue": 11925,
          "highAuctionValue": 14825,
          "dateRange": "8/6/2018 - 8/12/2018",
        },
      }
    ```
    </CodeGroup>

  </Col>
</Row>
