File Download
These endpoints retrieve PDFs that have already been generated. Pass a requestId to download an entire request as a ZIP, or a requestId plus a fileId to fetch one PDF on its own. Both require authentication — either the appkey header or an OAuth 2.0 access token — and both are how you collect output after an async job finishes or a webhook arrives.
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');
}
FAQ
Should I download by requestId or by fileId?
To take everything from one request at once, pass only requestId and use
ZIP Bulk Download. When you need just one file out of the batch, pass
both requestId and fileId and use Individual File Download.
What should I do when I get a 404?
Either the requestId or fileId is wrong, or the file's retention period has expired.
Check the values, and if the file has expired, generate the PDF again from the original
request.
Next Steps
- Single PDF Async Generation - Generate files for download
- Multiple PDF Async Generation - Generate ZIP files for download
- Single PDF Sync Generation - How to generate a PDF file
- Multiple PDF Sync Generation (ZIP) - Generate multiple PDFs at once