Overview
Upload text documents to a text namespace, enabling semantic search, similarity matching, and AI-powered question answering. The API supports various formats and automatic text processing with metadata enrichment.
Documents are automatically processed to generate embeddings using Amazon Bedrock for optimal search performance.
Authentication
Your API key for authentication
Path Parameters
Name of the text namespace to upload documents to
Body Parameters
Array of document objects to upload
Document Object
Optional unique identifier for the document. Auto-generated if not provided.
The main text content of the document
Optional metadata object for filtering and organization
Single Document
Multiple Documents
curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-documents/documents" \
-H "Content-Type: application/json" \
-H "x-api-Key: your-api-key-here" \
-d '{
"documents": [
{
"text": "Machine learning is a subset of artificial intelligence that enables computers to learn and improve from experience without being explicitly programmed.",
"title": "Introduction to Machine Learning",
"metadata": {
"category": "education",
"difficulty": "beginner",
"author": "Dr. Smith"
}
}
]
}'
202 - Accepted
207 - Multi-Status
400 - Bad Request
401 - Unauthorized
403 - Forbidden
404 - Not Found
500 - Server Error
{
"status" : "success" ,
"message" : "2 documents uploaded successfully to namespace 'technical-docs'" ,
"upload_id" : "upload_1234567890" ,
"namespace_name" : "technical-docs" ,
"documents_processed" : 2 ,
"processing_status" : "in_progress" ,
"estimated_completion" : "2024-01-15T10:35:00Z" ,
"uploaded_documents" : [
{
"id" : "doc_001" ,
"status" : "processing" ,
"character_count" : 89
},
{
"id" : "doc_002" ,
"status" : "processing" ,
"character_count" : 112
}
]
}
Response Fields
Success Response (202)
Status of the upload (“success” for successful uploads)
Human-readable confirmation message
Unique identifier for tracking this upload batch
Name of the namespace where documents were uploaded
Number of documents successfully processed
Current status: “in_progress”, “completed”, or “failed”
Estimated ISO 8601 timestamp when processing will complete
Array of uploaded document status objects
Document Status Object
Processing status: “processing”, “completed”, or “failed”
Number of characters in the document text
Processing Pipeline
Upload Validation
Documents are validated for format, size, and content requirements
Text Processing
Content is cleaned, normalized, and prepared for embedding generation
Embedding Generation
High-quality embeddings are generated using Amazon Bedrock
Index Updates
Documents are added to the search index for immediate availability
Metadata Enrichment
Optional metadata processing and enrichment
Document Limits
Text Length Min: 10 characters
Max: 50,000 characters per document
Batch Size Max: 100 documents per request
Recommended: 25-50 documents for optimal performance
Metadata Size Max: 2KB per document
Keys: Up to 50 metadata keys
Processing Time Typical: 1-5 seconds per document
Large batches: 30-120 seconds
Best Practices
Optimal Document Structure
Keep documents focused on a single topic
Include meaningful titles and metadata
Use consistent metadata schemas across documents
Break large documents into logical chunks
Use Cases
Knowledge Base : Build searchable documentation and knowledge repositories
Content Management : Store and organize articles, blog posts, and content
Customer Support : Upload support documents for AI-powered assistance
Research : Organize and search through research papers and publications
Legal Documents : Store and search legal documents with metadata filtering
Training Materials : Upload educational content for learning applications