Skip to main content

External API

ollmo exposes API-key authenticated external endpoints for programmatic access to knowledge bases, search, and chat.

Authentication

All external API requests must carry the X-API-Key header:

curl -H "X-API-Key: <your-api-key>" \
http://localhost:8080/api/v1/external/knowledge-bases

API keys are created and revoked in the web UI under Settings → API Keys.

Endpoints

Base path: /api/v1/external

MethodPathDescription
GET/knowledge-basesList knowledge bases
POST/knowledge-basesCreate a knowledge base
GET/knowledge-bases/:kbIdKnowledge base details
PUT/knowledge-bases/:kbIdUpdate a knowledge base
DELETE/knowledge-bases/:kbIdDelete a knowledge base
GET/knowledge-bases/:kbId/documentsList documents
POST/knowledge-bases/:kbId/documentsUpload a document
POST/knowledge-bases/:kbId/searchHybrid search
GET/conversationsList conversations
POST/conversations/:id/messages/streamStreaming chat (SSE)
curl -X POST http://localhost:8080/api/v1/external/knowledge-bases/<kbId>/search \
-H "X-API-Key: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"query": "What file formats does ollmo support?", "top_k": 5}'

Example: streaming chat

curl -N -X POST http://localhost:8080/api/v1/external/conversations/<id>/messages/stream \
-H "X-API-Key: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"content": "hello"}'

The response is an SSE event stream, returning tokens incrementally.