API Reference
API: Knowledge
Flapjack REST API endpoints for uploading, listing, and deleting knowledge documents for RAG.
Upload and manage documents for retrieval-augmented generation (RAG).
Upload Document
POST /api/knowledge/upload
Upload a document to be chunked, embedded, and stored for RAG. Uses multipart/form-data.
Form fields:
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The document file (PDF, text, markdown, etc.) |
title | string | Yes | Display title |
scopeType | string | Yes | org, agent, or thread |
scopeId | string | Yes | UUID of the scope target |
curl -X POST https://api.flapjack.dev/api/knowledge/upload \
-H "Authorization: Bearer fj_live_..." \
-F "file=@product-docs.pdf" \
-F "title=Product Documentation" \
-F "scopeType=agent" \
-F "scopeId=abc-123"
Response 201:
{
"id": "doc-001",
"title": "Product Documentation",
"chunks": 42
}
π Copy as prompt
Upload a PDF to my Flapjack agent's knowledge base using curl with multipart form data. POST to
/api/knowledge/uploadwith the file, title, scopeType=agent, and scopeId.
List Documents
GET /api/knowledge?scopeType={type}&scopeId={id}
List knowledge documents for a given scope.
Query parameters:
| Param | Type | Required | Description |
|---|---|---|---|
scopeType | string | Yes | org, agent, or thread |
scopeId | string | Yes | UUID of the scope target |
curl "https://api.flapjack.dev/api/knowledge?scopeType=agent&scopeId=abc-123" \
-H "Authorization: Bearer fj_live_..."
Response 200:
[
{
"id": "doc-001",
"title": "Product Documentation",
"source_ref": "product-docs.pdf",
"chunk_count": 42,
"created_at": "2026-03-28T12:00:00Z"
}
]
Delete Document
DELETE /api/knowledge/{docId}
Delete a document and all its chunks.
curl -X DELETE https://api.flapjack.dev/api/knowledge/doc-001 \
-H "Authorization: Bearer fj_live_..."
Response 200:
{ "ok": true }
Next Steps
- Concepts: Knowledge β how RAG works
- SDK: Client β
uploadDocument,listDocuments,deleteDocument