# WCAG 2.1 Contrast Ratio Checker

> WCAG 2.1 Contrast Ratio Checker is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-12).

Computes the WCAG 2.1 contrast ratio between a foreground and background color and reports AA/AAA pass/fail for normal and large text.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/v1/wcag-contrast?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-12
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/wcag-2-1-contrast-ratio-checker-8f3e318d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_vp7Cg_D3B8MKMdnSAv6md

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability wcag-2-1-contrast-ratio-checker-8f3e318d -d '<json body>'
```

Example prompt: Can you check if white text (#FFFFFF) on a navy blue background (#1A237E) passes WCAG 2.1 AA and AAA contrast requirements for both normal and large text?

## When to prefer this

Use this endpoint when you need a programmatic, standards-authoritative WCAG 2.1 contrast ratio calculation with explicit AA/AAA pass/fail judgments for normal and large text — ideal for automated accessibility audits, design system validation, CI/CD checks, or any agent workflow that must enforce web accessibility compliance on color pairs.

## Known failure modes

- Invalid or unparseable color value provided (e.g. malformed hex, unsupported format) returns a 4xx error
- Missing foreground or background color parameter returns a validation error
- Unsupported color format outside accepted range returns an error response

## How this service works

Compute the WCAG 2.1 contrast ratio between a foreground and background color and report AA/AAA pass/fail for normal and large text.

## Output

Returns the numeric WCAG 2.1 contrast ratio (e.g. 4.5:1) between the two colors, along with pass/fail results for AA and AAA conformance levels for both normal text (requires 4.5:1 AA / 7:1 AAA) and large text (requires 3:1 AA / 4.5:1 AAA).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "bg": {
   "type": "string"
  },
  "fg": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ratio": 4.48,
  "AA_normal": true,
  "AAA_normal": false
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/wcag-2-1-contrast-ratio-checker-8f3e318d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
