Search API

Query your indexed content with semantic search and AI-powered chat. These endpoints can be called from the browser (with public access enabled) or server-side with an API key.

Search

GET Request (Cacheable)

GET /public/sites/{siteId}/search?q=how+to+reset+password&limit=10

GET requests are cached by CloudFront for 60 seconds, making them faster for repeated queries.

POST Request

POST /public/sites/{siteId}/search

{
  "query": "how to reset password",
  "limit": 10,
  "minScore": 0.3
}

Use POST for complex queries or when you need to bypass caching.

Parameters

Field Type Default Description
query / q string - Required. Search query
limit integer 10 Maximum results (1-50)
minScore number 0.3 Minimum relevance score (0-1)

Response

{
  "query": "how to reset password",
  "results": [
    {
      "url": "https://example.com/help/reset-password",
      "title": "Password Reset Guide",
      "snippet": "To reset your password, click the 'Forgot Password' link on the login page...",
      "score": 0.89
    },
    {
      "url": "https://example.com/faq/account",
      "title": "Account FAQ",
      "snippet": "Common questions about managing your account, including password resets...",
      "score": 0.72
    }
  ],
  "totalResults": 2,
  "timingMs": 45
}
Field Description
results[].url Source page URL
results[].title Page title
results[].snippet Relevant excerpt from the page
results[].score Relevance score (0-1)
timingMs Query execution time in milliseconds

Chat

POST /public/sites/{siteId}/chat

{
  "query": "how do I reset my password?",
  "sessionId": "optional-session-id"
}

Get an AI-generated answer based on your indexed content. The response includes source citations.

Parameters

Field Type Description
query string Required. User's question
sessionId string Optional. For conversation continuity

Response

{
  "answer": "To reset your password:\n\n1. Go to the login page\n2. Click 'Forgot Password'\n3. Enter your email address\n4. Check your inbox for the reset link\n5. Click the link and create a new password\n\nThe reset link expires after 24 hours.",
  "sources": [
    {
      "url": "https://example.com/help/reset-password",
      "title": "Password Reset Guide",
      "score": 0.89
    }
  ],
  "sessionId": "sess_abc123xyz"
}
Field Description
answer AI-generated answer (may include markdown)
sources Pages used to generate the answer
sessionId Session ID for follow-up questions

Sessions

To maintain conversation context, include the sessionId from the previous response in your next request:

  1. First request: Don't include sessionId
  2. Response includes a new sessionId
  3. Subsequent requests: Include that sessionId
  4. The AI remembers previous questions and answers

Sessions expire after the configured TTL (default: 30 minutes).

Multi-Site Search (Enterprise)

Enterprise users can search across multiple sites using Search Groups. See Search Groups API for details.