Boltly Boltly / Docs
Docs / API Reference / Knowledge Base

Knowledge Base

Feed documents and curated QA pairs into Boltly's knowledge base, then retrieve the most relevant context to ground AI chatbot responses.

POST /v1/knowledge-base/documents

Upload document

Add a document to the knowledge base from a PDF, Markdown file, or URL. Content is chunked and embedded for retrieval.

Parameters

name string required

Display name for the document.

source_type string required

One of: pdf, markdown, url.

source_url string

Public URL of the source content. Required for pdf and url source types.

Request

cURL
curl -X POST https://api.boltly.online/v1/knowledge-base/documents \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pricing FAQ",
    "source_type": "url",
    "source_url": "https://example.com/pricing-faq"
  }'

Response

JSON
{
  "data": {
    "id": "e1a4b7c2-...",
    "name": "Pricing FAQ",
    "source_type": "url",
    "source_url": "https://example.com/pricing-faq",
    "status": "processing",
    "created_at": "2026-04-03T12:00:00Z"
  }
}

POST /v1/knowledge-base/qa-pairs

Create QA pair

Add a curated question-answer pair. QA pairs are matched directly during retrieval, ahead of document chunks.

Parameters

question string required

The question customers ask.

answer string required

The canonical answer.

tags array

Tags for organizing and filtering QA pairs.

Request

cURL
curl -X POST https://api.boltly.online/v1/knowledge-base/qa-pairs \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is your refund policy?",
    "answer": "We offer a full refund within 30 days of purchase, no questions asked.",
    "tags": ["billing", "refunds"]
  }'

Response

JSON
{
  "data": {
    "id": "f5c8d2e9-...",
    "question": "What is your refund policy?",
    "answer": "We offer a full refund within 30 days of purchase, no questions asked.",
    "tags": ["billing", "refunds"],
    "created_at": "2026-04-03T12:00:00Z"
  }
}

POST /v1/knowledge-base/retrieve

Retrieve context

Search the knowledge base and return the most relevant chunks and QA pairs for a query. Used to ground AI chatbot answers.

Parameters

query string required

Natural-language search query.

top_k integer

Maximum number of results to return. Defaults to 5.

Request

cURL
curl -X POST https://api.boltly.online/v1/knowledge-base/retrieve \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how do refunds work",
    "top_k": 3
  }'

Response

JSON
{
  "data": {
    "results": [
      {
        "type": "qa_pair",
        "score": 0.92,
        "question": "What is your refund policy?",
        "answer": "We offer a full refund within 30 days of purchase, no questions asked."
      },
      {
        "type": "chunk",
        "score": 0.81,
        "document_id": "e1a4b7c2-...",
        "content": "Refunds are processed to the original payment method within 5-7 business days..."
      }
    ]
  }
}