---
title: "Search the web"
method: POST
path: "/search"
---

# Search the web

`POST /search`

## Request

- Base URL: `https://www.ninjachat.ai/api/v1`
- URL: `https://www.ninjachat.ai/api/v1/search`
- Auth: HTTP bearer

## Headers

- `Idempotency-Key` string

## Request body

- SearchRequest
  - `query` string, required
  - `group` 'web' | 'news'
  - `max_results` integer
  - `search_depth` 'basic' | 'advanced'
  - `topic` 'general' | 'news' | 'finance'
  - `include_answer` boolean
  - `include_images` boolean

## Response `200`

Search results and optional answer.

- SearchResponse
  - `cost` object
    - `this_request` string, required
    - `per_image` string
    - `per_video` string
    - `images` integer
  - `balance` string
  - `metadata` object
    - `latency_ms` number, required
    - `group` string
    - `search_depth` string
    - `results_count` integer
  - `object` 'search.results', required
  - `query` string, required
  - `answer` string, nullable, required
  - `sources` object[], required
    - `url` string, required
    - `title` string, required
    - `content` string, required
    - `published_date` string, nullable, required
  - `images` object[]
    - `url` string, required
    - `description` string, nullable, required
  - `follow_up_questions` string[], required
  - `provider` string, required
  - `cost_usd` number, required
  - `request_id` string, required

## Other responses

- `400`: Invalid or unsupported request parameter.
- `401`: Missing or invalid API key.
- `402`: Insufficient balance or project spend limit reached.
- `429`: Rate limit exceeded.
- `500`: Gateway error.

---

[API](https://skmtc.dev/ninjachat/apis/ninjachat-api.md) · [All operations](https://skmtc.dev/ninjachat/apis/ninjachat-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ninjachat/apis/ninjachat-api/revisions/fa7dfcbdcb03?raw)
