WCAG Contrast Checker API
GET /api/a11y/contrast $0.001 per call
USDC on Base · x402
WCAG contrast ratio between two colors — the check the URL-based a11y endpoint can't do. Give a foreground and background color (hex or rgb()); returns the exact ratio and AA/AAA pass/fail for normal text, large text, and UI components, with a plain-English verdict. ?fg=&bg=
Parameters
| Name | In | Description | |
|---|---|---|---|
fg | query | required | Foreground/text color — hex (#111 or #111111) or rgb() |
bg | query | required | Background color — hex or rgb() |
Example request
curl "https://api.webbersites.com/api/a11y/contrast?fg=%23767676&bg=%23ffffff"
# first call returns 402 + payment requirements; an x402 client pays and retries automaticallyExample response
{
"foreground": "#767676",
"background": "#ffffff",
"contrast_ratio": 4.54,
"ratio_string": "4.54:1",
"passes": {
"normal_text": {
"AA": true,
"AAA": false
},
"large_text": {
"AA": true,
"AAA": true
}
},
"summary": "Good — passes AA for normal text and AAA for large text."
}MCP tool: get_a11y_contrast — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.
How payment works
There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.