Image Response

Image Response

When format is "png" or "jpeg", the response body is the raw image binary. The response is not JSON.

Response headers

HeaderTypeDescription
Content-Typestringimage/png or image/jpeg
X-Location-CountnumberNumber of locations plotted
X-BrandstringBrand name queried
X-RegionstringRegion filter applied
X-Render-TimestringRender duration (e.g. "4231ms")
X-CachedbooleanAlways false for images — renders are not cached (see below)
Cache-Controlstringno-store — image renders are never cached
X-Credits-ChargednumberCredits deducted for this request
X-Credits-RemainingnumberCredits remaining on your key
X-Credits-LowbooleanPresent and true when balance drops below 50

Handling image responses

The response body is binary data, not JSON. Handle it according to your platform:

const res = await fetch("https://api.brandmappr.com/api/v1/location-map", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "bm_live_your_key"
  },
  body: JSON.stringify({
    brand: "Starbucks",
    format: "png",
    country: "US",
    style: "light"
  })
});
 
// Browser: convert to blob URL
const blob = await res.blob();
const url = URL.createObjectURL(blob);
 
// Node.js: write to file
const buffer = Buffer.from(await res.arrayBuffer());
fs.writeFileSync("map.png", buffer);
💡

Image renders are sent with Cache-Control: no-store and are not cached — every request triggers a fresh render and is charged accordingly (this prevents stale maps when the underlying data updates). Server-side caching applies only to data responses (json/csv/geojson); for image formats the X-Cached header is always false.

Rendering options

See Parameters for the full list. Key options for image output:

  • width / height — up to 4096×4096 pixels
  • style — six themes: light, dark, voyager, pitchbook, slate, warm
  • marker_color — any hex color
  • heatmap — density heatmap instead of individual pins
  • include_legend — brand name and location count overlay
  • focus_country — isolate a single country (see Focus Mode)