# Validate

Lint a file for structure and agent-readiness. Validate a **served URL** or **raw content** — handy in CI to check a file before you publish it.

Prefer a UI? The same checks run in the free web [llms.txt validator](/validator) — no API key needed.

```text
POST /api/v1/validate
```

## Request body

Provide **either** `url` or `content`:

| Field | Type | Description |
| --- | --- | --- |
| `url` | string | Fetch and lint the file served at this site. |
| `content` | string | Lint raw text directly (max 500 KB). No network fetch. |
| `checkLinks` | boolean | Sample links for liveness. Defaults to `true`. |

```bash
# Validate a live file
curl https://llms-txt.io/api/v1/validate \
  -X POST -H "x-api-key: $LLMSTXT_KEY" -H "content-type: application/json" \
  -d '{ "url": "https://example.com" }'

# Validate content from a build step before publishing
curl https://llms-txt.io/api/v1/validate \
  -X POST -H "x-api-key: $LLMSTXT_KEY" -H "content-type: application/json" \
  -d '{ "content": "# Example\n\n> Summary…", "checkLinks": false }'
```

## Response

```json
{
  "mode": "url",
  "url": "https://example.com",
  "targetUrl": "https://example.com/llms.txt",
  "score": 92,
  "readinessScore": 80,
  "status": "ok",
  "health": "live",
  "checks": [
    { "id": "has-title", "tier": "structure", "pass": true, "label": "Has an H1 title" }
  ],
  "usesInstructionsPattern": true,
  "hasLlmsFull": true,
  "contentLength": 1843,
  "linkStats": { "checked": 12, "ok": 12, "dead": 0 }
}
```

| Field | Description |
| --- | --- |
| `score` | Structure/compliance score (0–100). |
| `readinessScore` | Agent-readiness score (0–100) — the higher-value signal. |
| `checks` | Per-check results, each tagged `tier`: `"structure"` or `"readiness"`. |
| `health` | `"live"`, `"degraded"`, or `"dead"` (URL mode only). |
| `usesInstructionsPattern` | Whether the file includes an agent-instructions block. |
| `hasLlmsFull` | Whether a companion `llms-full.txt` was found. |
| `linkStats` | Sampled link-liveness results (when `checkLinks` is on). |

::callout{type="tip"}
In CI, validate the `content` you just generated with `checkLinks: false` for a fast, network-light gate, then fail the build if `readinessScore` drops below your threshold.
::

Validation is cheap, so quotas are generous — see [Rate limits & errors](/docs/api/rate-limits-and-errors).
