Integration · Setup
REST API Color conversion and contrast checks from your own code
The API answers JSON over HTTPS with the same color engine as the site. It needs a key from a Specialist plan. This guide makes a first request and turns a failing pair into a passing one; the reference documents every endpoint.
- Version
- v1
- Needs
- A Specialist plan
- Cost
- 1,000,000 credits a month on Specialist
- Checked
Before you start
What you need
- A Specialist plan. Apprentice and Artisan plans have no API access.
- curl, Node.js 18 or later, or Python 3 to run the examples.
- A safe place for the key, such as an environment variable or your platform’s secret store.
Setup
Step by step
-
Create a key
In the dashboard, open API Keys and create one. The full key is shown once, so copy it then. An account can hold up to ten active keys and revoke any of them.
-
Keep it out of your code
Put the key in an environment variable. The examples on this page read it from there.
# macOS and Linux export AURIC_API_KEY="aa_your_key" # Windows PowerShell $env:AURIC_API_KEY = "aa_your_key" -
Make a first request
Send the key in the
x-api-keyheader. This converts the color to OKLCH.curl -X POST https://api.auricartisan.com/v1/color/convert \ -H "x-api-key: $AURIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"color":"#3959DA","to":"oklch"}'{ "input": { "rgb": [57, 89, 218], "hex": "#3959da" }, "to": "oklch", "value": [0.5200949117697137, 0.20040190508504732, 267.94419335549696] }You should see: The JSON below, and an
x-credits-costheader saying the call cost 1 credit. Without a key, the API answers 401 withUNAUTHENTICATED.
A first task
Check a pair, then get one that passes
Two calls: the first measures gray text on white against WCAG 2.2, the second asks for the nearest text color that reaches 4.5:1. The responses are the API’s own, from running these requests.
1. Check the pair
curl -X POST https://api.auricartisan.com/v1/accessibility/check \
-H "x-api-key: $AURIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fg":"#8A8A8A","bg":"#FFFFFF","standard":"WCAG 2.2"}'
const res = await fetch("https://api.auricartisan.com/v1/accessibility/check", {
method: "POST",
headers: { "x-api-key": process.env.AURIC_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ fg: "#8A8A8A", bg: "#FFFFFF", standard: "WCAG 2.2" }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(JSON.stringify(await res.json()));
import json, os, urllib.request
req = urllib.request.Request(
"https://api.auricartisan.com/v1/accessibility/check",
data=json.dumps({"fg": "#8A8A8A", "bg": "#FFFFFF", "standard": "WCAG 2.2"}).encode(),
headers={"x-api-key": os.environ["AURIC_API_KEY"], "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req) as res:
print(json.dumps(json.load(res)))
{
"fg": [138, 138, 138],
"bg": [255, 255, 255],
"standard": "WCAG 2.2",
"result": {
"standard": "WCAG 2.2",
"contrast_ratio": 3.45,
"1.4.3_AA_normal": false,
"1.4.3_AA_large": true,
"1.4.6_AAA_normal": false,
"1.4.6_AAA_large": false,
"1.4.11_non_text": true,
"pass_level": "AA-large",
"2.4.11_focus_not_obscured": null,
"2.4.13_focus_appearance_AAA": true,
"2.5.8_target_size_outline": null,
"2.5.7_dragging_affordance": null
}
}
The ratio is 3.45:1, so the pair passes AA only for large text: pass_level is AA-large.
2. Ask for a passing color
curl -X POST https://api.auricartisan.com/v1/accessibility/recommend \
-H "x-api-key: $AURIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"fg":"#8A8A8A","bg":"#FFFFFF","minRatio":4.5}'
const res = await fetch("https://api.auricartisan.com/v1/accessibility/recommend", {
method: "POST",
headers: { "x-api-key": process.env.AURIC_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ fg: "#8A8A8A", bg: "#FFFFFF", minRatio: 4.5 }),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(JSON.stringify(await res.json()));
import json, os, urllib.request
req = urllib.request.Request(
"https://api.auricartisan.com/v1/accessibility/recommend",
data=json.dumps({"fg": "#8A8A8A", "bg": "#FFFFFF", "minRatio": 4.5}).encode(),
headers={"x-api-key": os.environ["AURIC_API_KEY"], "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req) as res:
print(json.dumps(json.load(res)))
{
"target": "foreground",
"minRatio": 4.5,
"recommended": [118, 118, 118]
}
The recommended text color is [118, 118, 118], which is #767676: the same hue, darker, at 4.54:1.
Limits
What it does not do
Specialist allows 300 requests a minute and 1,000,000 credits a month, pooled across all of an account’s keys. Past the limit the API answers 429 with a
retry-afterheader.Production serves 89 endpoints.
GET /v1lists them, and the reference marks what each one costs.The client packages named in the reference (
@auric-artisan/api,@auric-artisan/cli,auric-artisan) are not published yet. Call the API over HTTP, as here.
Privacy and access
Keeping a key safe
- Call the API from a server or a script, never from code that runs in a visitor’s browser, where the key can be read.
- Keys are stored only as a SHA-256 hash, so a lost key cannot be recovered: create a new one.
- If a key leaks, revoke it in the dashboard; revocation takes effect within a minute.
Go further
The full reference
- The API reference
- Errors, limits and tooling in the reference
- Plans and API access
- API keys in the dashboard
- The same answers in the browser: the contrast checker
- WCAG 2 and APCA, explained
Other integrations
- Browser extensionCheck and fix contrast on the page in front of you.
- VS CodeUnderline low contrast in your stylesheets and fix it in place.
- Design tokensExport one token system to Tailwind, CSS or Figma.
- Contrast embedPut a contrast checker on your own page.
- Tailwind themeStart a Tailwind v4 project with accessible components.
- React tokensTheme a React app from the token export.
- Figma variablesTurn Figma variables into CSS tokens.
- Contrast in CICheck your color pairs on every pull request.
Checked against
Where these facts come from
Versions, requirements and examples on this page were checked on . The endpoint list, plans and the answer to a request without a key were read from https://api.auricartisan.com; the responses shown come from the API’s own server running these exact requests; the client packages were looked up on npm and PyPI.
- Auric Artisan API: endpoint listapi.auricartisan.com
- Auric Artisan API: OpenAPI descriptionapi.auricartisan.com
- Auric Artisan API: plans and limitsapi.auricartisan.com
- Understanding WCAG 2.2: Contrast (Minimum)www.w3.org
Found a mistake? Write to us and we will correct it.