Upload Source
Upload documents to your project via the GraphorLM REST API
The Upload Source endpoint allows you to programmatically upload documents to your GraphorLM project using the REST API. This enables integration with external applications, automated workflows, and custom document ingestion pipelines.
Endpoint Overview
HTTP Method
POST
Endpoint URL
Authentication
This endpoint requires authentication using an API token. You must include your API token as a Bearer token in the Authorization header.
Learn how to create and manage API tokens in the API Tokens guide.
Request Format
Headers
Header | Value | Required |
---|---|---|
Authorization | Bearer YOUR_API_TOKEN | ✅ Yes |
Content-Type | multipart/form-data | ✅ Yes |
Request Body
The request must be sent as multipart/form-data
with the following field:
Field | Type | Description | Required |
---|---|---|---|
file | File | The document file to upload | ✅ Yes |
File Requirements
Supported File Types
Supported File Types
GraphorLM supports a wide range of document formats:
Documents: PDF, DOC, DOCX, ODT, TXT, TEXT, MD, HTML, HTM
Presentations: PPT, PPTX
Spreadsheets: CSV, TSV, XLS, XLSX
Images: PNG, JPG, JPEG, TIFF, BMP, HEIC
Audio: MP3, WAV, M4A, OGG, FLAC
Video: MP4, MOV, AVI, MKV, WEBM
File Size Limits
File Size Limits
Maximum file size: 100MB per file
For larger files, consider:
- Compressing the file if possible
- Splitting large documents into smaller sections
- Using file optimization tools before upload
File Name Requirements
File Name Requirements
- File must have a valid filename with extension
- Extension determines the processing method
- File names should be descriptive for easy identification
Response Format
Success Response (200 OK)
Response Fields
Field | Type | Description |
---|---|---|
status | string | Processing status (New , Processing , Completed , Failed ) |
message | string | Human-readable success message |
file_name | string | Name of the uploaded file |
file_size | integer | Size of the file in bytes |
file_type | string | File extension/type |
file_source | string | Source type (always “local file” for uploads) |
project_id | string | UUID of the target project |
project_name | string | Name of the target project |
partition_method | string | Document processing method used |
Code Examples
JavaScript/Node.js
Python
cURL
PHP
Error Responses
Common Error Codes
Status Code | Error Type | Description |
---|---|---|
400 | Bad Request | Invalid file type, missing filename, or malformed request |
401 | Unauthorized | Invalid or missing API token |
403 | Forbidden | Access denied to the specified project |
404 | Not Found | Project not found |
413 | Payload Too Large | File exceeds 100MB limit |
500 | Internal Server Error | Server-side processing error |
Error Response Format
Error Examples
Unsupported File Type (400)
Unsupported File Type (400)
Invalid API Token (401)
Invalid API Token (401)
File Too Large (413)
File Too Large (413)
Document Processing
After a successful upload, GraphorLM automatically processes your document:
Processing Stages
- Upload Complete - File is securely stored in your project
- Text Extraction - Content is extracted using advanced OCR and parsing
- Structure Recognition - Document elements are identified and classified
- Ready for Use - Document is available for chunking and retrieval
Processing Methods
The system automatically selects the optimal processing method based on file type:
File Type | Default Method | Description |
---|---|---|
PDF, Documents | Basic | Fast processing with heuristic classification |
Images | OCR | Optical character recognition for text extraction |
Text files | Basic | Direct text processing |
Spreadsheets | Basic | Table structure preservation |
You can reprocess documents with different methods using the Process Source endpoint after upload.
Best Practices
File Preparation
- Optimize file size: Compress large files when possible while maintaining quality
- Use descriptive names: Include relevant keywords in filenames for easy identification
- Check file integrity: Ensure files are not corrupted before upload
Error Handling
- Implement retry logic: Handle temporary network issues with exponential backoff
- Validate before upload: Check file types and sizes client-side before making requests
- Monitor upload status: Use the response to track processing progress
Security
- Protect API tokens: Never expose tokens in client-side code or public repositories
- Use HTTPS only: All API requests are automatically secured with TLS encryption
- Rotate tokens regularly: Update API tokens periodically for enhanced security
Integration Examples
Batch Upload Script
Upload with Progress Tracking
Troubleshooting
Upload timeouts
Upload timeouts
Causes: Large files, slow connection, or server load
Solutions:
- Increase request timeout (recommend 5+ minutes for large files)
- Retry failed uploads with exponential backoff
- Consider compressing large files before upload
File processing failures
File processing failures
Causes: Corrupted files, unsupported formats, or complex layouts
Solutions:
- Verify file integrity before upload
- Try converting to a more standard format
- Use the Process Source endpoint with different methods
Authentication issues
Authentication issues
Causes: Invalid tokens, expired tokens, or incorrect headers
Solutions:
- Verify token format starts with “grlm_”
- Check token hasn’t been revoked in the dashboard
- Ensure correct Authorization header format
Network connectivity
Network connectivity
Causes: DNS issues, firewall restrictions, or network timeouts
Solutions:
- Test connectivity to sources.graphorlm.com
- Check firewall allows outbound HTTPS traffic
- Use appropriate timeout values for your network
Next Steps
After successfully uploading your documents:
Process Source
Reprocess documents with different parsing methods for optimal results
List Sources
Retrieve information about all uploaded documents in your project
Chunking
Learn how to optimize document segmentation for your RAG pipeline
Delete Source
Remove documents that are no longer needed from your project