Async Multiple PDF Generation (ZIP)
The POST /file/async/multiple endpoint generates multiple PDF files asynchronously from the specified design and multiple parameters, and saves them as a ZIP file.
Endpoint Information
- URL:
https://api.re-port-flow.com/v1/file/async/multiple - Method:
POST - Authentication:
appkeyheader required - Timeout: None (async processing)
- Request Size Limit: 50MB (Base64-encoded; ~37MB raw equivalent)
Usage Examples
cURL
curl -X POST https://api.re-port-flow.com/v1/file/async/multiple \
-H "appkey: your-application-key" \
-H "Content-Type: application/json" \
-d '{
"designId": "550e8400-e29b-41d4-a716-446655440000",
"version": 1,
"contents": [
{
"fileName": "invoice_001.pdf",
"shareType": "01",
"passcodeEnabled": false,
"params": { "customerName": "John Doe", "invoiceNumber": "INV-001" }
},
{
"fileName": "invoice_002.pdf",
"shareType": "01",
"passcodeEnabled": false,
"params": { "customerName": "Jane Smith", "invoiceNumber": "INV-002" }
}
]
}'
JavaScript
async function generateMultiplePDFsAsync(designId, contents) {
const response = await axios.post(
`https://api.re-port-flow.com/v1/file/async/multiple`,
{
designId,
version: 1,
contents
},
{
headers: {
'appkey': process.env.APP_KEY
}
}
);
const { requestId, url, files } = response.data;
console.log('ZIP generation started:', { requestId, url, files });
return { requestId, url, files };
}
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
designId | string (UUID) | ✓ | Design ID |
version | integer | ✓ | Version number |
contents | array | ✓ | Array of ContentDto (minimum 1 item) |
contents[].fileName | string | ✓ | File name (anything except / \ : * ? " < > | and control characters is allowed; must be unique within the array, case-insensitive) |
contents[].shareType | string | - | Share type (request side uses numeric codes). "01" = workspace share (default) / "02" = invited-only / "03" = public URL share. The response share.shareType returns the human-readable name. |
contents[].passcodeEnabled | boolean | - | Enable passcode protection (default: false). |
contents[].passthrough | object | - | Per-file arbitrary metadata echoed back in files[].passthrough. |
contents[].params | object | ✓ | Parameters (check structure via Design Parameters API) |
Response
Success (202 Accepted)
{
"requestId": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://api.re-port-flow.com/v1/file/download/{requestId}",
"files": [
{
"fileName": "invoice_001.pdf",
"fileId": "aaa111",
"share": {
"shareType": "workspace",
"url": "https://app.re-port-flow.com/file/{requestId}/aaa111",
"passcodeEnabled": false
}
},
{
"fileName": "invoice_002.pdf",
"fileId": "bbb222",
"share": {
"shareType": "workspace",
"url": "https://app.re-port-flow.com/file/{requestId}/bbb222",
"passcodeEnabled": false
}
}
]
}
| Field | Type | Description |
|---|---|---|
requestId | string (UUID) | Request ID (used with the download endpoint) |
url | string (URI) | ZIP download URL |
files | array | Information for each generated PDF file |
files[].fileName | string | PDF file name |
files[].fileId | string | Individual file ID (used with individual download endpoint) |
files[].passthrough | object | Value of contents[].passthrough from the request (only when specified) |
files[].share.shareType | string | Share type (workspace / invited / public) |
files[].share.url | string | File view URL |
files[].share.passcodeEnabled | boolean | Passcode enabled flag |
files[].share.passcode | string | Server-generated passcode (only when passcodeEnabled=true, immediately after generation) |
Error Responses
Same error responses as Sync Single PDF Generation, plus the following:
400 Bad Request (duplicate fileName)
{
"statusCode": 400,
"message": [
"Duplicate fileName found in contents (case-insensitive). Each file must have a unique name."
],
"error": "Bad Request"
}
Cause: Multiple entries in contents share the same fileName (including case-insensitive matches).
Use Cases
Bulk Invoice Generation
async function generateBulkInvoices(invoices) {
const batchSize = 100;
const batches = chunkArray(invoices, batchSize);
const results = [];
for (const [index, batch] of batches.entries()) {
console.log(`Processing batch ${index + 1}/${batches.length}...`);
const contents = batch.map(invoice => ({
fileName: `invoice_${invoice.number}.pdf`,
shareType: '01',
passcodeEnabled: false,
params: invoice
}));
const result = await generateMultiplePDFsAsync('template-id', contents);
results.push(result);
// Rate limiting
if (index < batches.length - 1) {
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
return results;
}
Next Steps
- Bulk ZIP Download - How to download generated ZIP files
- Async Workflows - Best practices for bulk generation