Search

Search Answer

Generate AI-powered answers using search results (valyu provider only)

post/v1/search/answer

Request

  • Base URL: https://apipie.ai
  • URL: https://apipie.ai/v1/search/answer
  • Auth: API key in header Authorization

Request body

querystring required

Question to answer

search_provider'valyu' required

Search provider (must be valyu)

search'web' | 'proprietary' | 'all' | 'news'

Search type (web, proprietary, all, news)

resultsinteger

Number of search results to use (1-10)

fastModeboolean

Enable fast mode for reduced latency

userstring

User identifier for billing observability purposes

whiteliststring[]

Array of sources to include in search results (domains, URLs, or dataset names)

blackliststring[]

Array of sources to exclude from search results (domains, URLs, or dataset names)

source_biasesobject

Bias values for specific sources to influence ranking without hard filtering. Keys are domains (e.g., "nasa.gov") or URL paths. Values are integers from -5 (strong demotion) to +5 (strong boost).

max_pricenumber float

Maximum price in dollars for a thousand retrievals (CPM). Only applies when provided. If not provided, adjusts automatically based on search type and max number of results.

geostring

Country code for localized results

system_instructionsstring

System instructions for the answer generation

Example request

{
  "query": "What are the latest developments in quantum computing?",
  "search_provider": "valyu",
  "search": "all",
  "results": 5,
  "user": "user123",
  "whitelist": [
    "arxiv.org",
    "reuters.com",
    "valyu/valyu-arxiv"
  ],
  "blacklist": [
    "reddit.com",
    "twitter.com",
    "news.ycombinator.com"
  ],
  "source_biases": {
    "nasa.gov": 5,
    "noaa.gov": 3,
    "nih.gov": 1,
    "example.com": -4
  },
  "max_price": 30,
  "timeRange": "7d",
  "geo": "us",
  "system_instructions": "Focus on technical details and cite specific research papers"
}

Response

Successful answer generation

answerstring

AI-generated answer

Example response

{
  "answer": "Recent quantum computing developments include...",
  "usage": {
    "search_id": "nai-123e4567-e89b-12d3-a456-426614174000",
    "timestamp": 1711729795000,
    "search_provider": "google",
    "keywords": "latest AI developments",
    "total_records": 1000000,
    "requested_records": 20,
    "returned_records": 20,
    "cost": 0.03,
    "latencyMs": 1200
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.