What Does This Endpoint Do?
This endpoint allows you to retrieve a file using its path instead of its ID. Think of it like finding a file in a folder by its location - you provide the path to the file and get back the file information and a way to access it.When to Use Fetch File by Path
You’ll find this endpoint useful when you need to:- Retrieve files by location: Get files when you know their path but not their ID
- Access organized files: Retrieve files from specific folders you created
- Build file browsers: Create interfaces that navigate by folder structure
- Process files by category: Get files from specific organizational paths
- Backup and restore: Retrieve files from known backup locations
- Organize file access: Access files based on your organizational structure
How It Works
- You provide the file path (the path where the file is stored)
- The API looks up the file in your organization’s storage using the path
- 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 by Path
This example shows how to fetch a file using its path.- Node.js
- Python
- Go
- cURL
Example 2: Retrieve Files from Organized Structure
This example shows how to fetch files from different organizational paths.- Node.js
- Python
- Go
- cURL
Request Parameters
The path to the file within your organization’s storage. This should match the path structure you used when uploading the file.Examples:
"documents/invoice.pdf"
"invoices/2025/january/invoice_001.pdf"
"user-uploads/images/profile.jpg"
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 path doesn’t exist | Check that the file path is correct and the file exists |
”Invalid path format” | The path format is incorrect | Use proper path format without leading slashes |
”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 by Path
- Use consistent path structures when uploading files
- Remember the exact path used during upload
- Use organized folder structures for better file management
- Handle missing files gracefully as paths might change
- Consider using file IDs for more reliable file access
- Document your path conventions for team consistency