curl --request PATCH \
--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_id=550e8400-e29b-41d4-a716-446655440000 \
--form 'files_to_remove=["7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d", "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e"]' \
--form 'urls_to_remove=["https://example.com/old-page"]' \
--form 'faqs_to_remove=["9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f", "0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a"]' \
--form new_files=@example-file \
--form 'new_urls=["https://example.com/new-docs"]' \
--form 'new_faqs=[{"question": "Do you ship internationally?", "answer": "Yes, worldwide shipping available"}]' \
--form 'new_files_metadata={}'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/external/kb"
files = { "new_files": ("example-file", open("example-file", "rb")) }
payload = {
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"files_to_remove": "[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\", \"8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e\"]",
"urls_to_remove": "[\"https://example.com/old-page\"]",
"faqs_to_remove": "[\"9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f\", \"0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a\"]",
"new_urls": "[\"https://example.com/new-docs\"]",
"new_faqs": "[{\"question\": \"Do you ship internationally?\", \"answer\": \"Yes, worldwide shipping available\"}]",
"new_files_metadata": "{}"
}
headers = {"X-API-KEY": "<api-key>"}
response = requests.patch(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('kb_id', '550e8400-e29b-41d4-a716-446655440000');
form.append('files_to_remove', '["7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d", "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e"]');
form.append('urls_to_remove', '["https://example.com/old-page"]');
form.append('faqs_to_remove', '["9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f", "0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a"]');
form.append('new_files', '<string>');
form.append('new_urls', '["https://example.com/new-docs"]');
form.append('new_faqs', '[{"question": "Do you ship internationally?", "answer": "Yes, worldwide shipping available"}]');
form.append('new_files_metadata', '{}');
const options = {method: 'PATCH', 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 edit initiated",
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"items_removed": 2,
"new_files_queued": 1,
"new_files": [
{
"filename": "document.pdf",
"file_id": "1e2f3a4b-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
"processing_status": "pending"
}
]
}{
"message": "<string>"
}{
"message": "Invalid credentials"
}{
"message": "<string>"
}Edit Knowledge Base
Add files, URLs or FAQs to a knowledge base and remove existing ones by ID in one request, keeping its kb_id and the agents it is attached to.
curl --request PATCH \
--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_id=550e8400-e29b-41d4-a716-446655440000 \
--form 'files_to_remove=["7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d", "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e"]' \
--form 'urls_to_remove=["https://example.com/old-page"]' \
--form 'faqs_to_remove=["9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f", "0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a"]' \
--form new_files=@example-file \
--form 'new_urls=["https://example.com/new-docs"]' \
--form 'new_faqs=[{"question": "Do you ship internationally?", "answer": "Yes, worldwide shipping available"}]' \
--form 'new_files_metadata={}'import requests
url = "https://prod-api.ringg.ai/ca/api/v0/external/kb"
files = { "new_files": ("example-file", open("example-file", "rb")) }
payload = {
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"files_to_remove": "[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\", \"8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e\"]",
"urls_to_remove": "[\"https://example.com/old-page\"]",
"faqs_to_remove": "[\"9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f\", \"0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a\"]",
"new_urls": "[\"https://example.com/new-docs\"]",
"new_faqs": "[{\"question\": \"Do you ship internationally?\", \"answer\": \"Yes, worldwide shipping available\"}]",
"new_files_metadata": "{}"
}
headers = {"X-API-KEY": "<api-key>"}
response = requests.patch(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('kb_id', '550e8400-e29b-41d4-a716-446655440000');
form.append('files_to_remove', '["7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d", "8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e"]');
form.append('urls_to_remove', '["https://example.com/old-page"]');
form.append('faqs_to_remove', '["9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f", "0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a"]');
form.append('new_files', '<string>');
form.append('new_urls', '["https://example.com/new-docs"]');
form.append('new_faqs', '[{"question": "Do you ship internationally?", "answer": "Yes, worldwide shipping available"}]');
form.append('new_files_metadata', '{}');
const options = {method: 'PATCH', 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 edit initiated",
"kb_id": "550e8400-e29b-41d4-a716-446655440000",
"items_removed": 2,
"new_files_queued": 1,
"new_files": [
{
"filename": "document.pdf",
"file_id": "1e2f3a4b-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
"processing_status": "pending"
}
]
}{
"message": "<string>"
}{
"message": "Invalid credentials"
}{
"message": "<string>"
}Add content
new_files: 2 MB each, 5 MB in total, with optionalnew_files_metadatanew_faqs: each FAQ is a{"question", "answer"}object
Remove content
Pass IDs from Get knowledge base. Removal is permanent.curl --request PATCH "https://prod-api.ringg.ai/ca/api/v0/external/kb" \
--header "X-API-KEY: $RINGG_API_KEY" \
--form 'kb_id="550e8400-e29b-41d4-a716-446655440000"' \
--form 'files_to_remove="[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\"]"' \
--form 'urls_to_remove="[\"https://example.com/old-page\"]"' \
--form 'new_urls="[\"https://example.com/new-docs\"]"'
Authorizations
Headers
(Required) Your Ringg AI API key.
"rg_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Body
(Required) ID of the knowledge base to edit
"550e8400-e29b-41d4-a716-446655440000"
(Optional) JSON string array of file IDs to remove
"[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\", \"8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e\"]"
(Optional) JSON string array of URLs to remove
"[\"https://example.com/old-page\"]"
(Optional) JSON string array of FAQ IDs to remove
"[\"9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f\", \"0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a\"]"
(Optional) Array of new files to upload
(Optional) JSON string array of new URLs to add
"[\"https://example.com/new-docs\"]"
(Optional) JSON string array of new FAQ objects
"[{\"question\": \"Do you ship internationally?\", \"answer\": \"Yes, worldwide shipping available\"}]"
(Optional) JSON string object with metadata for new files
"{}"
Was this page helpful?