← All use cases

Live search grounding for RAG, from real AI surfaces.

RAG pipelines are only as good as what they retrieve, and model snapshots go stale the day they ship. Search-engine result APIs give you links without answers; model APIs give you answers without the live retrieval a consumer surface runs. Grounding on captured AI-surface answers gives you both — current, source-backed answer text your pipeline can quote, verify against, or decompose — in one contract per surface.

The workflow, end to end.

Real endpoints, real field names — nothing below is pseudocode.

  1. step 1 / 4

    Query synchronously at request time

    Add ?mode=sync (or Prefer: wait) to block for inline Envelopes instead of polling — built for a pipeline step where a user is waiting. Sync and async are the same endpoint and body, with no sync surcharge.

    POST /v1/search?mode=sync
    curl -sS -X POST "https://api.aisearchapi.dev/v1/search?mode=sync" \
      -H "Authorization: Bearer $AISEARCH_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "current EU AI Act enforcement status",
        "surfaces": ["perplexity"],
        "regions": [{ "country": "DE" }]
      }'
    # → 200 with the terminal Envelope inline
  2. step 2 / 4

    Take the flat view when you only need text + sources

    Ask for ?view=flat and skip the nesting: surface, status, text, markdown, sources — the five fields a grounding step consumes. The full four-section Envelope is one query-param away when you need provenance.

    GET /v1/jobs/:childId?view=flat
    {
      "surface": "perplexity",
      "status": "completed",
      "text": "the answer as plain text",
      "markdown": "the answer as markdown",
      "sources": [{ "url": "https://…", "title": "…" }]
    }
  3. step 3 / 4

    Feed answer + sources into your generation step

    Use answer.markdown as grounded context and evidence.sources as the citation candidates your product shows. Because the shape is identical across surfaces, swapping or ensembling grounding surfaces is a config change, not a new parser.

  4. step 4 / 4

    Handle absence and failure explicitly

    A surface with no answer completes as surfacePresent:false (never a fabricated answer your RAG step would ingest as truth), and an unbacked lane fails loud with DRIVER_UNAVAILABLE. Honest empties are a feature in a grounding pipeline — branch on them.

The Envelope fields that do the work.

Every surface returns the same canonical Envelope, so these fields mean the same thing whether the capture came from ChatGPT, Perplexity or an AI Overview.

answer.markdown

Always-populated, normalized markdown — drop-in grounded context for a generation prompt.

evidence.sources[]

Citation candidates with urls and titles — what your product displays as "where this came from".

provenance.capturedAt

Freshness stamp per capture — your pipeline knows exactly how current its grounding is.

provenance.surfacePresent

A truthful empty instead of a hallucination-shaped blank — branchable in code.

job.status + warnings

completed / partial / failed with machine-readable reasons — grounding steps need failure semantics, not mystery nulls.

Honest limits

Sync mode is bounded server-side and designed for single-surface, single-region calls where a human is waiting; if the wait runs long it degrades gracefully to a 202 you poll. Real browser captures take longer than a cached-index lookup — if you need sub-second SERP snippets and no answer layer, a classic SERP API is the better fit and we say so. Sync concurrency is plan-limited; high-QPS grounding should mix sync for interactive paths with async + webhooks for the rest.

Terms used here, defined precisely: Envelope · Absence-is-data · API surrogate

Asked precisely.

Why ground on a captured AI surface instead of a search API?

A search API returns links and snippets; your pipeline still has to read, rank and synthesize them. A captured Perplexity or ChatGPT answer has already done live retrieval and synthesis on the real surface, and arrives with its citations attached — one hop to grounded, source-backed context. Many pipelines use both: google_search for breadth, an answer surface for synthesis.

Is sync mode fast enough for interactive use?

It runs the same real-browser acquisition inline, so it is bounded by genuine surface latency — captures take longer than an index lookup, and we will not quote a fake number. The honest engineering answer: use sync for the interactive path where the grounding is the product, cache aggressively, and push everything else through async + webhooks.

How do I avoid grounding on a hallucinated empty?

That failure mode is designed out: an absent answer is an explicit surfacePresent:false with a surface_absent warning (and costs nothing), and a failed lane is an explicit failed status with an acquisition_failed reason. Your pipeline branches on contract fields instead of guessing whether an empty string means "no answer" or "broken scraper".

Can I use this to build evaluation datasets instead of live grounding?

Yes — the same captures work offline: batch-submit query sets, store the Envelopes, and you have dated, source-attributed, provenance-stamped answer data for evals and fine-tuning corpora. The durable raw payloads (job.artifacts.rawKey) preserve the verbatim upstream for reproducibility.

Build it on the capture layer.

500 free credits, charged only on successful captures — the whole workflow above runs on two endpoints.