API Documentation

The Colour Memory API returns named historical colours with cultural provenance, material integrity, physics, gamut warnings, and accessibility data. Base URL: https://colour-memory-api-production.up.railway.app  Live

Overview

Pass a hex value, a colour name, or a natural language query. Get back a structured response covering eight dimensions of colour intelligence: name, archive, provenance, material integrity, CIE Lab, LRV, gamut warnings, WCAG accessibility, colour blindness simulation, and any cultural or regulatory advisory flags.

The archive spans RAL Classic, BS 4800, Munsell, AS 2700, ISCC-NBS, Shakespeare, Keats, Japan, Netherlands (Dutch Golden Age), Islamic geometric and manuscript tradition, PigmentHistorical (Cennini 1390 through Church 1890), Dark History, Brazil, American Archive, and the Digby Heritage collection. The Resonance Index maps Cross-archive resonance indexed by perceptual distance.

MCP server: If you are using Claude, Cursor, or any MCP-compatible agent, you do not need to call the REST API directly. Add the server at /mcp and all ten tools register automatically. See MCP Server.

Get an API key

The first 100 calls require no authentication. For production use, request a key below and include it as an X-API-Key header on every request.

Request access

Enter your email. We will send a key within one working day.

Quickstart

Match a hex colour to the archive in one call:

cURL
curl "https://colour-memory-api-production.up.railway.app/match?hex=%23D4820A"
Response
{
  "name":         "Mango Cow",
  "hex":          "#D4820A",
  "archive":     "Material Culture",
  "integrity":   "Pigment",
  "lab":         [55.2, 22.8, 54.1],
  "lrv":         18.4,
  "confidence":  0.984,
  "gamut": { "srgb_risk": true, "p3_safe": true, "cmyk_risk": false },
  "wcag": { "on_white": "AA large", "on_black": "AAA" },
  "warning":     "Halal-disqualified. Indian Govt report 1908."
}

Authentication

Pass your API key in the X-API-Key request header. Unauthenticated requests are accepted up to a limit of 100 lifetime calls per IP address.

Header
X-API-Key: cm_live_xxxxxxxxxxxxxxxxxxxx

Endpoints

/match — Colour matching

GET /match Match any colour to the archive

Pass a hex value or natural language query. Returns the nearest archive match with full provenance and intelligence data.

ParameterTypeDescription
hexrequired*stringHex colour value, URL-encoded. E.g. %23D4820A for #D4820A. Either hex or q must be provided.
qrequired*stringNatural language query. E.g. warm terracotta for a kitchen or what colour means mourning in China.
koptionalintegerNumber of matches to return. Default 1. Max 8. k=8 uses hue-diverse extraction.
archiveoptionalstringRestrict search to a specific archive slug. See /archives for slugs.

/colour/{name} — Direct lookup

GET /colour/{name} Fetch a colour by exact name

Retrieve a colour by its exact archive name. URL-encode spaces as %20 or use hyphens.

GET /colour/Godstow%20Ultramarine
GET /colour/mango-cow

/mix — Pigment compatibility

POST /mix Check pigment compatibility against historical trade manuals

Send two or more pigment names and a medium. Returns documented incompatibility warnings sourced directly from historical guild and trade manuals: Cennini (c.1390), Tingry (1830), Field (1835), and Church (1890). If Cennini documented it in 1390, you will receive his exact words.

FieldTypeDescription
pigmentsarrayTwo or more pigment names from the PigmentHistorical archive
mediumstringoil, fresco, tempera, or watercolour
POST /mix
{
  "pigments": ["Verdigris", "White Lead"],
  "medium": "oil"
}

// Response
{
  "compatible": false,
  "warning": {
    "source": "Cennini, c.1390",
    "text": "mortal enemies in everything",
    "medium": "oil",
    "effect": "accelerated darkening"
  }
}

Advisory use only. Results from /mix are sourced from historical trade literature and are provided for artistic, archival, and research reference. They do not constitute engineering, safety-critical, conservation, or professional materials advice. Colour Memory Ltd accepts no liability for decisions made on the basis of API output. Consult a qualified conservator or materials scientist before applying any pigment compatibility assessment in a professional or safety-relevant context.

/specify — Room specification

POST /specify 60-30-10 room colour specification

Provide a dominant colour (60%) and the endpoint returns a complete room specification: secondary (30%) and accent (10%) selections drawn from the archive, with LRV checks and light-source shift warnings.

Body fieldTypeDescription
dominantrequiredstringHex value or colour name for the 60% dominant field.
light_sourceoptionalstring"tungsten", "led_warm", "led_cool", or "daylight". Default: "daylight".
moodoptionalstringNatural language mood descriptor, e.g. "calm", "energetic", "formal".

/archives — Archive list

GET /archives List all archives with colour counts

Returns all archive slugs, full names, and colour counts. Use slugs to filter /match requests.

Digby Heritage
RAL Classic
BS 4800
AS 2700 (Australian)
Munsell
ISCC-NBS
Material Culture
PigmentHistorical Cennini–Church
Dark History
Islamic geometric & manuscript
Shakespeare
Keats
Japan
Netherlands (Dutch Golden Age)
American Archive
Brazil (FUMDHAM)
+ further archives

/palette — Palette extraction

POST /palette Extract k=8 hue-diverse named colours from an image

Send an image URL or base64 data. Returns up to 8 hue-diverse named matches from the archive, using perceptual clustering with CIEDE2000. Each colour includes the full intelligence response.

Body fieldTypeDescription
image_urlrequired*stringPublicly accessible image URL.
image_b64required*stringBase64-encoded image. Either image_url or image_b64 required.
koptionalintegerNumber of colours. Default 8. Max 8.

/health

GET /health API status

Returns {"status": "ok", "colours": n, "archives": n}. No authentication required.

MCP Server

The MCP server at /mcp exposes all ten Colour Memory tools as native MCP tool definitions. Any MCP-compatible orchestration layer — Claude, Cursor, LangChain, or a custom agent — can add the server URL and call every tool without custom integration code.

Setup in Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "colour-memory": {
      "type":    "sse",
      "url":     "https://colour-memory-api-production.up.railway.app/mcp",
      "headers": {
        "X-API-Key": "YOUR_KEY"
      }
    }
  }
}

Restart Claude Desktop. The tools appear in Claude's tool list automatically.

MCP Tools

Tool nameDescription
colour_matchMatch a hex or natural language query to the archive.
archive_searchSearch the archive by name, culture, period, or material.
room_specifyGenerate a 60-30-10 room specification from a dominant colour.
palette_extractExtract named archive colours from an image URL.
wcag_checkCheck WCAG contrast ratio and AA/AAA compliance.
gamut_checksRGB, P3, and CMYK gamut safety check.
cb_simulateSimulate deuteranopia, protanopia, and tritanopia shifts.
illuminant_shiftBradford illuminant shift for tungsten and LED sources.
cultural_advisoryReturn cultural prohibitions, associations, and market flags.
integrity_checkReturn Pigment, Dye, or Lake classification with lightfastness.

Response schema

All /match and /colour responses return this structure:

{
  "name":        string,         // Archive colour name
  "hex":         string,         // Hex value of archive entry
  "archive":    string,         // Source archive name
  "integrity":  "Pigment"|"Dye"|"Lake",
  "lab":        [L, a, b],       // CIE Lab D65
  "lrv":        number,         // Light Reflectance Value 0-100
  "confidence": number,         // Match confidence 0-1
  "gamut": {
    "srgb_risk":  boolean,
    "p3_safe":    boolean,
    "cmyk_risk":  boolean
  },
  "wcag": {
    "on_white":        string,    // "AA"|"AA large"|"AAA"|"fail"
    "on_black":        string,
    "contrast_white":  number,
    "contrast_black":  number
  },
  "cb_sim": {
    "deuteranopia":  string,    // Shifted hex value
    "protanopia":    string,
    "tritanopia":    string
  },
  "illuminant": {
    "tungsten":   string,         // Bradford-shifted hex
    "led_warm":   string,
    "led_cool":   string
  },
  "provenance":  string|null,   // Historical source text
  "warning":     string|null    // Cultural or regulatory flag
}

Error codes

CodeMeaning
400Bad request — missing or invalid parameters.
401Invalid API key.
404Colour name not found in the archive.
429Rate limit exceeded. Free tier: 100 lifetime calls. Studio: 10,000/month.
500Internal server error. The API is live on Railway; check /health for status.

Changelog

DateChange
May 2026v3: Major archive expansion. Islamic archive added. PigmentHistorical merged (Cennini–Church). /mix pigment compatibility endpoint. Resonance Index. /mcp endpoint. UK Trademark UK00004387450 Classes 9, 35, 42 accepted.
Jan 2026v2 live: multiple international archives, MCP server. /specify endpoint. k=8 hue-diverse palette extraction.
Apr 2026v1 launch: REST API on Railway. Digby Heritage archive. Basic /match endpoint.