Skip to main content
POST
https://api.myweave.ai
/
functions
/
v1
/
knowledge-handler
curl -X POST "https://api.myweave.ai/functions/v1/knowledge-handler?assistantId=asst_abc123&coachId=coach_xyz789" \
  -H "X-API-Key: your-api-key-here" \
  -F "files=@leadership_guide.pdf" \
  -F "files=@strategy_document.docx"
{
  "uploadedFiles": [
    {
      "fileId": "file_abc123",
      "filename": "leadership_guide.pdf",
      "size": 1048576,
      "contentType": "application/pdf",
      "uploadedAt": "2024-01-15T10:30:00Z",
      "category": "documents"
    }
  ],
  "failedFiles": [],
  "totalUploaded": 1,
  "totalFailed": 0
}

Overview

Manage a knowledge base for personas. Upload real human expertise, documents, and content to train personas with authentic knowledge for enhanced conversations.

Upload Files

Upload documents containing real human expertise to a persona’s knowledge base.

Request

assistantId
string
required
Assistant identifier
coachId
string
required
Persona identifier
files
file[]
required
Files to upload to knowledge base. Supports:
  • Documents: PDF, DOCX, TXT, MD
  • Images: JPG, PNG, GIF, WEBP
  • Videos: MP4, AVI, MOV, WEBM

Response

uploadedFiles
array
Successfully uploaded files with metadata
failedFiles
array
Files that failed to upload with error details
totalUploaded
number
Count of successfully uploaded files
totalFailed
number
Count of failed uploads
curl -X POST "https://api.myweave.ai/functions/v1/knowledge-handler?assistantId=asst_abc123&coachId=coach_xyz789" \
  -H "X-API-Key: your-api-key-here" \
  -F "files=@leadership_guide.pdf" \
  -F "files=@strategy_document.docx"
{
  "uploadedFiles": [
    {
      "fileId": "file_abc123",
      "filename": "leadership_guide.pdf",
      "size": 1048576,
      "contentType": "application/pdf",
      "uploadedAt": "2024-01-15T10:30:00Z",
      "category": "documents"
    }
  ],
  "failedFiles": [],
  "totalUploaded": 1,
  "totalFailed": 0
}

Search Files

Retrieve files from the knowledge base with optional search and filtering.

Query Parameters

assistantId
string
required
Assistant identifier
coachId
string
required
Persona identifier
Search term for file content and names
category
string
Filter by category: documents, images, or videos
page
integer
default:"1"
Page number for pagination (min: 1)
limit
integer
default:"20"
Files per page (min: 1, max: 100)
curl -X GET "https://api.myweave.ai/functions/v1/knowledge-handler?assistantId=asst_abc123&coachId=coach_xyz789&search=leadership&category=documents&limit=20" \
  -H "X-API-Key: your-api-key-here"

Delete File

Remove a file from the knowledge base.

Path Parameters

fileId
string
required
Unique file identifier

Query Parameters

assistantId
string
required
Assistant identifier
coachId
string
required
Persona identifier
curl -X DELETE "https://api.myweave.ai/functions/v1/knowledge-handler/file_abc123?assistantId=asst_abc123&coachId=coach_xyz789" \
  -H "X-API-Key: your-api-key-here"
{
  "message": "File deleted successfully",
  "fileId": "file_abc123"
}