Knowledge Base API
Endpoints Overview
| Method | Path | Description |
|---|---|---|
| GET | /prod/api/knowledge/articles | List KB articles |
| GET | /prod/api/knowledge/articles/:id | Get article |
| POST | /prod/api/knowledge/articles | Create article |
| PATCH | /prod/api/knowledge/articles/:id | Update article |
| DELETE | /prod/api/knowledge/articles/:id | Retire article |
| GET | /prod/api/knowledge/search | Full-text + semantic search |
| POST | /prod/api/knowledge/ask | RAG 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: draft → review → published → retired.
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
| Field | Type | Description |
|---|---|---|
title | string | Article title (required) |
body | string | Article content (required) |
body_format | enum | markdown, html, plain_text |
category | string | Article category |
state | enum | draft, review, published, retired |
tags | array | String tags for filtering and search |
bedrock_kb_synced_at | ISO 8601 | Last time article was synced to Bedrock KB |