Create Knowledge Base
curl --request POST \
--url https://prod-api.ringg.ai/ca/api/v0/external/kb \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: <api-key>' \
--form 'kb_name=Product Documentation' \
--form files=@example-file \
--form 'urls=["https://example.com/docs", "https://example.com/faq"]' \
--form 'faqs=[{"question": "What is your return policy?", "answer": "30-day money back guarantee"}]'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/external/kb"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = {
"kb_name": "Product Documentation",
"urls": "[\"https://example.com/docs\", \"https://example.com/faq\"]",
"faqs": "[{\"question\": \"What is your return policy?\", \"answer\": \"30-day money back guarantee\"}]"
}
headers = {"X-API-KEY": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('kb_name', 'Product Documentation');
form.append('files', '<string>');
form.append('urls', '["https://example.com/docs", "https://example.com/faq"]');
form.append('faqs', '[{"question": "What is your return policy?", "answer": "30-day money back guarantee"}]');
const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>'}};
options.body = form;
fetch('https://prod-api.ringg.ai/ca/api/v0/external/kb', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "Knowledge Base creation initiated",
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"processing_status": "pending",
"files_queued": 3
}{
"message": "<string>"
}{
"message": "Invalid credentials"
}Create Knowledge Base
Create a knowledge base from files, web page URLs and FAQ pairs, processed in the background, then attach it to an agent so it can answer from that content.
POST
/
external
/
kb
Create Knowledge Base
curl --request POST \
--url https://prod-api.ringg.ai/ca/api/v0/external/kb \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-KEY: <api-key>' \
--form 'kb_name=Product Documentation' \
--form files=@example-file \
--form 'urls=["https://example.com/docs", "https://example.com/faq"]' \
--form 'faqs=[{"question": "What is your return policy?", "answer": "30-day money back guarantee"}]'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/external/kb"
files = { "files": ("example-file", open("example-file", "rb")) }
payload = {
"kb_name": "Product Documentation",
"urls": "[\"https://example.com/docs\", \"https://example.com/faq\"]",
"faqs": "[{\"question\": \"What is your return policy?\", \"answer\": \"30-day money back guarantee\"}]"
}
headers = {"X-API-KEY": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('kb_name', 'Product Documentation');
form.append('files', '<string>');
form.append('urls', '["https://example.com/docs", "https://example.com/faq"]');
form.append('faqs', '[{"question": "What is your return policy?", "answer": "30-day money back guarantee"}]');
const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>'}};
options.body = form;
fetch('https://prod-api.ringg.ai/ca/api/v0/external/kb', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"message": "Knowledge Base creation initiated",
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"processing_status": "pending",
"files_queued": 3
}{
"message": "<string>"
}{
"message": "Invalid credentials"
}The response returns its
kb_id with processing_status pending; poll Get knowledge base until status is completed, then attach it to an agent with the attach_kb operation of Edit agent settings.
Content
Sendkb_name and any mix of files, urls and faqs; each FAQ is a {"question", "answer"} object. One request takes up to 10 files (2 MB each, 5 MB in total) and 20 URLs.
Files are read by extension: PDF, DOCX, TXT, CSV (one entry per row) and JSON. Any other extension, such as .md, is read as plain text.
Knowledge bases created with the API are not listed on the dashboard’s Knowledge Base page. They do appear in the agent editor’s knowledge base picker and in Get all knowledge bases, which also lists the ones made in the dashboard.
curl --request POST "https://prod-api.ringg.ai/ca/api/v0/external/kb" \
--header "X-API-KEY: $RINGG_API_KEY" \
--form 'kb_name="Acme Lending FAQ"' \
--form 'urls="[\"https://example.com/faq\"]"' \
--form 'faqs="[{\"question\": \"Can I pay my EMI early?\", \"answer\": \"Yes, from the Acme app under Loans.\"}]"' \
--form "files=@loan-terms.pdf"
Authorizations
Headers
(Required) Your Ringg AI API key.
Example:
"rg_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Body
multipart/form-data
(Required) Name of the knowledge base
Example:
"Product Documentation"
(Optional) Files to upload (max 10 files, 2 MB each, 5 MB total). PDF, DOCX, TXT, CSV and JSON are parsed; other files are read as plain text.
(Optional) JSON string array of URLs to index (max 20 URLs)
Example:
"[\"https://example.com/docs\", \"https://example.com/faq\"]"
(Optional) JSON string array of FAQ objects
Example:
"[{\"question\": \"What is your return policy?\", \"answer\": \"30-day money back guarantee\"}]"
Was this page helpful?