v2026.1 Open Portal ↗
On this page

Knowledge Base API

Endpoints Overview

MethodPathDescription
GET/prod/api/knowledge/articlesList KB articles
GET/prod/api/knowledge/articles/:idGet article
POST/prod/api/knowledge/articlesCreate article
PATCH/prod/api/knowledge/articles/:idUpdate article
DELETE/prod/api/knowledge/articles/:idRetire article
GET/prod/api/knowledge/searchFull-text + semantic search
POST/prod/api/knowledge/askRAG question answering

List Articles

curl -H "Authorization: Bearer $TOKEN"   "https://your-instance.stackflow-tech.com/prod/api/knowledge/articles?state=published&category=database&limit=25"

Get Article

{
  "id": "KB0001234",
  "title": "How to reset Aurora connection pool on StackFlowAPI Lambda",
  "category": "database",
  "state": "published",
  "body": "## Problem\nThe StackFlowAPI Lambda may exhaust...",
  "body_format": "markdown",
  "tags": ["aurora", "lambda", "connection-pool"],
  "view_count": 142,
  "helpful_count": 38,
  "created_by": "jane.doe@example.com",
  "published_at": "2026-04-10T09:00:00Z",
  "updated_at": "2026-05-01T14:00:00Z",
  "bedrock_kb_synced_at": "2026-05-01T14:05:00Z"
}

Create Article

curl -X POST   https://your-instance.stackflow-tech.com/prod/api/knowledge/articles   -H "Authorization: Bearer $TOKEN"   -H "Content-Type: application/json"   -d '{
    "title": "Resolving Neptune query timeouts for deep graph traversals",
    "category": "database",
    "body": "## Symptoms\nGremlin queries with more than 5 hops...",
    "body_format": "markdown",
    "tags": ["neptune", "gremlin", "performance"],
    "state": "draft"
  }'
Bedrock KB Sync: Published articles are automatically synced to the Bedrock Knowledge Base (BXJGG7PIPS) within 60 seconds using Titan Embeddings v2 at 1024 dimensions. The RAG /ask endpoint will include the article in its context within 2 minutes of publication.

Update Article

curl -X PATCH   https://your-instance.stackflow-tech.com/prod/api/knowledge/articles/KB0001234   -H "Authorization: Bearer $TOKEN"   -H "Content-Type: application/json"   -d '{"state": "published", "body": "Updated body content..."}'

Article states: draftreviewpublishedretired.

Search Articles

# Semantic search (uses Bedrock vector search)
curl -H "Authorization: Bearer $TOKEN"   "https://your-instance.stackflow-tech.com/prod/api/knowledge/search?q=how+to+fix+aurora+connection+errors&semantic=true"

# Full-text search only
curl -H "Authorization: Bearer $TOKEN"   "https://your-instance.stackflow-tech.com/prod/api/knowledge/search?q=aurora+connection&semantic=false"
{
  "results": [
    {
      "id": "KB0001234",
      "title": "How to reset Aurora connection pool on StackFlowAPI Lambda",
      "snippet": "The StackFlowAPI Lambda may exhaust its Aurora connection pool under high load...",
      "score": 0.94,
      "category": "database"
    }
  ],
  "total": 3,
  "search_type": "semantic"
}

RAG Ask Endpoint

The /ask endpoint combines vector search with Claude to provide a direct, cited answer from your Knowledge Base.

curl -X POST   https://your-instance.stackflow-tech.com/prod/api/knowledge/ask   -H "Authorization: Bearer $TOKEN"   -H "Content-Type: application/json"   -d '{
    "question": "How do I resolve Aurora connection pool exhaustion?",
    "max_results": 5,
    "include_citations": true
  }'
{
  "answer": "To resolve Aurora connection pool exhaustion on StackFlowAPI Lambda:\n1. Set the MAX_POOL_SIZE environment variable to 10...\n2. Deploy the Lambda update...",
  "citations": [
    {"article_id": "KB0001234", "title": "How to reset Aurora connection pool", "relevance": 0.94}
  ],
  "model_used": "anthropic.claude-3-sonnet-20240229-v1:0",
  "bedrock_kb_id": "BXJGG7PIPS",
  "tokens_used": 842,
  "latency_ms": 1240
}

Field Reference

FieldTypeDescription
titlestringArticle title (required)
bodystringArticle content (required)
body_formatenummarkdown, html, plain_text
categorystringArticle category
stateenumdraft, review, published, retired
tagsarrayString tags for filtering and search
bedrock_kb_synced_atISO 8601Last time article was synced to Bedrock KB