Skip to main content
PATCH
/
external
/
kb
Edit Knowledge Base
curl --request PATCH \
  --url https://prod-api.revenueable.ai/ca/api/v0/external/kb \
  --header 'Content-Type: multipart/form-data' \
  --header 'X-API-KEY: <x-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=<string>' \
  --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={}' \
  --form new_files.items='@example-file'
{
  "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"
    }
  ]
}

Edit Knowledge Base

Update an existing knowledge base by adding new content or removing existing files, URLs, and FAQs. This endpoint allows you to maintain and refine your knowledge base over time.
Rate Limits:
  • Maximum 20 requests per hour per workspace
  • File size limit: 2 MB per file, 5 MB total

Adding Content

Add new files, URLs, or FAQs to expand your knowledge base:
  • new_files: Upload additional documents
  • new_urls: Index new web pages
  • new_faqs: Add more question-answer pairs

Removing Content

Remove outdated or incorrect content using IDs:
  • files_to_remove: JSON array of file IDs
  • urls_to_remove: JSON array of URLs
  • faqs_to_remove: JSON array of FAQ IDs

Example Removal

{
  "files_to_remove": "[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\"]",
  "urls_to_remove": "[\"https://example.com/old-page\"]",
  "faqs_to_remove": "[\"9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f\"]"
}
Get Content IDs: Use Get Knowledge Base by ID to retrieve file IDs, URLs, and FAQ IDs before removing them.

Response Details

The response includes:
  • items_removed: Count of items successfully removed
  • new_files_queued: Count of new files being processed
  • new_files: Array of newly added files with their IDs and processing status

Important Notes

  • Atomic Operations: Additions and removals are processed together
  • Processing Time: New content is processed asynchronously
  • No Rollback: Removals are permanent - ensure you have the correct IDs

Headers

X-API-KEY
string
required

(Required) Your Revenueable AI API key.

Example:

"7251cb4b-3373-43a4-844c-b27a1d45e0c9"

Body

multipart/form-data
kb_id
string
required

(Required) ID of the knowledge base to edit

Example:

"550e8400-e29b-41d4-a716-446655440000"

files_to_remove
string

(Optional) JSON string array of file IDs to remove

Example:

"[\"7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d\", \"8b9c0d1e-2f3a-4b5c-6d7e-8f9a0b1c2d3e\"]"

urls_to_remove
string

(Optional) JSON string array of URLs to remove

Example:

"[\"https://example.com/old-page\"]"

faqs_to_remove
string

(Optional) JSON string array of FAQ IDs to remove

Example:

"[\"9c0d1e2f-3a4b-5c6d-7e8f-9a0b1c2d3e4f\", \"0d1e2f3a-4b5c-6d7e-8f9a-0b1c2d3e4f5a\"]"

new_files
file[]

(Optional) Array of new files to upload

new_urls
string

(Optional) JSON string array of new URLs to add

Example:

"[\"https://example.com/new-docs\"]"

new_faqs
string

(Optional) JSON string array of new FAQ objects

Example:

"[{\"question\": \"Do you ship internationally?\", \"answer\": \"Yes, worldwide shipping available\"}]"

new_files_metadata
string

(Optional) JSON string object with metadata for new files

Example:

"{}"

Response

Knowledge base updated successfully.

message
string
Example:

"Knowledge Base edit initiated"

kb_id
string
Example:

"550e8400-e29b-41d4-a716-446655440000"

items_removed
integer
Example:

2

new_files_queued
integer
Example:

1

new_files
object[]