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 "https://colour-memory-api-production.up.railway.app/match?hex=%23D4820A"
{ "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.
X-API-Key: cm_live_xxxxxxxxxxxxxxxxxxxx
Endpoints
/match — Colour matching
Pass a hex value or natural language query. Returns the nearest archive match with full provenance and intelligence data.
| Parameter | Type | Description |
|---|---|---|
| hexrequired* | string | Hex colour value, URL-encoded. E.g. %23D4820A for #D4820A. Either hex or q must be provided. |
| qrequired* | string | Natural language query. E.g. warm terracotta for a kitchen or what colour means mourning in China. |
| koptional | integer | Number of matches to return. Default 1. Max 8. k=8 uses hue-diverse extraction. |
| archiveoptional | string | Restrict search to a specific archive slug. See /archives for slugs. |
/colour/{name} — Direct lookup
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
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.
| Field | Type | Description |
|---|---|---|
| pigments | array | Two or more pigment names from the PigmentHistorical archive |
| medium | string | oil, 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
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 field | Type | Description |
|---|---|---|
| dominantrequired | string | Hex value or colour name for the 60% dominant field. |
| light_sourceoptional | string | "tungsten", "led_warm", "led_cool", or "daylight". Default: "daylight". |
| moodoptional | string | Natural language mood descriptor, e.g. "calm", "energetic", "formal". |
/archives — Archive list
Returns all archive slugs, full names, and colour counts. Use slugs to filter /match requests.
/palette — Palette extraction
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 field | Type | Description |
|---|---|---|
| image_urlrequired* | string | Publicly accessible image URL. |
| image_b64required* | string | Base64-encoded image. Either image_url or image_b64 required. |
| koptional | integer | Number of colours. Default 8. Max 8. |
/health
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
{ "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 name | Description |
|---|---|
| colour_match | Match a hex or natural language query to the archive. |
| archive_search | Search the archive by name, culture, period, or material. |
| room_specify | Generate a 60-30-10 room specification from a dominant colour. |
| palette_extract | Extract named archive colours from an image URL. |
| wcag_check | Check WCAG contrast ratio and AA/AAA compliance. |
| gamut_check | sRGB, P3, and CMYK gamut safety check. |
| cb_simulate | Simulate deuteranopia, protanopia, and tritanopia shifts. |
| illuminant_shift | Bradford illuminant shift for tungsten and LED sources. |
| cultural_advisory | Return cultural prohibitions, associations, and market flags. |
| integrity_check | Return 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
| Code | Meaning |
|---|---|
| 400 | Bad request — missing or invalid parameters. |
| 401 | Invalid API key. |
| 404 | Colour name not found in the archive. |
| 429 | Rate limit exceeded. Free tier: 100 lifetime calls. Studio: 10,000/month. |
| 500 | Internal server error. The API is live on Railway; check /health for status. |
Changelog
| Date | Change |
|---|---|
| May 2026 | v3: 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 2026 | v2 live: multiple international archives, MCP server. /specify endpoint. k=8 hue-diverse palette extraction. |
| Apr 2026 | v1 launch: REST API on Railway. Digby Heritage archive. Basic /match endpoint. |