File Download
Download endpoints allow you to retrieve generated PDF files.
ZIP Bulk Download
Endpoint Information
- URL:
https://api.re-port-flow.com/v1/file/download/{uuid} - Method:
GET - Authentication:
appkeyheader required
Usage Example
curl -X GET https://api.re-port-flow.com/v1/file/download/550e8400-e29b-41d4-a716-446655440000 \
-H "appkey: your-application-key" \
--output files.zip
JavaScript Example
async function downloadZip(uuid) {
const response = await axios.get(
`https://api.re-port-flow.com/v1/file/download/${uuid}`,
{
headers: {
'appkey': process.env.APP_KEY
},
responseType: 'arraybuffer'
}
);
fs.writeFileSync('files.zip', response.data);
return response.data;
}
Individual File Download
Endpoint Information
- URL:
https://api.re-port-flow.com/v1/file/download/{uuid}/{fileId} - Method:
GET - Authentication:
appkeyheader required
Usage Example
curl -X GET https://api.re-port-flow.com/v1/file/download/550e8400-e29b-41d4-a716-446655440000/file_123456 \
-H "appkey: your-application-key" \
--output invoice.pdf
JavaScript Example
async function downloadSingleFile(uuid, fileId) {
const response = await axios.get(
`https://api.re-port-flow.com/v1/file/download/${uuid}/${fileId}`,
{
headers: {
'appkey': process.env.APP_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