What Does This Endpoint Do?
This endpoint allows you to retrieve a file that you previously uploaded to WorqHat storage. Think of it like getting a file from a secure locker - you provide the unique key (file ID) and get back the file information and a way to access it.When to Use Fetch File by ID
You’ll find this endpoint useful when you need to:- Retrieve uploaded files: Get files that were previously uploaded
- Generate download links: Create temporary URLs for file downloads
- Check file metadata: Get information about file size, type, and upload date
- Verify file existence: Check if a file still exists in storage
- Build file management systems: Create interfaces for users to access their files
- Process stored files: Retrieve files for AI processing or analysis
How It Works
- You provide the file ID (obtained when you uploaded the file)
- The API looks up the file in your organization’s storage
- The API returns file metadata and a signed download URL
- You can use the download URL to access the file (URL expires in 1 hour)
Code Examples
Example 1: Basic File Retrieval
This example shows how to fetch a file using its ID.- Node.js
- Python
- Go
- cURL
Example 2: File Retrieval with Download
This example shows how to fetch a file and then download it.- Node.js
- Python
- Go
- cURL
Request Parameters
The unique identifier of the file to retrieve. This is the ID that was returned when you uploaded the file.Example:
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"Response Fields Explained
true if the file was retrieved successfully, false otherwise.An object containing all the file metadata and information.
The unique identifier of the file.
The original name of the file when it was uploaded.
The full path where the file is stored in your organization’s storage.
The size of the file in bytes.
The MIME type of the file (e.g., “application/pdf”, “image/jpeg”).
The timestamp when the file was originally uploaded (ISO 8601 format).
A signed URL for downloading the file. This URL expires in 1 hour and provides secure access to the file.
Example Response
Common Errors and How to Fix Them
| Error | Cause | Solution |
|---|---|---|
| ”File not found” | The file ID doesn’t exist or has been deleted | Check that the file ID is correct and the file still exists |
| ”Invalid file ID” | The file ID format is incorrect | Use a valid UUID format for the file ID |
| ”Unauthorized” | Invalid or missing API key | Check that you’re using a valid API key |
| ”File access denied” | You don’t have permission to access this file | Ensure the file belongs to your organization |
Tips for Successful File Retrieval
- Save file IDs when you upload files so you can retrieve them later
- Use the download URL quickly as it expires in 1 hour
- Check file existence before trying to download large files
- Handle errors gracefully when files might have been deleted
- Consider caching file metadata for frequently accessed files
- Use appropriate file types based on the content type returned

