---
title: "Search a selected documentation version and router"
method: POST
path: "/api/search"
tags: ["Documentation search"]
---

# Search a selected documentation version and router

`POST /api/search`

## Request

- Base URL: `https://nextjs.org`
- URL: `https://nextjs.org/api/search`
- Auth: none declared

Searches the public documentation index with an explicit version and router scope. This is a read-only search operation; the request body selects the search scope and does not create or change data.

## Request body

- SearchRequest
  - `query` string, required: Documentation topic to search for; whitespace-only values are rejected, and values longer than 10,000 characters are truncated.
  - `version` '13' | '14' | '15' | 'stable', required: Documentation version identifier. Use one of the currently served versions in this list.
  - `routerType` 'app' | 'pages' | 'both', required: Which Next.js router to include in the results.

## Response `200`

Matching documentation passages.

- SearchResponse
  - `hits` SearchHit[], required
    - `title` string, required
    - `pageTitle` string, required
    - `content` string, required
    - `path` string, required
    - `section` string
    - `anchor` string
    - `objectID` string, required
  - `nbHits` integer, required
  - `query` string, required
  - `provider` 'upstash', required

## Other responses

- `400`: The JSON body, query, version, or routerType is invalid.
- `500`: The search service is temporarily unavailable.

---

[API](https://skmtc.dev/nextjs/apis/next-js-documentation-search-api.md) - [All operations](https://skmtc.dev/nextjs/apis/next-js-documentation-search-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nextjs/apis/next-js-documentation-search-api/revisions/9d2f52b94ef3?raw)
