Documentation
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:

FieldTypeRequiredDescription
fileFileYesThe document file (PDF, text, markdown, etc.)
titlestringYesDisplay title
scopeTypestringYesorg, agent, or thread
scopeIdstringYesUUID 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/upload with 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:

ParamTypeRequiredDescription
scopeTypestringYesorg, agent, or thread
scopeIdstringYesUUID 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

Docs last updated May 11, 2026