File Download
Download endpoints allow you to retrieve generated PDF files.
ZIP Bulk Download
Endpoint Information
- URL:
https://{workspaceId}.re-port-flow.com/v1/file/download/{uuid} - Method:
GET - Authentication: Requires AppKey and SecretKey
Usage Example
curl -X GET https://your-workspace-id.re-port-flow.com/v1/file/download/550e8400-e29b-41d4-a716-446655440000 \
-H "AppKey: your-app-key" \
-H "SecretKey: your-secret-key" \
--output files.zip
JavaScript Example
async function downloadZip(uuid) {
const response = await axios.get(
`https://${process.env.WORKSPACE_ID}.re-port-flow.com/v1/file/download/${uuid}`,
{
headers: {
'AppKey': process.env.APP_KEY,
'SecretKey': process.env.SECRET_KEY
},
responseType: 'arraybuffer'
}
);
fs.writeFileSync('files.zip', response.data);
return response.data;
}
Individual File Download
Endpoint Information
- URL:
https://{workspaceId}.re-port-flow.com/v1/file/download/{uuid}/{fileId} - Method:
GET - Authentication: Requires AppKey and SecretKey
Usage Example
curl -X GET https://your-workspace-id.re-port-flow.com/v1/file/download/550e8400-e29b-41d4-a716-446655440000/file_123456 \
-H "AppKey: your-app-key" \
-H "SecretKey: your-secret-key" \
--output invoice.pdf
JavaScript Example
async function downloadSingleFile(uuid, fileId) {
const response = await axios.get(
`https://${process.env.WORKSPACE_ID}.re-port-flow.com/v1/file/download/${uuid}/${fileId}`,
{
headers: {
'AppKey': process.env.APP_KEY,
'SecretKey': process.env.SECRET_KEY
},
responseType: 'arraybuffer'
}
);
const returnedFileId = response.headers['file-id'];
console.log('Downloaded file ID:', returnedFileId);
return response.data;
}
Error Handling
404 Not Found
Cause:
- Specified UUID or fileId does not exist
- File retention period has expired
Solution:
- Verify UUID/fileId is correct
- Generate file again if expired
Best Practices
1. Download Immediately After Generation
Generated files have a limited retention period. Download immediately after async generation completes.
2. Verify File ID
Check the File-ID header to verify you downloaded the correct file.
const fileId = response.headers['file-id'];
if (fileId !== expectedFileId) {
throw new Error('Downloaded wrong file');
}
Next Steps
- Async Single PDF - Generate files for download
- Async Multiple PDFs - Generate ZIP files for download