post
/api/v2/knowledge-sourcesCreate a Knowledge Base source.
Creates a local note, URL, or file Knowledge Base source. URL sources index trusted pasted text when supplied; otherwise they attempt safe public page extraction with DNS/IP/port guards and no redirects. File sources index local text-compatible and supported OOXML/PDF text, with parser-gated formats retained as metadata.
Requires bearer API key
Parameters
X-Project-Id
header
Required for organization-wide API keys on project-scoped endpoints. Project-scoped keys infer the project automatically.
Schema: string
Request Body
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"type": "string",
"enum": [
"file",
"url",
"note"
]
},
"title": {
"type": "string"
},
"url": {
"type": "string"
},
"originalUrl": {
"type": "string"
},
"storagePath": {
"type": "string"
},
"mimeType": {
"type": "string"
},
"fileSizeBytes": {
"type": "integer"
},
"bodyText": {
"type": "string"
},
"text": {
"type": "string"
},
"note": {
"type": "string"
}
},
"required": [
"kind"
]
}Responses
201
Created Knowledge Base source.
application/json{
"type": "object",
"additionalProperties": true,
"properties": {
"id": {
"type": "string"
},
"projectId": {
"type": "string"
},
"kind": {
"type": "string",
"enum": [
"file",
"url",
"note"
]
},
"title": {
"type": "string"
},
"originalUrl": {
"type": "string",
"nullable": true
},
"storagePath": {
"type": "string",
"nullable": true
},
"mimeType": {
"type": "string",
"nullable": true
},
"fileSizeBytes": {
"type": "integer",
"nullable": true
},
"bodyText": {
"type": "string",
"nullable": true
},
"summary": {
"type": "string",
"nullable": true
},
"status": {
"type": "string",
"enum": [
"pending",
"extracting",
"ready",
"failed"
]
},
"failureReason": {
"type": "string",
"nullable": true
},
"addedAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"lastIndexedAt": {
"type": "string",
"format": "date-time",
"nullable": true
}
},
"required": [
"id",
"kind",
"title",
"status",
"addedAt",
"updatedAt"
]
}400
Error response.
application/json{
"type": "object",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
}Try it
Send this request to the local WatchLLM REST handler. Use a key from `/workspace/api`; organization keys can include `X-Project-Id` only when the endpoint documents that header.