LYRENTH
DocsPricingBenchmarksIndex statsAboutBlogFor site ownersStatusContact
/docs / quickstart
For agent developers

API quickstart

Five minutes from signup to a clean structured AIDocument response. One endpoint into the index, one shape, every URL on the web. Pick your language below; the request is identical in all of them.

Try it before you sign up

No account, no key, one command

Paste this into a terminal, or put the URL straight into a browser address bar. You get the same AIDocument the paid endpoint returns for the same page, so what you see here is what you would build on.

curl "https://api.lyrenth.com/v1/public/aidocument?url=https://en.wikipedia.org/wiki/Web_indexing"

The trial allows 25 reads an hour and 50 a day per IP address, with no sign-up. It accepts GET ?url= as above, or POST with a JSON body of {"url": "..."}. Past either limit it answers 429 telling you which one you hit and how long to wait. When you want more than that, or want to use it from your own application, take a key in step 01 below: the free tier is 2,000 reads a month and still needs no card.

01

Get an API key

Sign up at /signup. The free tier is 2,000 AIDocuments / month, no credit card. Your raw key shows once on the dashboard right after signup; copy it into your password manager. Mint additional keys (one per environment) at /dashboard/keys.

02

Set it as an env var

Keys look like aiwk_ followed by hex. Treat one like any other production secret: do not commit it. Every sample below reads LYRENTH_API_KEY from the environment, which is also the variable both SDKs and the MCP server look for.

03

Resolve a URL with /v1/aidocument

POST a JSON body with the URL you want resolved. The response is the canonical AIDocument v2 shape. If we already have the page it is served from the index; if not, we fetch, clean, and save it once so the next agent gets it instantly too.

curl -X POST https://api.lyrenth.com/v1/aidocument \
  -H "Authorization: Bearer $LYRENTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://en.wikipedia.org/wiki/Web_indexing"}'
04

Read the response

Every successful 2xx call returns the same grouped envelope regardless of how the source page was rendered. The cache.status field tells you whether this call hit the shared index or triggered a fresh fetch. Both SDK samples above expose the same envelope as doc.raw.

{
  "schema":  { "name": "AIDocument", "version": "2.0" },
  "source":  { "url": "…/Web_indexing", "render_mode": "static", "status_code": 200 },
  "cache":   { "status": "hit", "origin_contacted": false },
  "identity": { "title": "Web indexing - Wikipedia", "language": "en" },
  "content":  { "markdown": "Web indexing or…" },
  "signals":  { "word_count": 1552, "reading_time": 7, "has_json_ld": true },
  "economics": {
    "raw_html_tokens_approx": 21331,
    "output_tokens_approx":   2715,
    "token_savings_percent":  0.873
  }
}
05

(Optional) Force a fresh fetch

Default is cache-first. To bypass the lookup and crawl now, set freshness_policy on the request body. Allowed values: cache_first (default) or force_refresh. A force_refresh uses 2 credits instead of 1, since it triggers a live crawl.

curl -X POST https://api.lyrenth.com/v1/aidocument \
  -H "Authorization: Bearer $LYRENTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/post","freshness_policy":"force_refresh"}'
Beyond the basics

Other endpoints

/v1/aidocument handles most of what an agent needs; the rest is housekeeping.

POST/v1/aidocument

Resolve any URL

Cache on hit within your freshness window, fresh fetch on miss, body shared with every caller. Each success counts as one request. Optional max_tokens caps the returned markdown to a context budget.

POST/v1/aidocument/batch

Resolve up to 20 URLs

One call, an array of clean AIDocuments with per-URL error isolation (a failed URL does not block the others). Billed one credit per successfully-read URL.

GET/v1/read?url=…

The same read as Markdown

One GET, no body, text/markdown back instead of JSON: a title, a source line, then the cleaned body. Paste-and-go for a shell or an agent that just wants the text.

POST/v1/submit

Queue a URL for indexing

Returns 202; we crawl in the background. Free, does not count toward quota.

GET/v1/quota

Your usage state

This month's consumed-vs-limit shape. Free. The dashboard sidebar reads this same endpoint.

Errors

What can go wrong

Errors are JSON. Branch on the error field rather than the HTTP status alone.

HTTP 401invalid api key

Missing or invalid Bearer token. The error field carries the plain message, either "missing session cookie or Authorization: Bearer header" or "invalid api key". Check that the key is set and has not been revoked.

HTTP 422upstream_blocked

The target site's WAF or CDN rejected our crawler. One of a family of typed upstream codes; the body carries message, upstream_status and host so you can tell a block from a 404 at the origin.

HTTP 422no_extractable_content

The page answered 2xx but held nothing readable, which usually means an anti-bot challenge was served instead of the article.

HTTP 429rate_limited

Two different cases, told apart by the window field in the body. window "1s" is your plan's per-second API rate. window "month" is your monthly quota, shared across all your keys, with an upgrade hint and the reset date.

HTTP 451this URL is not available

The URL is removed from the index, or the site's robots.txt disallows it. Lyrenth respects robots.txt on every fetch, so a disallowed URL cannot be indexed on request either.

Want the full document shape?

Every field in the response, and the contract guarantees we make about backward compatibility.