RAG without the plumbing. Cited answers, real URLs, no hallucinated sources.
POST /v1/search/answer·20 + 5/source·Search & Discovery
An end-to-end RAG pipeline behind one POST. We do the search, fetch the top sources, hand them to our answer model with a strict citation prompt, and return a clean answer with numbered [n] citations plus the list of sources it drew on, so you can check each claim against its URL.
The hard part
Standing up your own RAG pipeline is half a weekend: a search call, a fetcher, an LLM key, a citation enforcer, a fallback for hallucinated URLs, and a way to keep your answers from leaning on whichever source got summarised first. One POST replaces all of that with cited answers that point at real, fetched pages.
AI answer API: what you get
Numbered [1][2] citations that resolve to real fetched URLs.
Returns the answer plus the full citation list (index, url, title, snippet).
Fast-fail on slow sources so one bad fetch doesn't drag the whole answer.
AI answer API use cases
Cited answers in a chat product
Show the answer with its [n] markers and link each one to the citation's URL, title and snippet.
Fact checks inside an agent
Ask a narrow question and check each claim against the source it cites before the agent acts on it.
Research briefs
Answer a list of questions with up to 10 sources each, then fetch any cited page in full with the Web Scraping API.
AI answer API quickstart: Python, Node and curl
Install the SDK with pip install scrapenest (PyPI) or npm install scrapenest (npm), or send the raw HTTP call with your key in the Authorization: Bearer header. No key yet? Sign up free, verify your email, then create a key in your dashboard.
import os
from scrapenest import Client
client = Client(os.environ["SCRAPENEST_API_KEY"])
res = client.search_answer("is matcha actually better than coffee for focus?", max_sources=5)
print(res.answer)
for c in res.citations:
print(f"[{c.index}] {c.title} {c.url}")
import { ScrapeNest } from "scrapenest";
const client = new ScrapeNest({ apiKey: process.env.SCRAPENEST_API_KEY });
const res = await client.searchAnswer({
query: "is matcha actually better than coffee for focus?",
max_sources: 5,
});
console.log(res.answer);
for (const c of res.citations) console.log(`[${c.index}] ${c.title} ${c.url}`);
curl -X POST https://scrapenest.dev/v1/search/answer \
-H "Authorization: Bearer sn_••••" \
-H "Content-Type: application/json" \
-d '{
"query": "is matcha actually better than coffee for focus?",
"num_results": 8,
"max_sources": 5
}'
import httpx
r = httpx.post(
"https://scrapenest.dev/v1/search/answer",
headers={"Authorization": "Bearer sn_••••"},
json={"query": "is matcha actually better than coffee for focus?", "num_results": 8, "max_sources": 5},
timeout=60,
)
body = r.json()
print(body["answer"])
for c in body["citations"]:
print(c["index"], c["url"])
{
"query": "is matcha actually better than coffee for focus?",
"max_sources": 5
}
Response JSON
{
"query": "is matcha actually better than coffee for focus?",
"answer": "Matcha delivers caffeine with L-theanine, which smooths the energy curve [1][3] …",
"citations": [
{
"index": 1,
"url": "https://examine.com/supplements/l-theanine/",
"title": "L-Theanine · Examine",
"snippet": "L-theanine is an amino acid found in tea …"
},
{
"index": 3,
"url": "https://nccih.nih.gov/health/green-tea",
"title": "Green Tea · NCCIH",
"snippet": "Most studies on green tea …"
}
],
"took_ms": 4200,
"cache_hit": false,
"credits_charged": 35
}
Fields with no value are left out of the JSON rather than sent as null, so read optional fields defensively.
AI answer API pricing
5 credits for the search, 5 credits per source actually fetched, plus 15 credits for the AI answer step. Formula: 5 + 5 × sources fetched + 15. The answer step is waived when no source page could be fetched and the answer falls back to search snippets (flat 5). When none of the sources is relevant the model isn't called and the call bills a flat 5; an answer that opens by saying the sources don't address the question also bills a flat 5. Wall, consent and empty pages don't count as fetched sources. Cache hits: 1 credit.
Plans and pay-as-you-go rates are on the pricing page.
AI answer API limits
max_sources: 1 to 10, default 5. query: 1 to 400 characters.
depth sets how hard sources are fetched: about 2.5 s a page at fast, 6 s at balanced, 9 s at thorough and 12 s at stealth, inside an overall fetch ceiling of roughly 6, 14, 20 and 28 s.
include_images, image_sources and include_image_descriptions are rejected with a 422 on this endpoint.
timeout_seconds is accepted but has no effect here, and page is ignored.
AI answer API error codes
HTTP
Code
Meaning
503
no_sources
No usable sources were found. Not billed; rephrase the query.
503
llm_upstream_failed
The answer step failed. Not billed; retry.
503
llm_not_configured
The answer step is unavailable right now. Not billed.
503
upstream_failed
The search step failed. Not billed.
422
validation_error
A field is invalid, including any image flag.
Every endpoint can also return 401 unauthorized (missing or wrong key), 402 insufficient_credits (balance used up), 403 email_not_verified (an email signup must verify its address before its key works) and 429 rate_limited or concurrency_limit_exceeded. All errors share one JSON envelope; see the error reference.
questions
AI answer API FAQ
How are citations returned?
The answer text carries numbered markers like [1][3], and citations lists each one with its index, url, title and snippet, so every marker resolves to a page that was actually fetched.
What does an answer cost?
5 credits for the search, 5 per source page fetched and 15 for the answer step: 5 + 5 × sources + 15. When no source page could be fetched, or none was relevant, the call bills a flat 5, and a cache hit bills 1.
What if nothing on the web answers the question?
The model isn't called. You get a fixed answer saying no relevant sources were found, an empty citations list and a flat 5-credit charge.
Can I choose how many sources it reads?
Yes, max_sources takes 1 to 10 (default 5). Raise depth when answers come back grounded in snippets: the higher tiers fetch each source harder.