Keepa API Docs

The Graph Image API renders the price history of a product as a static chart image in PNG format. The image is generated server-side from the requested data series, time range, size and colors, so it can be displayed anywhere an image can be shown. The Response section below describes what the generated PNG contains.

Note: Graph images are cached for 90 minutes on a per-user basis. Submitting the exact same request within this time frame will not consume any tokens.

Important: Make sure you do not embed the images directly, as this will make your API key publicly accessible and open to misuse. Always put the Graph Image requests behind a proxy to secure your API key.

Note: This API call returns PNG images as a response and does not provide your token status information. Any other API request returns your current token status in its response envelope (see Response Format).

Endpoint#

GET https://api.keepa.com/graphimage?key=<yourAccessKey>&domain=<domainId>&asin=<ASIN>

Parameters#

Required parameters#

ParameterRequiredDescription
keyrequiredYour private API key.
domainrequiredInteger value for the Amazon locale you want to access. See the valid values below.
asinrequiredThe ASIN of the product.

Valid values for domain:

Domain IDLocale
1com
2co.uk
3de
4fr
5co.jp
6ca
8it
9es
10in
11com.mx
12com.br

Selecting series#

Keepa offers three graph types. Each one has its own axes and value space, so a single image can only ever contain series from one of them:

#GraphShowsSelected with
1Price historyPrice trends and root category Sales Rank.types
2Category Sales Ranks & Monthly SalesSales ranks by category and monthly sales data.subranks, monthlysold
3Offer Counts and RatingsNumber of offers, star rating and rating counts.types

Graphs 1 and 3 are made of csv types and are selected with the types parameter. Graph 2 is not built from csv types — it is drawn from the product’s per-category rank histories and monthly sold — so it has its own parameters.

Important: types and the sales rank parameters are mutually exclusive. A request naming both returns the bad-request image.

Default: a request that selects no series at all draws the Amazon and New price series of graph 1. That defaulting does not apply once types or the sales rank parameters are used — those select the series completely.

types — select by csv type index#

Comma-separated csv type indexes, each optionally followed by : and a six-digit hex color. A leading # is accepted (URL-encode it as %23) but is not required. Omitting the color uses the type’s default.

&types=16,17,11
&types=11:8888dd,12:444444,34:ff5722

All requested types must belong to the same graph. Every drawable type, by index:

Graphcsv types
1 — Price history
  • 0 AMAZON
  • 1 NEW
  • 2 USED
  • 3 SALES
  • 4 LISTPRICE
  • 5 COLLECTIBLE
  • 6 REFURBISHED
  • 7 NEW_FBM_SHIPPING
  • 8 LIGHTNING_DEAL
  • 9 WAREHOUSE
  • 10 NEW_FBA
  • 15 EXTRA_INFO_UPDATES
  • 18 BUY_BOX_SHIPPING
  • 19 USED_NEW_SHIPPING
  • 20 USED_VERY_GOOD_SHIPPING
  • 21 USED_GOOD_SHIPPING
  • 22 USED_ACCEPTABLE_SHIPPING
  • 23 COLLECTIBLE_NEW_SHIPPING
  • 24 COLLECTIBLE_VERY_GOOD_SHIPPING
  • 25 COLLECTIBLE_GOOD_SHIPPING
  • 26 COLLECTIBLE_ACCEPTABLE_SHIPPING
  • 27 REFURBISHED_SHIPPING
  • 28 EBAY_NEW_SHIPPING
  • 29 EBAY_USED_SHIPPING
  • 30 TRADE_IN
  • 32 BUY_BOX_USED_SHIPPING
  • 33 PRIME_EXCL
3 — Offer Counts and Ratings
  • 11 COUNT_NEW
  • 12 COUNT_USED
  • 13 COUNT_REFURBISHED
  • 14 COUNT_COLLECTIBLE
  • 16 RATING
  • 17 COUNT_REVIEWS
  • 34 COUNT_NEW_FBA
  • 35 COUNT_NEW_FBM

See the csv History Array for what each type contains.

Important: A request naming both graphs — e.g. &types=16,18 — is rejected. So is a malformed index, an unknown type, or a color that is not six hex digits. These are refused rather than silently dropped, because a dropped series is indistinguishable from missing data.

Category Sales Ranks & Monthly Sales#

Drawn from the product’s per-category rank histories and monthly sold — not from csv types, which is why it has its own parameters.

&subranks=0&monthlysold=1
&subranks=1&cRanks=8fbc8f&monthlysold=1&cMonthlysold=f6d500
ParameterRequiredDescriptionValid valuesExample
subranksoptionalThe presence of this parameter requests this graph. 0 draws the reference category only; 1 also draws the product’s other categories.0, 1&subranks=1
cRanksoptionalBase color for the rank series. Additional categories are drawn in progressively darker shades derived from it, so one color covers however many categories a product has. Category selection is not exposed: which categories a product is ranked in is a property of the product.hex color, e.g. 8fbc8f&cRanks=8fbc8f
monthlysoldoptionalDraw the monthly sold series, on its own axis. Can be requested with or without ranks.1&monthlysold=1
cMonthlysoldoptionalColor of the monthly sold series.hex color, default f6d500&cMonthlysold=f6d500

Each category is scaled on its own axis. A product ranked #400 in a sub-category and #180,000 overall would otherwise draw the sub-rank as a flat line; independent scaling is what makes the shapes comparable.

Display parameters#

ParameterRequiredDescriptionValid valuesDefaultExample
rangeoptionalThe range of the chart in days.Suggested values: 1, 2, 7, 31, 90, 36590&range=90
yzoomoptionalEnable Close-up View (y-axis zoom).1 (zoom), 0 (no zoom)1&yzoom=0
widthoptionalWidth of the chart image in pixels. Values below the minimum are raised to it.300 to 1800500&width=500
heightoptionalHeight of the chart image in pixels. Values below the minimum are raised to it.150 to 1800200&height=200
titleoptionalInclude the product title.1 (show), 0 (hide)1&title=0
legendoptionalInclude the chart legend.1 (show), 0 (hide)1&legend=0
lwoptionalWidth of the drawn series lines. Applied proportionally to each series’ own weight, so their relative thicknesses are preserved. Applies to all three graph types. A value outside the valid range is rejected, not clamped.0.5 to 3.01.5&lw=2

Color parameters#

The following parameters allow you to customize the colors of various chart elements. All color parameters are hexadecimal color codes (e.g., ff0000). These parameters are optional.

These apply to every request. Per-series colors are set through the parameter that selects the series: types=<index>:<color> for graphs 1 and 3, or cRanks / cMonthlysold for graph 2.

ParameterRequiredDescriptionExample
cBackgroundoptionalChart background color.&cBackground=ffffff
cFontoptionalFont color.&cFont=444444

Token Cost#

1 token per image.

Because graph images are cached for 90 minutes on a per-user basis, repeating the exact same request (with identical parameters) within that time frame does not consume any tokens.

Response#

The response is a binary PNG image (not JSON). It does not include token-bucket status fields such as tokensLeft; those are returned by any other API request in its response envelope.

The generated PNG contains a chart for the requested product:

  • Which series are drawn is controlled by series selection — types for graph 1 (Price history) and graph 3 (Offer Counts and Ratings), or subranks / monthlysold for graph 2 (Category Sales Ranks & Monthly Sales). A request that selects nothing draws the Amazon and New price series.
  • The chart covers the time range set via range in days (default 90).
  • The product title and the legend are included unless disabled with title=0 and legend=0, and the Close-up View y-axis zoom is enabled by default (yzoom=1).
  • Background and font color can be customized via cBackground and cFont; per-series colors are set through the selecting parameter.
  • Image dimensions follow width (300–1800 px, default 500) and height (150–1800 px, default 200), and the series line width follows lw (0.5–3.0, default 1.5).

Try it#

Build a request from every supported parameter, see the URL update as you go, and render the chart against the live API. Your stored API key is used for the request and is never shown in the URL below.

Examples#

Basic request#

Draws the default series (Amazon and New prices) for the last 90 days as a 500×200 px PNG:

https://api.keepa.com/graphimage?key=YOUR_API_KEY&domain=1&asin=B0F3GWXLTS

Customized request#

Selects the Amazon, New, Sales Rank and Buy Box series of graph 1 with types, widens the range to one year, enlarges the image, and overrides the Amazon series and background colors:

https://api.keepa.com/graphimage?key=YOUR_API_KEY&domain=1&asin=B0F3GWXLTS&types=0:FFA500,1,3,18&range=365&width=800&height=300&cBackground=ffffff
// The official SDKs have no dedicated /graphimage helper —
// request the PNG directly:
String url = "https://api.keepa.com/graphimage?key=YOUR_API_KEY"
        + "&domain=1&asin=B0F3GWXLTS&types=0:FFA500,1,3,18&range=365"
        + "&width=800&height=300&cBackground=ffffff";
try (InputStream in = new URL(url).openStream()) {
    Files.copy(in, Paths.get("graph.png"), StandardCopyOption.REPLACE_EXISTING);
}
<?php
// The official SDKs have no dedicated /graphimage helper —
// request the PNG directly:
$url = "https://api.keepa.com/graphimage?key=YOUR_API_KEY"
     . "&domain=1&asin=B0F3GWXLTS&types=0:FFA500,1,3,18&range=365"
     . "&width=800&height=300&cBackground=ffffff";
file_put_contents("graph.png", file_get_contents($url));
import requests

params = {
    "key": "YOUR_API_KEY",
    "domain": 1,
    "asin": "B0F3GWXLTS",
    "types": "0:FFA500,1,3,18",
    "range": 365,
    "width": 800,
    "height": 300,
    "cBackground": "ffffff",
}
r = requests.get("https://api.keepa.com/graphimage", params=params)
r.raise_for_status()

with open("graph.png", "wb") as f:
    f.write(r.content)  # binary PNG data
import { writeFile } from "node:fs/promises";

const url = "https://api.keepa.com/graphimage?key=YOUR_API_KEY&domain=1&asin=B0F3GWXLTS&types=0:FFA500,1,3,18&range=365&width=800&height=300&cBackground=ffffff";
const res = await fetch(url);
await writeFile("graph.png", Buffer.from(await res.arrayBuffer()));
# Save the generated chart to graph.png
curl -s "https://api.keepa.com/graphimage?key=YOUR_API_KEY&domain=1&asin=B0F3GWXLTS&types=0:FFA500,1,3,18&range=365&width=800&height=300&cBackground=ffffff" -o graph.png
<!--
  Serve the image through YOUR OWN proxy endpoint.
  Never reference api.keepa.com directly in public HTML:
  that would expose your API key to anyone viewing the page source.
-->
<img src="/keepa-proxy/graph?asin=B0F3GWXLTS&range=365"
     width="800" height="300"
     alt="Keepa price history graph">

Tip: A minimal proxy only needs to forward the whitelisted graph parameters (e.g. asin, range) to api.keepa.com/graphimage, append your secret key server-side, and stream the PNG back. Combined with Keepa's 90-minute per-user cache, repeated views of the same chart cost no additional tokens.