curl -X POST "https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789" \
-H "X-API-Key: your-api-key-here" \
-F "files=@leadership_guide.pdf" \
-F "files=@strategy_document.docx"
const formData = new FormData();
formData.append('files', file1);
formData.append('files', file2);
const response = await fetch(
'https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789',
{
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here'
},
body: formData
}
);
const result = await response.json();
console.log('Upload result:', result);
import requests
files = [
('files', ('leadership_guide.pdf', open('leadership_guide.pdf', 'rb'), 'application/pdf')),
('files', ('strategy_doc.docx', open('strategy_doc.docx', 'rb'), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))
]
url = "https://api.myweave.ai/functions/v1/knowledge-handler"
params = {
"coachId": "coach_xyz789"
}
headers = {"X-API-Key": "your-api-key-here"}
response = requests.post(url, params=params, headers=headers, files=files)
print(response.json())
{
"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
}
Persona Setup & Knowledge
Knowledge Management
Upload, search, and manage persona knowledge base files
POST
/
functions
/
v1
/
knowledge-handler
curl -X POST "https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789" \
-H "X-API-Key: your-api-key-here" \
-F "files=@leadership_guide.pdf" \
-F "files=@strategy_document.docx"
const formData = new FormData();
formData.append('files', file1);
formData.append('files', file2);
const response = await fetch(
'https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789',
{
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here'
},
body: formData
}
);
const result = await response.json();
console.log('Upload result:', result);
import requests
files = [
('files', ('leadership_guide.pdf', open('leadership_guide.pdf', 'rb'), 'application/pdf')),
('files', ('strategy_doc.docx', open('strategy_doc.docx', 'rb'), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))
]
url = "https://api.myweave.ai/functions/v1/knowledge-handler"
params = {
"coachId": "coach_xyz789"
}
headers = {"X-API-Key": "your-api-key-here"}
response = requests.post(url, params=params, headers=headers, files=files)
print(response.json())
{
"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
string
required
Persona identifier
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
array
Successfully uploaded files with metadata
array
Files that failed to upload with error details
number
Count of successfully uploaded files
number
Count of failed uploads
curl -X POST "https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789" \
-H "X-API-Key: your-api-key-here" \
-F "files=@leadership_guide.pdf" \
-F "files=@strategy_document.docx"
const formData = new FormData();
formData.append('files', file1);
formData.append('files', file2);
const response = await fetch(
'https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789',
{
method: 'POST',
headers: {
'X-API-Key': 'your-api-key-here'
},
body: formData
}
);
const result = await response.json();
console.log('Upload result:', result);
import requests
files = [
('files', ('leadership_guide.pdf', open('leadership_guide.pdf', 'rb'), 'application/pdf')),
('files', ('strategy_doc.docx', open('strategy_doc.docx', 'rb'), 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'))
]
url = "https://api.myweave.ai/functions/v1/knowledge-handler"
params = {
"coachId": "coach_xyz789"
}
headers = {"X-API-Key": "your-api-key-here"}
response = requests.post(url, params=params, headers=headers, files=files)
print(response.json())
{
"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
string
required
Persona identifier
string
Search term for file content and names
string
Filter by category:
documents, images, or videosinteger
default:"1"
Page number for pagination (min: 1)
integer
default:"20"
Files per page (min: 1, max: 100)
curl -X GET "https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789&search=leadership&category=documents&limit=20" \
-H "X-API-Key: your-api-key-here"
const response = await fetch(
'https://api.myweave.ai/functions/v1/knowledge-handler?coachId=coach_xyz789&search=leadership&category=documents&limit=20',
{
method: 'GET',
headers: {
'X-API-Key': 'your-api-key-here'
}
}
);
const searchResults = await response.json();
console.log(searchResults);
Delete File
Remove a file from the knowledge base.Path Parameters
string
required
Unique file identifier
Query Parameters
string
required
Persona identifier
curl -X DELETE "https://api.myweave.ai/functions/v1/knowledge-handler/file_abc123?coachId=coach_xyz789" \
-H "X-API-Key: your-api-key-here"
const response = await fetch(
'https://api.myweave.ai/functions/v1/knowledge-handler/file_abc123?coachId=coach_xyz789',
{
method: 'DELETE',
headers: {
'X-API-Key': 'your-api-key-here'
}
}
);
const result = await response.json();
console.log(result);
{
"message": "File deleted successfully",
"fileId": "file_abc123"
}
Was this page helpful?

