Skip to main content
POST
Upload a raw document to a given assistant

Overview

Upload a document to your AI assistant’s knowledge base. This endpoint uploads the document to Ragie (AI knowledge platform), saves it to your database, and optionally links it to a specific AI assistant through folder association. Perfect for programmatically building and maintaining your AI assistant’s knowledge base with custom content.

Use Cases

  • Knowledge Base Building: Programmatically add content to AI assistants
  • Content Sync: Import content from external systems (CMS, wikis, etc.)
  • Bulk Upload: Upload multiple documents via API
  • Dynamic Content: Add generated or user-submitted content
  • Documentation Updates: Keep AI knowledge up-to-date with latest docs
  • Multi-language Content: Upload translations and localized content

Authentication

This endpoint requires authentication using an API key. Include your API key in the request header:

Request Body

External ID: Use a unique identifier from your system to track documents. This is used for updates and deletions.

What Happens When You Upload

  1. Upload to Ragie: Document content is uploaded to Ragie AI platform
  2. Save to Database: Document metadata saved with folder association
  3. Link to Assistant: If assistantId provided, folder is linked to that assistant
  4. AI Processing: Ragie processes the document for AI retrieval

Response Structure

Ragie Document Object

Saved Document Object

Example Request

Example Response

Common Use Cases

1. Upload FAQ Document

2. Bulk Upload Documents

4. Sync from External CMS

Content Format

The content field accepts plain text or markdown: Plain Text:
Markdown:
HTML (converted to text):
The AI will process any format and make it searchable.

External ID

The externalId is YOUR identifier for the document:
  • Must be unique within your organization
  • Used for updates and deletions
  • Can be any string (e.g., "doc-123", "cms-article-456")
  • Helps you track which documents you’ve uploaded

Error Responses

Important Notes

  • Required Subscription: This endpoint requires an active subscription
  • Ragie Processing: Documents are processed asynchronously by Ragie
  • External ID Tracking: Use consistent external IDs for updates/deletes
  • Folder Required: Must specify a valid folder ID
  • Content Limit: Very large documents may be rejected (keep under 1MB)
  • Assistant Linking: Folder linked to assistant, not individual document

Best Practices

1. Use Descriptive External IDs

2. Organize with Icons

3. Handle Errors

Headers

x-api-key
string
required

API key needed to authorize the request

Body

application/json

The content of the document, the name of the file, the external id, folder id, optional assistant id and icon.

content
string
required
Minimum string length: 1
fileName
string
required
Minimum string length: 1
externalId
string
required
Minimum string length: 1
folderId
string<uuid>
required
Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
assistantId
string<uuid>
Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
icon
string
Maximum string length: 50

Response

Document created successfully.