Skip to main content
This example builds a news monitoring system that searches for recent articles on specific topics, filters by date and source, and collects results for processing.

Complete example

# Search for AI news from the past 24 hours
curl -s "https://search-api.andisearch.com/api/v1/search?q=artificial+intelligence&intent=news&dateRange=24h&limit=10" \
  -H "x-api-key: $ANDI_API_KEY" | jq '.results[] | {title, link, date, source}'

How it works

  1. intent=news forces news-specific results rather than general web search
  2. dateRange=24h limits results to the past 24 hours
  3. News array — when the intent is news, results may appear in the news array alongside results
  4. Multiple topics — loop through topics to monitor several areas at once

Variations

Restrict to trusted sources

Limit results to specific publications:
tech_sources = [
    "arstechnica.com",
    "wired.com",
    "technologyreview.com",
    "theverge.com",
]

articles = search_news(
    "artificial intelligence",
    date_range="week",
    domains=tech_sources,
)

Exclude aggregators

Remove noisy domains from results:
response = requests.get(
    "https://search-api.andisearch.com/api/v1/search",
    params={
        "q": "AI startups funding",
        "intent": "news",
        "dateRange": "week",
        "excludeDomains": "reddit.com,medium.com",
    },
    headers={"x-api-key": api_key},
)

Custom date range

Search a specific time window:
response = requests.get(
    "https://search-api.andisearch.com/api/v1/search",
    params={
        "q": "product launch",
        "intent": "news",
        "dateFrom": "2025-03-01",
        "dateTo": "2025-03-15",
    },
    headers={"x-api-key": api_key},
)

Scheduled monitoring

Run searches on a schedule using cron or a task scheduler:
import time

def monitor_loop(topics: list[str], interval_seconds: int = 3600):
    """Check for new articles every interval."""
    while True:
        for topic in topics:
            articles = search_news(topic, date_range="24h")
            if articles:
                print(f"[{datetime.now()}] {topic}: {len(articles)} new articles")
                # Process articles: send alerts, save to database, etc.
        time.sleep(interval_seconds)
When running scheduled searches, respect your rate limits. Space requests out and use the X-RateLimit-Remaining header to monitor usage.

Next steps