Create Knowledge Source
POST/api/v1/knowledge-source/
Overview#
The Create Knowledge Source endpoint ingests content into an agent's knowledge base. Exactly one of urls, file or plain_text must be provided per request. After creation, the source enters Pending status and is queued for ingestion.
Request Header
Authorizationapi key
Your 7en API key. Example: Api-Key 43NKLN3LKN4nlkn
Content-Typestring
Use application/json for URL, plain_text, and Google Drive types. Use multipart/form-data for file uploads.
Source Types#
| Type | Field | Accepted Formats |
|---|---|---|
| URL | urls | Array of HTTP/HTTPS URLs |
| File upload | file | PDF, DOCX, TXT, MD, JSON, CSV, XLSX, XLS |
| Plain text | plain_text | Free-form string |
Request#
Request Body — Plain Text
agent_idintrequired
ID of specific agent. example: `42`
titlestringrequired
Title of knowledge source. example: `FAQ document`
plain_textstringrequired
Text content for knowledge source. example: `This is knowledge document`
Request Body — URL
agent_idintrequired
ID of specific agent. example: `42`
urlsarray of stringrequired
List of URLs to scrape and ingest. Example: ["https://help.acme.com/", "https://help.acme.com/faq"]
titlestringrequired
Human-readable label for the knowledge source. Example: "Help Center"
Request Body — File (multipart/form-data)
agent_idintrequired
ID of specific agent. example: `42`
filefilerequired
Binary file to upload. Supported formats: PDF, DOCX, TXT, CSV, XLSX. Max size: 10 MB. per upload.
titlestringrequired
Human-readable label for the knowledge source. Example: "Product Manual v3"
Error Responses#
400
{
"error": {
"code": "knowledge_source_validation_error",
"message": "File validation failed: File size (10.21 MB) exceeds maximum allowed size (10.0 MB)",
"status": 400
}
}Best Practices#
- One type at a time: Only provide one of
urls,file,plain_text, orgoogle_drive_file_idper request. - Retrain after adding: New sources are not automatically used by the agent. Call Retrain Agent after adding sources.
Request
curl -X POST 'https://api.7en.ai/api/v1/knowledge-source/' \
-H 'Authorization: Api-Key YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"agent_id": "{agent_id}",
"plain_text": "This is a",
"title": "Knowledge Base Articles"
}'Response201
{
"message": "1 knowledge source(s) created.",
"data": [
{
"id": 1148,
"urls": [
"https://example.com/knowledge-base",
"https://example.com/tutorials"
],
"file": null,
"plain_text": null,
"google_drive_file_id": null,
"title": "Knowledge Base Articles",
"status": "Pending",
"type": "website",
"agent_knowledge_folder": 591,
"parent_knowledge_source": null,
"metadata": {
"format": "url",
"file_size": null,
"no_of_rows": null,
"no_of_chars": null,
"no_of_pages": 2,
"upload_date": "2026-03-04T09:01:02.262151+00:00"
},
"owner": 193,
"is_selected": true,
"training_status": "Idle",
"sub_urls": null,
"total_training_usage_bytes": 0,
"max_training_usage_bytes": 51200,
"character_limit": 20
}
],
"subscription": {
"planName": "EU Sovereign",
"planId": "36",
"started_at": "2026-02-18T08:16:03+00:00",
"ended_at": "2026-03-18T08:16:03+00:00",
"cancelled_at": null,
"failed_at": null
},
"status": "success",
"permissions": [
"VIEW_KNOWLEDGE",
"VIEW_SETTINGS",
"VIEW_USERS",
"MANAGE_API_KEY",
"VIEW_AGENTS",
"MANAGE_KNOWLEDGE",
"VIEW_ANALYTICS",
"MANAGE_USERS",
"MANAGE_INTEGRATIONS",
"CONFIGURE_BUSINESS",
"MANAGE_CHAT",
"VIEW_CHAT",
"SEND_INVITE",
"VIEW_INTEGRATIONS",
"MANAGE_AGENTS",
"MANAGE_ADMIN",
"MANAGE_BILLING",
"VIEW_BILLING",
"TRAIN_AGENT",
"MANAGE_SETTINGS"
]
}