# Cached Image API

Canonical URL: https://developers.marketcheck.com/apis/cached-image

Updated: Nov 16, 2026

This is the Markdown version of https://developers.marketcheck.com/apis/cached-image. Every page of this site has one at its own address with .md added (the home page's is https://developers.marketcheck.com/index.md). The prices are at https://developers.marketcheck.com/pricing.md.

> One GET returns a used car's listing photo as a JPEG, by listing id and image id. Recorded requests, responses and screens.

Cached Image returns a used car's listing photo as a JPEG from MarketCheck's servers, for when the photo on the dealer's website is no longer reachable. Its addresses come in the cached photo links of search and listing responses.

- Endpoint: `GET https://api.marketcheck.com/v2/image/cache/car/{listing_id}/{image_id}`, with `api_key` as a query parameter
- Regions: United States, United Kingdom
- UK endpoint: `GET https://api.marketcheck.com/v2/image/cache/car/{listing_id}/{image_id}` (Cached Image in the UK docs: https://docs.marketcheck.com/uk/docs/api/cars/vehicle-listing/cached-image)
- Docs: https://docs.marketcheck.com/docs/api/cars/vehicle-listing/cached-image
- This page: https://developers.marketcheck.com/apis/cached-image

## Good to know
- The response is the JPEG itself, not JSON: read the status and the `Content-Type`, `Content-Length` and `Cache-Control` headers.
- Private caching only: a photo may be cached on individual machines for up to four hours, never on public CDNs or shared publicly.
- Photo URLs in search and listing responses carry your `api_key` unless the request sends `append_api_key=false`.
- For production, turn the key off with `append_api_key=false`; a URL without the key then needs `api_key` added when you fetch it.
- Cached photos exist for used cars only.

## Use cases

### A photo slot that falls back to the cached copy
A listing page fills its photo slot from a cached URL when the dealer's photo no longer loads. The call answers with the JPEG, and its Cache-Control header marks it private: the browser may keep it, a shared cache may not.

Request: One cached photo of listing 4T3RWRFV3NU052190-5c80babf-b147, by its image id.
```bash
curl "https://api.marketcheck.com/v2/image/cache/car/4T3RWRFV3NU052190-5c80babf-b147/689428a15bac4557f0339cd476d986e9?api_key=YOUR_API_KEY"
```

Response (recorded Nov 14, 2026). The endpoint answers with the JPEG itself. Shown here are the HTTP status and the response headers that describe the image (its type, size and caching), not the image.
```json
{
  "status": 200,
  "headers": {
    "content-type": "image/jpeg",
    "content-length": "29073",
    "cache-control": "private, max-age=14400"
  }
}
```

### Photo URLs that carry no key
A pipeline or an assistant that passes photo URLs along should not pass your key with them. Fetch the listing with append_api_key=false and media.photo_links_cached holds cached image URLs with no key; add api_key only when a photo is fetched.

Request: Full details for listing 4T3RWRFV3NU052190-5c80babf-b147, with append_api_key=false so that its photo URLs carry no key.
```bash
curl "https://api.marketcheck.com/v2/listing/car/4T3RWRFV3NU052190-5c80babf-b147?api_key=YOUR_API_KEY&append_api_key=false"
```

Response (recorded Nov 14, 2026). Showing the listing's heading and build, and the first 3 of 8 cached photo URLs it returned (only those were recorded); the rest of the listing is left out.
```json
{
  "id": "4T3RWRFV3NU052190-5c80babf-b147",
  "heading": "2022 Toyota RAV4 Hybrid XLE SUV",
  "build": {
    "year": 2022,
    "make": "Toyota",
    "model": "RAV4",
    "trim": "XLE",
    "body_type": "SUV"
  },
  "media": {
    "photo_links_cached": []
  }
}
```

## Key parameters
- `listing_id` (string, required): Unique identifier for the vehicle listing
- `image_id` (string, required): Specific identifier for the cached image
- `api_key` (string, required): Your MarketCheck API authentication key. Required for every request, unless OAuth is used.
- `append_api_key` (boolean): If `true`, the response URLs (such as cached images & relevant links) include the `api_key` query parameter along with value; if `false`, they do not. Default: `true`.

## Questions

### What does the MarketCheck Cached Image API return?
The MarketCheck Cached Image API returns one listing photo as a JPEG file, not JSON. A GET to /v2/image/cache/car/{listing_id}/{image_id} with your key answers with the image and its headers: Content-Type, the size in Content-Length and Cache-Control. Cached photos exist for used cars, for when the dealer's own photo is no longer reachable.

### Where do the listing_id and image_id of a cached photo come from?
A cached photo's listing_id and image_id come from the cached photo URLs in media.photo_links_cached, which MarketCheck's Inventory Search and Car Listing Details return for each listing. Each URL is a complete Cached Image request, with the listing_id and the image_id in its path. A data feed from MarketCheck that includes cached image URLs works the same way.

### Should MarketCheck photo URLs carry my API key?
Not in production. By default, the photo URLs in MarketCheck's search and listing responses carry your key as api_key, so anyone who sees a URL sees the key. The docs say to send append_api_key=false for production use. The URLs then carry no key, and your app adds api_key to the request when it fetches a photo.

### Why does a cached photo URL answer with an error?
A MarketCheck cached photo URL needs your key. One returned with append_api_key=false carries none, so add api_key=YOUR_API_KEY to the request. The Cached Image docs list a 401 for a missing or invalid key and a 422 for an invalid listing_id or image_id, and cached photos exist only for used cars.

## Related APIs
- Car Listing Details: https://developers.marketcheck.com/apis/listing-details
- Inventory Search: https://developers.marketcheck.com/apis/inventory-search

Replace YOUR_API_KEY with your key from https://developers.marketcheck.com/api-keys, and call the API from your server so the key stays private.
