Skip to main content

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: appkey header 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

FieldTypeRequiredDescription
designIdstring (UUID)Design ID
versionintegerVersion number
contentsarrayArray of ContentDto (minimum 1 item)
contents[].fileNamestringFile name (anything except / \ : * ? " < > | and control characters is allowed; must be unique within the array, case-insensitive)
contents[].shareTypestring-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[].passcodeEnabledboolean-Enable passcode protection (default: false).
contents[].passthroughobject-Per-file arbitrary metadata echoed back in files[].passthrough.
contents[].paramsobjectParameters (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
}
}
]
}
FieldTypeDescription
requestIdstring (UUID)Request ID (used with the download endpoint)
urlstring (URI)ZIP download URL
filesarrayInformation for each generated PDF file
files[].fileNamestringPDF file name
files[].fileIdstringIndividual file ID (used with individual download endpoint)
files[].passthroughobjectValue of contents[].passthrough from the request (only when specified)
files[].share.shareTypestringShare type (workspace / invited / public)
files[].share.urlstringFile view URL
files[].share.passcodeEnabledbooleanPasscode enabled flag
files[].share.passcodestringServer-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