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

# REST API Overview

> Complete REST API endpoint reference for search, organizations, hits, and AI landing pages

## Overview

The Bonsai REST API provides endpoints for search, analytics tracking, and AI-generated landing content.

## Authentication

Include your API key in the `X-API-Key` header:

```http theme={null}
X-API-Key: YOUR_API_KEY_HERE
```

<Callout color="#0A5B3B" icon="triangle-alert">
  Keep API keys server-side only. Do not expose keys in browser client code.
</Callout>

For the API playground "Try it" input, enter your API key in the bearer token field.

## Base URL

```http theme={null}
https://api.hibonsai.com/rest/
```

## Endpoint Directory

<CardGroup cols={2}>
  <Card title="Search v3" icon="sparkles" href="/project/api-reference/rest-api/search-v3">
    Enhanced search endpoint recommended for new integrations.
  </Card>

  <Card title="Search v2" icon="search" href="/project/api-reference/rest-api/search-v2">
    Original search endpoint for product and context queries.
  </Card>

  <Card title="Hits" icon="activity" href="/project/api-reference/rest-api/hits">
    Track search and interaction events.
  </Card>

  <Card title="AI Landing Page" icon="bot" href="/project/api-reference/rest-api/ai-landing">
    Retrieve AI-generated landing content for an organization.
  </Card>
</CardGroup>

## Search Versions

Both search versions support the same core query pattern. Use v3 for new implementations.

| Version | Path               | Use case                                                    |
| ------- | ------------------ | ----------------------------------------------------------- |
| v3      | `/rest/search/v3/` | Recommended default for new integrations                    |
| v2      | `/rest/search/v2/` | Existing integrations on the original search implementation |

## Error Handling

REST endpoints return standard HTTP status codes with JSON error bodies:

```json theme={null}
{
  "error": "Error message",
  "details": {}
}
```

**Common HTTP status codes:**

* `200 OK`: Request succeeded
* `400 Bad Request`: Invalid parameters or malformed request
* `401 Unauthorized`: Missing or invalid API key
* `404 Not Found`: Resource not found
* `429 Too Many Requests`: Rate limit exceeded
* `500 Internal Server Error`: Server error

## Rate Limiting

API requests are rate limited per organization. If you exceed your rate limit, you'll receive a `429 Too Many Requests` response. Rate limits are configured per customer account. Contact your Customer Success Manager (CSM) for information about your account's rate limits.

## Support

For API support, integration assistance, or feature requests, contact your Customer Success Manager.
