---
title: "Search Answer"
method: POST
path: "/v1/search/answer"
tags: ["Search"]
---

# Search Answer

`POST /v1/search/answer`

## Request

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

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

## Request body

- object
  - `query` string, required: Question to answer
  - `search_provider` 'valyu', required: Search provider (must be valyu)
  - `search` 'web' | 'proprietary' | 'all' | 'news': Search type (web, proprietary, all, news)
  - `results` integer: Number of search results to use (1-10)
  - `fastMode` boolean: Enable fast mode for reduced latency
  - `user` string: User identifier for billing observability purposes
  - `whitelist` string[]: Array of sources to include in search results (domains, URLs, or dataset names)
  - `blacklist` string[]: Array of sources to exclude from search results (domains, URLs, or dataset names)
  - `source_biases` object: 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_price` number, 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.
  - `timeRange` union: Time range filter. Can be string format (e.g., "7d" for last 7 days) or object with start_date/end_date (YYYY-MM-DD)
    - string
    - object
      - `start_date` string, date
      - `end_date` string, date
  - `geo` string: Country code for localized results
  - `system_instructions` string: System instructions for the answer generation

## Response `200`

Successful answer generation

- object
  - `answer` string: AI-generated answer
  - `sources` object[]: Sources used for the answer
    - `title` string
    - `url` string
  - `usage` SearchUsage
    - `search_id` string
    - `timestamp` integer
    - `search_provider` string
    - `keywords` string
    - `total_records` integer
    - `requested_records` integer
    - `returned_records` integer
    - `cost` number, float
    - `latencyMs` integer

## Other responses

- `400`: Bad request or answer generation failed

---

[API](https://skmtc.dev/apipie/apis/introduction.md) · [All operations](https://skmtc.dev/apipie/apis/introduction/llms.txt) · [OpenAPI document](https://skmtc.dev/apipie/apis/introduction/revisions/f8386be4eb3f?raw)
