Web answer

$0.08 per call · USDC via x402 · GET /api/answer

AI-generated answer to a natural-language question, grounded in live web search results with source citations. Send GET /api/answer with the required field q and pay $0.08 per call over x402 or MPP (there is no free tier). It returns a JSON object with query, answer, citations and citationCount.

Returns clean prose plus a structured citations array (URL, snippet, favicon) - backed by an independent search index, not the model's training data. Useful when an agent needs a synthesized answer plus the receipts to verify or follow up.

Category: Web & documents · Tags: search answer ai rag citations research fresh-data

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
qstringyesNatural-language question (max 400 chars) Also accepted as query, search, term, keyword.
countrystringnoOptional 2-letter country code (default us)
languagestringnoOptional 2-letter language code (default en)
max_tokensintegernoOptional cap on the generated answer length in tokens (default 1024, min 64, max 4096). Lower for TL;DR; higher for research questions.

Example request

curl -i "https://agent402.tools/api/answer?q=what+is+the+x402+payment+protocol%3F"

Without payment this returns HTTP 402 Payment Required with the exact price for answer; any x402 v2 or MPP client pays it and retries.

Example response

{
  "query": "what is the x402 payment protocol?",
  "answer": "x402 is an open standard for internet-native, pay-per-request HTTP APIs that uses the HTTP 402 \"Payment Required\" status code to negotiate and settle micro-payments inline with the original request.",
  "citations": [
    {
      "url": "https://www.x402.org/",
      "snippet": "x402: An open standard for internet-native payments.",
      "favicon": "https://imgs.search.brave.com/...",
      "number": 1
    }
  ],
  "citationCount": 1
}
FieldTypeAlways presentIn the example
querystringyeswhat is the x402 payment protocol?
answerstringyesx402 is an open standard for internet-native, pay-per-request HTTP APIs that ...
citationsarray of objectsyes1 item in the example
citationCountnumberyes1

From an MCP client

catalog.call {
  "slug": "answer",
  "params": {
    "q": "what is the x402 payment protocol?"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for answer; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/answer?q=what+is+the+x402+payment+protocol%3F");

Part of these workflows

Web answer is one step in these 2 skill packs, each sold as a single call:

Related tools

LLM grounding context

$0.02 · POST /api/llm-context

Web search that returns READY-TO-USE grounding text, not links: for one query you get the passages an independent search…

Exa grounded answer

$0.010 · POST /api/exa-answer

Ask a question and get a written answer with the sources it was drawn from. Exa searches its index, reads the pages and …

Web search

$0.01 · GET /api/search

Live web search: ranked results[] of {title, url, description (the snippet, plain text), age, publishedAt (ISO)} from an…

News search

$0.01 · GET /api/search-news

Live news search: ranked recent articles as results[] of {title, url, description (the snippet, plain text), age, publis…

Multi-search (batch)

$0.08 · POST /api/multi-search

Run 2-5 web searches in one call with a 20% volume discount vs. individual searches. Each query returns ranked results (…

Image search

$0.02 · GET /api/search-images

Live image search: ranked image results (title, source page, image URL, thumbnail URL, dimensions) from an independent s…