What Does This Endpoint Do?
This endpoint allows you to upload files to WorqHat’s secure S3 storage. Think of it like uploading a file to Google Drive or Dropbox - you send a file and get back a unique ID and download URL that you can use later.When to Use Upload File
You’ll find this endpoint useful when you need to:- Store user documents: Upload PDFs, images, or other files from your users
- Backup application data: Save important files to secure cloud storage
- Share files: Upload files that need to be accessible via URLs
- Store media assets: Upload images, videos, or audio files for your application
- Archive data: Store files for long-term retention
- Process files: Upload files for AI processing or analysis
How It Works
- You send a file (binary data) to the endpoint
- You can optionally specify a custom path to organize your files
- The API stores the file in S3 and returns metadata including a unique ID
- You can use the returned ID to fetch or delete the file later
Code Examples
Example 1: Basic File Upload
This example shows how to upload a file with an auto-generated path.- Node.js
- Python
- Go
- cURL
Example 2: Upload with Custom Path
This example shows how to upload a file to a specific organized path.- Node.js
- Python
- Go
- cURL
Request Body Explained
The file to upload. This should be the actual file data (binary content). Maximum file size is 50MB.Supported file types include: PDF, images (JPG, PNG, GIF), documents (DOC, DOCX), spreadsheets (XLS, XLSX), and more.
Optional custom path within your organization’s storage. This helps organize your files into folders.Examples:
"documents/"
, "invoices/2025/"
, "user-uploads/images/"
If not provided, the file will be stored in the root of your organization’s storage.Response Fields Explained
true
if the upload was successful, false
otherwise.An object containing all the file metadata and information.
Unique identifier for the uploaded file. Use this ID to fetch or delete the file later.
The original name of the uploaded file.
The full path where the file is stored in your organization’s storage.
The size of the uploaded file in bytes.
The MIME type of the uploaded file (e.g., “application/pdf”, “image/jpeg”).
The timestamp when the file was uploaded (ISO 8601 format).
Direct URL to access the uploaded file. This URL is publicly accessible.
Example Response
Common Errors and How to Fix Them
Error | Cause | Solution |
---|---|---|
”File too large” | File exceeds 50MB limit | Compress the file or split it into smaller parts |
”Invalid file type” | File type is not supported | Use a supported file format |
”Missing file” | No file was provided in the request | Include a file in your request |
”Unauthorized” | Invalid or missing API key | Check that you’re using a valid API key |
”Storage quota exceeded” | Organization has reached storage limit | Contact support or upgrade your plan |
Tips for Successful Uploads
- Use organized paths to keep your files well-structured
- Check file size before uploading (50MB limit)
- Use appropriate file types for your use case
- Save the file ID for future reference and operations
- Consider file compression for large files
- Use meaningful filenames to make files easier to identify