Skip to main content
POST
https://api.moorcheh.ai
/
v1
/
namespaces
/
{namespace_name}
/
upload-file
# Replace 'my-documents' with your namespace name
# Replace 'your-api-key-here' with your actual API key
# Replace '/path/to/document.pdf' with the actual path to your file

curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-documents/upload-file" \
  -H "x-api-key: your-api-key-here" \
  -F "file=@/path/to/document.pdf"
{
  "success": true,
  "message": "File uploaded successfully",
  "namespace": "my-namespace",
  "fileName": "document.pdf",
  "fileSize": 1048576
}

Overview

Upload files directly to a text namespace, enabling semantic search, similarity matching, and AI-powered question answering. The API automatically extracts text content from various file formats including PDF, DOCX, TXT, and more. Files are processed to generate embeddings using Amazon Bedrock for optimal search performance.
Files are automatically processed to extract text content and generate embeddings. Supported formats include PDF, DOCX, TXT, MD, CSV, and more.

Authentication

x-api-key
string
required
Your API key for authentication
Content-Type
string
required
Must be multipart/form-data for file uploads

Path Parameters

namespace_name
string
required
Name of the text namespace to upload files to

Request Body (multipart/form-data)

When testing with the “Try it” feature, you can either upload a file directly or specify a file path. In cURL commands, use -F "file=@/path/to/your/file.pdf" where @ indicates the file path on your system.
file
file
required
The file to upload (max 10MB). Must be one of the allowed file types: .pdf, .docx, .xlsx, .json, .txt, .csv, .md

Supported File Types

.pdf

PDF documents

.docx

Microsoft Word documents

.xlsx

Microsoft Excel spreadsheets

.json

JSON data files

.txt

Plain text files

.csv

CSV data files

.md

Markdown files
# Replace 'my-documents' with your namespace name
# Replace 'your-api-key-here' with your actual API key
# Replace '/path/to/document.pdf' with the actual path to your file

curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-documents/upload-file" \
  -H "x-api-key: your-api-key-here" \
  -F "file=@/path/to/document.pdf"
{
  "success": true,
  "message": "File uploaded successfully",
  "namespace": "my-namespace",
  "fileName": "document.pdf",
  "fileSize": 1048576
}

Response Fields

Success Response (200 OK)

success
boolean
Always true for successful uploads
message
string
Human-readable confirmation message
namespace
string
Name of the namespace the file was uploaded to
fileName
string
Original name of the uploaded file
fileSize
integer
Size of the uploaded file in bytes