Developers
Get any saved film’s colour barcode as JSON, SVG or PNG: the colour of every bar, and its key colours. Free, with an API key.
Your API keys
Sign in with GitHub to get a key. Nothing else on Cinechroma needs an account.
Getting started
Send your key in the x-api-key header.
Each gets a film and its barcode, with your key in the CINECHROMA_API_KEY environment variable (in a browser, in the page, where its visitors can read it):
curl -H "x-api-key: $CINECHROMA_API_KEY" https://cinechroma.app/api/v1/films/tt0111161// Node.js 18 or later; save it as film.mjs, for the top-level await.
const response = await fetch('https://cinechroma.app/api/v1/films/tt0111161', {
headers: { 'x-api-key': process.env.CINECHROMA_API_KEY },
});
const film = await response.json();
if (!response.ok) throw new Error(film.error);
console.log(`${film.title} (${film.year}): ${film.barcode.total} bars`);
console.log('Key colours:', film.barcode.keyColours?.sets['5']);<!-- Anyone who views this page can read the key in it: use a key just for this
page, and delete it if it's misused. Where you can, call the API from your server. -->
<p id="film">Loading…</p>
<canvas id="barcode" style="width: 100%; height: 8rem; image-rendering: pixelated"></canvas>
<script>
// In a function, so it runs as a plain script too (as CodePen and JSFiddle load it).
async function showFilm() {
const response = await fetch('https://cinechroma.app/api/v1/films/tt0111161', {
headers: { 'x-api-key': 'YOUR_KEY' },
});
const film = await response.json();
const heading = document.getElementById('film');
if (!response.ok) {
heading.textContent = film.error;
return;
}
heading.textContent = `${film.title} (${film.year}): ${film.barcode.total} bars`;
// One pixel per bar, in film order; CSS stretches it to fill the width.
const colours = film.barcode.colours;
const canvas = document.getElementById('barcode');
canvas.width = colours.length;
canvas.height = 1;
const context = canvas.getContext('2d');
colours.forEach((colour, x) => {
if (!colour) return; // null: no frame could be read here, so it's left empty
context.fillStyle = colour;
context.fillRect(x, 0, 1, 1);
});
}
showFilm();
</script>import json
import os
from urllib.error import HTTPError
from urllib.request import Request, urlopen
request = Request(
"https://cinechroma.app/api/v1/films/tt0111161",
headers={
"x-api-key": os.environ["CINECHROMA_API_KEY"],
# Name your app: urllib's own User-Agent is turned away.
"User-Agent": "my-app/1.0",
},
)
try:
with urlopen(request) as response:
film = json.load(response)
except HTTPError as error:
raise SystemExit(json.load(error)["error"])
print(f"{film['title']} ({film['year']}): {film['barcode']['total']} bars")
if film["barcode"]["keyColours"]:
print("Key colours:", film["barcode"]["keyColours"]["sets"]["5"])<?php
$curl = curl_init('https://cinechroma.app/api/v1/films/tt0111161');
curl_setopt_array($curl, [
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('CINECHROMA_API_KEY')],
CURLOPT_RETURNTRANSFER => true,
]);
$film = json_decode(curl_exec($curl), true);
if (curl_getinfo($curl, CURLINFO_RESPONSE_CODE) !== 200) {
throw new RuntimeException($film['error'] ?? 'The request failed');
}
echo "{$film['title']} ({$film['year']}): {$film['barcode']['total']} bars\n";
echo 'Key colours: ' . implode(', ', $film['barcode']['keyColours']['sets']['5'] ?? []) . "\n";require 'json'
require 'net/http'
uri = URI('https://cinechroma.app/api/v1/films/tt0111161')
request = Net::HTTP::Get.new(uri, 'x-api-key' => ENV.fetch('CINECHROMA_API_KEY'))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
film = JSON.parse(response.body)
raise film['error'] unless response.is_a?(Net::HTTPSuccess)
puts "#{film['title']} (#{film['year']}): #{film['barcode']['total']} bars"
puts "Key colours: #{film.dig('barcode', 'keyColours', 'sets', '5')&.join(', ')}"package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"os"
)
type Film struct {
Title string `json:"title"`
Year int `json:"year"`
Barcode struct {
Total int `json:"total"`
KeyColours *struct {
Sets map[string][]string `json:"sets"`
} `json:"keyColours"`
} `json:"barcode"`
Error string `json:"error"`
}
func main() {
request, err := http.NewRequest("GET", "https://cinechroma.app/api/v1/films/tt0111161", nil)
if err != nil {
log.Fatal(err)
}
request.Header.Set("x-api-key", os.Getenv("CINECHROMA_API_KEY"))
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
var film Film
if err := json.NewDecoder(response.Body).Decode(&film); err != nil {
log.Fatal(err)
}
if response.StatusCode != http.StatusOK {
log.Fatal(film.Error)
}
fmt.Printf("%s (%d): %d bars\n", film.Title, film.Year, film.Barcode.Total)
if film.Barcode.KeyColours != nil {
fmt.Println("Key colours:", film.Barcode.KeyColours.Sets["5"])
}
}Responses are JSON (or an image). Films are identified by their IMDb ID (e.g. tt0111161), or their TMDB ID. Browsers can call the API from any site, but a key in a web page is visible to its visitors: keep keys on your server where you can.
The API gives a film’s colour data, with just enough to identify the film: its IDs, title and year. For its other details (cast, genres, overview, posters), use its tmdbId with TMDB’s own API.
Using the API means agreeing to its terms of use, which ask you to credit Cinechroma. The API is described in OpenAPI 3.1 at https://cinechroma.app/api/v1/openapi.json, for tools such as Postman, Insomnia or Swagger UI, or to generate a client.
Endpoints
GET /api/v1/films
The films with barcodes, a page at a time.
q- Search by title (or original title), ignoring accents and case.
sortrecent(newest barcodes first; the default),title,releasedorcolour.updatedSince- Only films whose barcode was saved after this date or time (ISO 8601, e.g.
2026-11-01): to keep a copy up to date. page,limit- Which page, from 1, and how many films on it: up to 100 (50 by default).
nextis the next page’s address, ornull.
{
"films": [
{
"imdbId": "tt0111161",
"tmdbId": 278,
"title": "The Shawshank Redemption",
"year": 1994,
"updatedAt": "2026-10-03T09:12:44.000Z",
"url": "https://cinechroma.app/film/tt0111161"
}
],
"count": 120,
"page": 1,
"limit": 50,
"next": "https://cinechroma.app/api/v1/films?page=2"
}GET /api/v1/films/:imdbId
A film and its barcode. GET /api/v1/films/tmdb/:tmdbId gives the same, by the film’s TMDB ID. Both take the colour options.
{
"imdbId": "tt0111161",
"tmdbId": 278,
"title": "The Shawshank Redemption",
"year": 1994,
"updatedAt": "2026-10-03T09:12:44.000Z",
"url": "https://cinechroma.app/film/tt0111161",
"barcode": {
"intervalSeconds": 4,
"duration": 8520,
"total": 2130,
"averaging": "linear-rgb",
"colours": ["#1b1a1c", "#2a2724", null, "…"],
"keyColours": {
"source": "pixels",
"sets": { "5": ["#7a5a3c", "…"], "10": ["…"] },
"shares": { "5": [0.31, "…"], "10": ["…"] }
}
}
}barcode.colours- One colour per bar, in film order: the average of
intervalSecondsof film, in linear light.nullwhere no frame could be read. barcode.keyColours- The colours that define the film, rather than averages, in the order they first appear, in sets of 5 up to 256 (a set can have fewer).
sourceispixelswhen they were picked while scanning, orbarswhen picked afterwards from the bars, which is less true to the film.sharesgives each colour’s share of the film (0 to 1), in the same order.
Colour options
The same choices as Get code on a film’s page, as query parameters:
bars- The number of samples: average the barcode down to this many bars, if it has more (in linear light, as each bar is). A full barcode can have thousands. Key colours come in every size at once.
ordertime(film order; the default),hue(round the colour wheel from red, greys last),saturation(most colourful first),brightness(brightest first) orfrequency(the colours covering most of the film first). In any order buttime, bars with no colour are left out. It applies to the key colours too, with theirshares.formathex(the default),rgb,hsl,hwb,lab,lch,oklab,oklch,display-p3(color(display-p3 …)) orhsb: e.g.oklch(0.4936 0.0608 63.81).coloursbarcodefor only the barcode’s colours (leaving outkeyColours), orkeyfor only the key colours (leaving outcolours). Both by default.
GET /api/v1/films/batch?ids=tt0111161,tt0068646
Up to 100 films and their barcodes at once, counted as one request: { "films": [ … ], "missing": [ … ] }, with the films in the order asked for, and the IDs that have no barcode in missing. Takes the colour options too.
GET /api/v1/films/:imdbId/barcode.svg and barcode.png
The barcode as an image, to save and show on your own site. The SVG stretches to any size; the PNG is a pixel across per bar (up to 4,000, averaged down if there are more) and height pixels tall (100 by default, up to 1,000). Both take bars and order. To show a barcode without a key, embed it from its film page instead.
Saving requests
Barcodes rarely change once saved. Every response has an ETag: keep it with your copy, and send it back in If-None-Match next time. If nothing has changed, the answer is 304 Not Modified, with no body, and isn’t counted against your limit.
To keep a copy of every barcode up to date, list the films with updatedSince set to when you last looked, then fetch the ones that have changed with batch, 100 at a time.
Limits
Each key can make 1,000 requests a day, counted from midnight UTC, and you can have up to 3 keys. If you need more, sign in and ask: we can raise a key’s limit. Every response says where you are, in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix time), and in the standard RateLimit and RateLimit-Policy headers.
Keys used in ways that harm the service, such as scraping around the limits, may be disabled without notice.
Errors
Errors are JSON too, with a message to show and a code to check: { "error": "…", "code": "film_not_found" }. A 403 that isn’t JSON is from Cloudflare, which turns away some libraries’ own User-Agent (such as Python’s urllib): send one naming your app.
| Status | code | Meaning |
|---|---|---|
| 400 | invalid_request | Something in the request isn’t right: the message says what. |
| 401 | missing_key | No key in the x-api-key header. |
| 401 | invalid_key | The key isn’t a valid one (or has been deleted). |
| 403 | key_disabled | The key has been disabled. |
| 403 | account_banned | The key’s account is banned from the API. |
| 404 | film_not_found | No barcode for that film. |
| 429 | rate_limited | The key has made its requests for today. Retry-After says how many seconds until it can make more. |
| 500 | server_error | Something went wrong on our side. |
Changelog
Changes only add to what responses have: nothing is renamed or taken away within version 1.
- 1.0.0,
- First release: films and their barcodes by IMDb or TMDB ID, a page at a time or up to 100 at once, and barcodes as SVG or PNG.
- Colours averaged down to any number of samples, in film order or by hue, saturation, brightness or frequency, in hex or any CSS colour format, with each key colour’s share of the film.