Cached Image

Retrieve MarketCheck's cached version of car images from vehicle detail pages

MarketCheck caches few images from vehicle detail pages to make them available for later use when the original source may not be accessible. This endpoint allows you to retrieve these cached images using the listing ID and image ID.

Overview

  • Cached images are only available for used cars
  • The links to these images are provided in the Search API and Listing API responses
    • api_key is included in the response URLs by default, but for production use, you should remove it from the URL using append_api_key=false query parameter
    • If the URL does not contain an api_key, you need to add it to the request to access the image
  • A private caching policy is applied to these images, allowing them to be cached on individual machines for up to 4 hours
  • Public caching is not allowed, meaning these images should not be stored on public CDNs or shared publicly
If you have a data feed from MarketCheck, that includes cachced image URLs, you can use this API to retrieve the cached images directly using the listing_id and image_id

Base Path

GET https://api.marketcheck.com/v2/image/cache/car/{listing_id}/{image_id}

Path Parameters:

  • listing_id: Unique identifier for the vehicle listing
  • image_id: Specific identifier for the cached image

Often these URLs are provided in the response of the Inventory Search API or the Car Listing API

The following example demonstrates how to use the Cached Image API to retrieve a cached image using the listing ID and image ID.

request.js
import axios from 'axios';

const options = {
method: 'GET',
url: 'https://api.marketcheck.com/v2/image/cache/car/5TFUW5F16KX782196-44367fcc-c2fb/e93cff16913e9d2a75f3197d3ba15c7d',
params: {api_key: 'YOUR_API_KEY'},
headers: {Accept: 'image/jpeg, application/json'}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

Request

To retrieve a cached image, you need to make a GET request to the Cached Image API endpoint with the required parameters.

Parameters

1 Params
api_key
string required

Your MarketCheck API authentication key. Required for every request, unless OAuth is used.

Required Parameters

  • listing_id: The unique identifier for the car listing you want to retrieve the cached image for. This parameter is case-sensitive and must be provided in the URL path.
  • image_id: The specific identifier for the cached image you want to retrieve. This parameter is also case-sensitive and must be provided in the URL path.

Response

Schema

The response schema for the Cached Image API is straightforward, as it returns the JPEG image file directly. The response headers are set to indicate the content type and caching policy.

Success Response

  • 200 OK - Returns the cached image with appropriate content headers.
  • Headers:
    • Content-Type: The MIME type of the image image/jpeg
    • Cache-Control: Public, max-age=14400 (4 hours)
    • Content-Length: Size of the image file in bytes

Error Response

Status CodeDescriptionCommon Causes
400Bad RequestInvalid parameter values
401UnauthorizedMissing/invalid API key
403ForbiddenAccess denied to resource
422Unprocessable EntityInvalid listing_id or image_id
429Too Many RequestsRate limit exceeded
500Internal Server ErrorTemporary server issues
502Bad GatewayIssues with upstream services
503Service UnavailableAPI maintenance or downtime

Use Cases & Examples

Retrieve Cached Image

After performing a search using the Inventory Search API, in response you will receive list of cached image URLs for each listing in media.photo_links_cached field.

You can use those URLs to retrieve the cached images directly.

Example:

request.js
import axios from 'axios';

const options = {
method: 'GET',
url: 'https://api.marketcheck.com/v2/image/cache/car/5TFUW5F16KX782196-44367fcc-c2fb/e93cff16913e9d2a75f3197d3ba15c7d',
params: {api_key: 'YOUR_API_KEY'},
headers: {Accept: 'image/jpeg, application/json'}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

See Also