Skip to main content
This example builds a complete search integration from scratch — environment setup, request handling, error recovery, and result parsing.
You need an API key to follow this guide. Get one from the API Console.

Setup

Store your API key as an environment variable rather than hardcoding it:

Complete example

How it works

  1. API key from environment — loaded from ANDI_API_KEY, never hardcoded
  2. Query parametersq for the search query, limit to cap results at 5
  3. Status code check — handle success, rate limiting, and other errors separately
  4. Result parsing — each result has title, link, desc, and source

Variations

With text extracts

Add extracts=true to get longer text passages from each result page:

With domain filtering

Restrict results to specific sites:

Pinning deep mode

The default auto mode already escalates to deeper treatment automatically when a query needs it. Set searchMode=deep to guarantee that treatment on every call, accepting a 2–3 second response:

Context format for LLMs

Get results as markdown text, ready to pass into an LLM prompt:

Next steps

RAG pipeline

Use search results as context for an LLM.

Query parameters

Full parameter reference.

Error handling

Error codes and retry strategies.

Response format

Understand the response structure.