← Blog · API

The Tintly API: generate palettes and check contrast from your own code

The same engine that powers Tintly's color tools is available over HTTPS. You send JSON, you get JSON back, and every answer comes from one of 13 tools: generate a palette, measure contrast, describe a color, preview color blindness, build a Tailwind scale and more. It is free, read-only and limited to 60 requests a minute per key.

  1. 1
    Create a key

    On the developer page, sign in and create a key. Keys start with tnt_live_ and are shown once.

  2. 2
    Send the key as a Bearer token

    Put it in the Authorization header on every request. An X-API-Key header also works.

  3. 3
    Call a tool

    POST to /api/v1/tools/<name> with the tool's inputs as a JSON body. The answer arrives under result.

Your first request

curlbash
curl -X POST https://www.trycolorkit.com/api/v1/tools/check_contrast \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"foreground":"#8A8A8A","background":"#FFFFFF"}'

The response gives the ratio, the strongest WCAG level reached, a pass or fail for AA and AAA at normal and large sizes, and, when the pair fails, the closest foreground color of the same hue that does pass. A mid-gray on white comes back at about 3.45:1: fine for large headings, not for body text, with a slightly darker gray suggested.

The same call from JavaScript

JavaScriptjs
const res = await fetch("https://www.trycolorkit.com/api/v1/tools/generate_palette", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TINTLY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ base_color: "#2463eb", harmony: "triadic" }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const { result } = await res.json();
console.log(result.colors, result.css);

What the 13 tools do

Make

generate_palette builds a palette, optionally around a base color and a harmony. get_premium_palette and get_generated_palette return a palette by number. search_palettes finds palettes from plain words.

Explain

describe_color and describe_palette return written guides: psychology, meaning, signs and symbols, uses and accessibility notes.

Check

check_contrast, find_accessible_pairs and simulate_color_blindness measure instead of guess.

Build

tailwind_scale, shades_and_tints and convert_color produce the values you paste into code.

GET /api/v1/tools lists every tool with its description and JSON Schema, so you can generate a client or validate inputs before you send them.

Errors and limits

StatusCodeWhat to do
400INVALID_ARGUMENTSRead the message: it names the input that is missing or wrong
401MISSING_KEY or INVALID_KEYSend a valid key in the Authorization header
404NOT_FOUNDCheck the tool name against GET /api/v1/tools
429RATE_LIMITEDWait Retry-After seconds. Every response also carries X-RateLimit-Remaining
503AUTH_UNAVAILABLEThe key service was unreachable. Retry in a moment

Designing around the limit

Sixty requests a minute is plenty for a build step, a design-system script or an internal tool, and it is deliberately modest for a public website. If you find yourself calling the API on every page view, move the call into your build, or cache the answer on your server. Calls that return the same result for the same input are the easiest to cache, and they are most of what the API does. When you do hit the limit, the Retry-After header tells you exactly how long to wait, and the X-RateLimit-Remaining header on every response lets you slow down before you get there.

A small example: tokens from a brand color

A short script can turn one brand color into a full set of design tokens: call tailwind_scale for the 50 to 950 steps, then find_accessible_pairs on the steps you plan to use for backgrounds and text, and write only the pairs that reach AA. Because the tool measures contrast, the script can fail your build when a token pair regresses, which is a far better time to find out than after launch.

  1. Call tailwind_scale with your brand color and a scale name.
  2. Pick the steps for background, surface, text and accent.
  3. Call find_accessible_pairs with those colors at level AA.
  4. Write the CSS variables, and exit with an error if a required pair is missing.

Prefer to talk to the tools in chat instead of code? The same 13 tools are available to AI assistants through the MCP server, with the same key.