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:
export ANDI_API_KEY="your-api-key"

Complete example

#!/bin/bash

# Search with error handling
response=$(curl -s -w "\n%{http_code}" \
  "https://search-api.andisearch.com/api/v1/search?q=best+programming+languages+2025&limit=5" \
  -H "x-api-key: $ANDI_API_KEY")

http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | sed '$d')

if [ "$http_code" -eq 200 ]; then
  echo "$body" | jq '.results[] | {title, link, source}'
else
  echo "Error $http_code: $(echo "$body" | jq -r '.error')"
fi

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:
response = requests.get(
    "https://search-api.andisearch.com/api/v1/search",
    params={"q": "best programming languages 2025", "extracts": "true"},
    headers={"x-api-key": api_key},
)

data = response.json()
for result in data["results"]:
    if result.get("extracts"):
        print(f"{result['title']}: {result['extracts'][0][:200]}")

With domain filtering

Restrict results to specific sites:
response = requests.get(
    "https://search-api.andisearch.com/api/v1/search",
    params={
        "q": "best programming languages 2025",
        "includeDomains": "stackoverflow.com,github.com",
    },
    headers={"x-api-key": api_key},
)

Context format for LLMs

Get results as markdown text, ready to pass into an LLM prompt:
response = requests.get(
    "https://search-api.andisearch.com/api/v1/search",
    params={"q": "best programming languages 2025", "format": "context"},
    headers={"x-api-key": api_key},
)

# Response is markdown text, not JSON
context = response.text

Next steps