Search & RAG API

Integrate AI-powered search and question answering into your applications.

Read time:7 minUpdated:2026-01-10

Search & RAG API

Integrate TyneBase's AI-powered search into your applications.

POST /v1/search

Request Body

{
  "query": "How do I configure SSO?",
  "limit": 10,
  "filters": {
    "category_ids": ["cat_security"],
    "state": "published"
  },
  "options": {
    "include_content": true,
    "highlight": true
  }
}

Response

{
  "success": true,
  "data": {
    "results": [
      {
        "document": {
          "id": "doc_sso123",
          "title": "SSO Configuration Guide",
          "slug": "sso-configuration-guide"
        },
        "score": 0.94,
        "highlights": [
          "To <mark>configure SSO</mark>, navigate to Settings..."
        ],
        "content_preview": "This guide walks you through..."
      }
    ],
    "query_embedding_time_ms": 45,
    "search_time_ms": 23
  }
}

AI Question Answering (RAG)

POST /v1/ask

Request Body

{
  "question": "What are the steps to set up SSO with Okta?",
  "options": {
    "max_sources": 5,
    "include_sources": true,
    "stream": false
  }
}

Response

{
  "success": true,
  "data": {
    "answer": "To set up SSO with Okta, follow these steps:\n\n1. Navigate to Settings → Security → SSO\n2. Select 'Okta' as your identity provider\n3. Copy the provided ACS URL and Entity ID\n4. In Okta, create a new SAML 2.0 application...\n\nFor detailed configuration, see the linked documentation.",
    "sources": [
      {
        "document_id": "doc_sso123",
        "title": "SSO Configuration Guide",
        "relevance_score": 0.96,
        "chunk_text": "To configure Okta SSO..."
      },
      {
        "document_id": "doc_okta456",
        "title": "Okta Integration",
        "relevance_score": 0.89,
        "chunk_text": "Create a new SAML application..."
      }
    ],
    "confidence": 0.92,
    "model": "gpt-5.2",
    "tokens_used": 1847
  }
}

Streaming Responses

For real-time AI responses, use streaming:

POST /v1/ask
Content-Type: application/json

{
  "question": "Explain our deployment process",
  "options": {
    "stream": true
  }
}

Response is Server-Sent Events:

data: {"type": "start", "request_id": "req_123"}

data: {"type": "token", "content": "The"}
data: {"type": "token", "content": " deployment"}
data: {"type": "token", "content": " process"}
...

data: {"type": "sources", "sources": [...]}
data: {"type": "done", "tokens_used": 523}

Embeddings API

Generate embeddings for custom integrations:

POST /v1/embeddings

Request

{
  "texts": [
    "How to configure authentication",
    "Deployment best practices"
  ],
  "model": "text-embedding-3-large"
}

Response

{
  "success": true,
  "data": {
    "embeddings": [
      {
        "index": 0,
        "embedding": [0.0123, -0.0456, ...],
        "tokens": 5
      },
      {
        "index": 1,
        "embedding": [0.0789, -0.0321, ...],
        "tokens": 4
      }
    ],
    "model": "text-embedding-3-large",
    "dimensions": 3072
  }
}