API
Use with coding agents
Set up Claude Code, Cursor, Codex, or any coding agent to call the Anara API correctly on the first try.
Coding agents do best when they have a key in the environment, a short note on how the API works, and docs they can read as Markdown. This page gives you all three.
1. Put your key in the environment
Create a key under API keys in the console, then export it. Agents should read it from the environment and never paste it into code.
export ANARA_API_KEY="ana_live_..."2. Add the API to your agent instructions
Paste this into AGENTS.md at the root of your repo (Codex, Cursor, and most agents read it; Claude Code reads CLAUDE.md, so put it there too, or import AGENTS.md from it).
## Anara API (academic paper search)
- Base URL: https://api.anara.com. Auth: `Authorization: Bearer $ANARA_API_KEY`. Never hardcode the key.
- Search papers: `POST /v1/search` with `{"query": "...", "type": "standard", "maxResults": 10}`.
`type` is `instant` (fastest), `standard` (default, hybrid), or `deep` (open-access full text with citable passages).
Optional `filters`, for example `{"publicationYear": ">=2021", "hasFulltext": true}`.
- Resolve known papers: `POST /v1/resolve` with `{"identifiers": [...]}` (DOI, arXiv, OpenAlex, or PubMed ids)
and/or `{"titles": [...]}`.
- Application errors are JSON with a `_tag` and a `message`; schema-invalid requests can return `400` with an empty body. `402 PaymentRequired` means the workspace needs credit.
- Docs as Markdown: https://docs.anara.com/api/llms.txt lists every API page; append `.md` to any docs URL.
- OpenAPI spec: https://api.anara.com/openapi.json3. Let the agent read the docs
/api/llms.txtlists only the API pages, each as a Markdown link.- Append
.mdto any page URL, for examplehttps://docs.anara.com/api/search.md. - The docs MCP server at
https://docs.anara.com/mcplets an agent search and read every page. See Use these docs with AI for the client config.
4. Generate a typed client (optional)
If you want types instead of raw requests, generate a client from the spec. See OpenAPI and SDKs.
Check it works
Ask your agent to run a small search and print the titles. If it gets 401, the key is missing or revoked; if it gets 403, inspect the error tag for scope, platform-access, or HIPAA restrictions. See Statuses for everything else.