LemuAI

Overview

Upload documents and search them for agent knowledge retrieval

The knowledge base stores documents your agents can retrieve from during a call. Uploading is a two-step flow: request a presigned upload URL, upload the file directly to storage, then trigger processing so the document is chunked and embedded for search.

MethodEndpointPurpose
POST/knowledge-base/upload-urlGet a presigned URL for uploading a document
POST/knowledge-base/process-documentTrigger processing (chunking and embedding) of an uploaded document
GET/knowledge-base/documentsList documents for the organization
GET/knowledge-base/documents/{document_uuid}Get details of a specific document
DELETE/knowledge-base/documents/{document_uuid}Soft delete a document and its chunks
POST/knowledge-base/searchSearch document chunks by similarity to a query

Documents move through pending → processing → completed or failed. Processing uses OpenAI's text-embedding-3-small model (1536-dimensional embeddings).

Upload and process a document#

curl -X POST https://app.lemuai.com/api/v1/knowledge-base/upload-url \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "filename": "refund-policy.pdf", "mime_type": "application/pdf" }'
{
  "upload_url": "https://storage.lemuai.com/kb/...",
  "document_uuid": "b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11",
  "s3_key": "org-7/kb/b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11/refund-policy.pdf"
}

Upload the file to upload_url with a PUT request, then trigger processing with the same document_uuid and s3_key:

curl -X POST https://app.lemuai.com/api/v1/knowledge-base/process-document \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "document_uuid": "b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11",
    "s3_key": "org-7/kb/b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11/refund-policy.pdf"
  }'
{
  "id": 18,
  "document_uuid": "b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11",
  "filename": "refund-policy.pdf",
  "file_size_bytes": 0,
  "file_hash": "",
  "mime_type": "application/octet-stream",
  "processing_status": "pending",
  "processing_error": null,
  "total_chunks": 0,
  "custom_metadata": { "s3_key": "org-7/kb/b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11/refund-policy.pdf" },
  "docling_metadata": {},
  "source_url": null,
  "created_at": "2026-08-20T10:00:00Z",
  "updated_at": "2026-08-20T10:00:00Z",
  "organization_id": 7,
  "created_by": 3,
  "is_active": true
}

Search chunks#

curl -X POST https://app.lemuai.com/api/v1/knowledge-base/search \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "query": "How do refunds work?", "limit": 5 }'
{
  "chunks": [
    {
      "id": 204,
      "document_id": 18,
      "chunk_text": "Refunds are issued within 5 business days...",
      "contextualized_text": null,
      "chunk_index": 3,
      "chunk_metadata": {},
      "filename": "refund-policy.pdf",
      "document_uuid": "b3f6c2b0-1e2a-4b6a-9c9a-9a9f7e2d4c11",
      "similarity": 0.87
    }
  ],
  "query": "How do refunds work?",
  "total_results": 1
}

© 2026 LemuAI. Built with our own docs platform.