Overview
Returns a pre-signed S3 PUT URL so you can upload files directly to S3. This bypasses API Gateway’s 10MB limit and allows uploads up to 5GB.
Use this endpoint for large files (up to 5GB). The pre-signed URL flow avoids API Gateway size limits.
How It Works
Step 1: Get Pre-signed URL
Call this endpoint with your desired fileName to get the upload URL
Step 2: Upload File to S3
Use the uploadUrl with a PUT request, setting the Content-Type header to the contentType value from the response
Step 3: Automatic Processing
After upload, the file is automatically processed through the document pipeline
The pre-signed URL expires in 15 minutes. Upload your file before it expires.
Step 1: Get Pre-signed URL
Authentication
Your API key for authentication
Path Parameters
Name of the text namespace to upload files to
Body Parameters
Target filename including extension (e.g., document.pdf). Content-Type is auto-detected from the file extension.
curl -X POST "https://api.moorcheh.ai/v1/namespaces/my-documents/upload-url" \
-H "x-api-key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"fileName": "document.pdf"}'
{
"uploadUrl": "https://s3.us-east-1.amazonaws.com/...",
"key": "ownerId/namespace/document.pdf",
"contentType": "application/pdf",
"expiresIn": 900,
"method": "PUT",
"hint": "Upload the file with: PUT <uploadUrl> with header Content-Type: application/pdf and body = file bytes"
}
Response Fields
Pre-signed S3 URL for uploading the file via PUT request
S3 object key where the file will be stored
Content-Type header to use when uploading (auto-detected from fileName)
URL expiration time in seconds (default: 900 = 15 minutes)
HTTP method to use for upload (always PUT)
Human-readable instructions for uploading the file
Step 2: Upload File to S3
Use the uploadUrl from the response above to upload your file directly to S3.
curl -X PUT "<uploadUrl>" \
-H "Content-Type: <contentType>" \
--data-binary "@/path/to/document.pdf"
Supported File Types
Use the corresponding Content-Type when uploading:
| Extension | Content-Type |
|---|
.pdf | application/pdf |
.docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
.xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
.json | application/json |
.txt | text/plain |
.csv | text/csv |
.md | text/markdown |
S3 Upload Errors
<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
</Error>
If you receive the expired URL error, request a new pre-signed URL from Step 1.