Integration
REST and MCP API
This guide shows how to drive knowmind from your own applications. Two interfaces are available: REST for classic back-end integrations and MCP (JSON-RPC 2.0 over HTTP) for AI tools.
Prerequisites
- knowmind account on Business API or Enterprise (for personal API tokens and 60+ requests per minute)
- API token of the form kmt_… (see: Create an API token)
- TLS-capable HTTP client in your language of choice
Two interfaces, one token
Steps
- 1
Endpoint and authentication
All requests go to
https://knowmind.de. Authentication is via theAuthorization: Bearer kmt_…header.textREST: https://knowmind.de/api/v1/... MCP: https://knowmind.de/api/mcp/v1 Auth: Authorization: Bearer kmt_…Outcome:
curl -H "Authorization: Bearer kmt_…" https://knowmind.de/api/healthreturns a success message. - 2
REST example: search and store
curl:
bash# Search curl -X POST https://knowmind.de/api/v1/memory/recall \ -H "Authorization: Bearer kmt_…" \ -H "Content-Type: application/json" \ -d '{ "query": "Who is the onboarding contact?", "k": 5, "hops": 2, "use_graph": true }' # Create a memory curl -X POST https://knowmind.de/api/v1/memory/entries \ -H "Authorization: Bearer kmt_…" \ -H "Content-Type: application/json" \ -d '{ "memory_type": "semantic", "title": "QM training mandatory", "content": "All service staff complete the QM training annually.", "tags": ["qm", "training"], "source": "internal-handbook" }'TypeScript (Node 20+):
tsconst TOKEN = process.env.KNOWMIND_TOKEN!; const BASE = "https://knowmind.de/api/v1"; async function recall(query: string, k = 5) { const r = await fetch(`${BASE}/memory/recall`, { method: "POST", headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ query, k, hops: 2, use_graph: true }), }); if (!r.ok) throw new Error(`recall failed: ${r.status}`); return r.json(); } const hits = await recall("Who drafted the Müller contract?"); console.log(hits);Python:
pythonimport os, requests TOKEN = os.environ["KNOWMIND_TOKEN"] BASE = "https://knowmind.de/api/v1" HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"} def recall(query: str, k: int = 5) -> dict: r = requests.post( f"{BASE}/memory/recall", headers=HEADERS, json={"query": query, "k": k, "hops": 2, "use_graph": True}, timeout=10, ) r.raise_for_status() return r.json() print(recall("GDPR training mandatory?")) - 3
MCP example: JSON-RPC 2.0
MCP calls are JSON-RPC 2.0 requests against
/api/mcp/v1. By default the response is a single JSON object. If you need Streamable HTTP (for native custom connectors), setAccept: text/event-stream.bash# List tools curl -X POST https://knowmind.de/api/mcp/v1 \ -H "Authorization: Bearer kmt_…" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' # Call recall curl -X POST https://knowmind.de/api/mcp/v1 \ -H "Authorization: Bearer kmt_…" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "knowmind.recall", "arguments": { "query": "When is the next quarterly report due?", "k": 5 } } }'Outcome: The response is a JSON-RPC response object with
result(success) orerror(failure). - 4
Respect rate limits
Business API plan: 60 requests per minute. Enterprise: 600. Excess returns HTTP 429 with a
Retry-Afterheader in seconds.Build a backoff mechanism in your client that reads
Retry-After, waits the specified seconds (with jitter) and retries up to three times.
Verify the result
The integration is healthy when all three conditions hold:
GET /api/healthwith a valid bearer token returns HTTP 200 with service status.- A
POST /api/v1/memory/recallwith a known question returns at least one hit. - In the knowmind dashboard under API Tokens, the "last used" timestamp updates after a call.
Troubleshooting
| Error message | Cause | Resolution |
|---|---|---|
| 401 Unauthorized | Missing token, revoked token, or typo in the header. | Check the token in the dashboard. Header format: Authorization: Bearer kmt_… with a space between Bearer and the token. |
| 403 Forbidden | Token does not have the required scope (write is needed for creation). | Edit the token scope in the dashboard or create a new token with read and write. |
| 429 Too Many Requests | Rate limit exceeded (60/min on Business API). | Parse the Retry-After header, back off, and consider Enterprise for 600 req/min. |
| 422 Unprocessable Entity on /memory/entries | Required field missing or memory_type outside the enum. | Required fields: memory_type, title, content. Valid types: semantic, episodic, procedural, reference, working, entity. |
| 504 Gateway Timeout on long uploads | Documents larger than 10,000 characters are processed as a background job. | The response contains job_id. Poll GET /api/v1/jobs/{id} until status: ready. |