> ## Documentation Index
> Fetch the complete documentation index at: https://www.mintlify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mintlify Index REST API

> Use the Mintlify Index REST API to search documentation and the web, assemble source-cited context, and retrieve page contents for applications and agents.

Use the Mintlify Index REST API to retrieve technical knowledge for applications and agents. The API supports three retrieval patterns:

* [`context`](/docs/api/search-index/context) assembles source-cited content within a token budget.
* [`search`](/docs/api/search-index/search) returns ranked documentation and web results.
* [`contents`](/docs/api/search-index/contents) retrieves content for selected Mintlify result IDs or result URLs.

<Info>
  The REST API requires an API key for your organization. The public [Index MCP server](/docs/search-index/mcp) does not require an API key.
</Info>

## Base URL

Send REST API requests to:

```text theme={null}
https://leaves.mintlify.com/api/universal-search/v1
```

Append an endpoint path to this base URL, for example `/context`, `/search`, or `/contents`.

## Authentication

Authenticate each request with an Index API key in the `Authorization` header:

```http theme={null}
Authorization: Bearer mint_us_...
```

Index API keys begin with `mint_us_`.

<Steps>
  <Step title="Create an Index API key">
    Open the [API keys page](https://app.mintlify.com/settings/organization/api-keys) in your dashboard and create an Index API key.

    If this key type is unavailable, your organization does not have access to the Index REST API.
  </Step>

  <Step title="Store the key securely">
    Save the key in a server-side environment variable. Mintlify only displays the complete key when you first create it. Store it securely.

    ```bash theme={null}
    export MINTLIFY_INDEX_API_KEY="mint_us_..."
    ```

    <Warning>
      Do not expose an Index API key in client-side code or commit it to version control.
    </Warning>
  </Step>

  <Step title="Build context">
    Send your first request to the `context` endpoint:

    ```bash theme={null}
    curl -X POST "https://leaves.mintlify.com/api/universal-search/v1/context" \
      -H "Authorization: Bearer $MINTLIFY_INDEX_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "How should I configure caching in Next.js 16?",
        "product": "Next.js",
        "format": "txt",
        "tokenBudget": 3000
      }'
    ```

    A successful response includes assembled context with source URLs, the number of results used, and the output token count.
  </Step>
</Steps>

## Rate limits

REST API limits apply per Mintlify organization. All API keys in an organization share the same limit:

| Window     |          Limit |
| ---------- | -------------: |
| Per second |    10 requests |
| Per day    | 1,000 requests |

Requests exceeding either limit return `429 Too Many Requests`. Use exponential backoff before retrying.

## Errors

| Status | Meaning                                                                                     |
| ------ | ------------------------------------------------------------------------------------------- |
| `400`  | The request body is invalid.                                                                |
| `401`  | The API key is missing or invalid, or the organization does not have Index REST API access. |
| `403`  | The request IP is not allowed by the API key.                                               |
| `429`  | The organization exceeded a rate limit.                                                     |
| `500`  | Index could not complete the request.                                                       |


## Related topics

- [Mintlify REST API introduction](/docs/api/introduction.md)
- [Index](/docs/search-index/index.md)
- [llms.txt](/docs/ai/llmstxt.md)
