English
English
Appearance
English
English
Appearance
https://api.repliz.com/public/knowledge/{knowledgeId}/sourceAdd a source to a knowledge: a text, questions and answers, one page of a website, or a file from Repliz Storage. The source is read in the background, so it comes back with status process. Check it with Get One Knowledge Source until it is ready, or error with an errorMessage. Reading takes a few seconds; a big file can take a minute.
Authorization: Basic Base64(AccessKey:SecretKey)) or Bearer token from Login with Replizknowledge:write| Parameter | Type | Required | Description |
|---|---|---|---|
knowledgeId | string | Yes | ID of the knowledge, the _id from Get Knowledge. |
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | text, faq, url, or file. |
name | string | No | Name of the source, cut to 60 characters. When left out: the first line of the text, FAQ, the page title, or the file name. |
text | string | For text | The text, up to 200,000 characters. |
faqs | array | For faq | 1 to 300 { "question", "answer" } pairs. Questions up to 500 characters, answers up to 5,000. |
url | string | For url | A public http or https page. Only this page is read, not the pages it links to. |
fileId | string | For file | ID of a file in Repliz Storage, the id from Init File after Complete File. A PDF, DOCX, TXT, or MD of up to 10 MB. |
| Type | What is read |
|---|---|
text | The text as you send it. Good for product details, policies, and prices. |
faq | Each question with its answer, kept together. Good for questions customers often ask. |
url | The main text of one page, without its menu, header, and footer. Up to 2 MB of HTML or plain text. Pages that need a login or are built only by JavaScript can come back empty. Read it again later with Refresh Knowledge Source. |
file | The text of a PDF, DOCX, TXT, or MD file. Scanned PDFs without a text layer give no text found. The file stays in Repliz Storage; you can remove it with Remove File once the source is ready. |
error with how many characters are left.localhost or 192.168.x.x, are refused.curl -X POST "https://api.repliz.com/public/knowledge/680affa5ce12f2f72916f67e/source" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{
"type": "url",
"url": "https://example.com/shipping"
}'import axios from 'axios';
const knowledgeId = '680affa5ce12f2f72916f67e';
const response = await axios.post(
`https://api.repliz.com/public/knowledge/${knowledgeId}/source`,
{
type: 'url',
url: 'https://example.com/shipping',
},
{
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY',
},
},
);
console.log(response.data);const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const knowledgeId = '680affa5ce12f2f72916f67e';
const response = await fetch(`https://api.repliz.com/public/knowledge/${knowledgeId}/source`, {
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'url',
url: 'https://example.com/shipping',
}),
});
const data = await response.json();
console.log(data);// text
{ "type": "text", "name": "Shipping", "text": "We ship every weekday. Orders before 2 PM go out the same day." }
// faq
{ "type": "faq", "faqs": [{ "question": "Do you ship abroad?", "answer": "Yes, to most countries." }] }
// file, uploaded with Init File and Complete File first
{ "type": "file", "fileId": "680affa5ce12f2f72916f680" }{
"_id": "680affa5ce12f2f72916f67f",
"type": "url",
"name": "",
"url": "https://example.com/shipping",
"status": "process",
"chars": 0,
"knowledgeId": "680affa5ce12f2f72916f67e",
"userId": "680affa5ce12f2f72916f600",
"createdAt": "2026-11-14T03:04:00.000Z",
"updatedAt": "2026-11-14T03:04:00.000Z",
"__v": 0
}{
"code": 400,
"message": "url points to a private or reserved address"
}
{
"code": 400,
"message": "file must be a PDF, DOCX, TXT, or MD"
}
{
"code": 400,
"message": "file upload is not complete"
}{
"code": 403,
"message": "a knowledge can hold up to 100 sources"
}
{
"code": 403,
"message": "all knowledge together can hold up to 5000000 characters"
}{
"code": 404,
"message": "knowledge not found"
}
{
"code": 404,
"message": "file not found"
}{
"code": 401,
"message": "unauthorized"
}