Appearance
Design Export Automation
Automate design exports and file delivery using the Connect API.
Export Flow
javascript
// 1. Trigger export
const exportRes = await fetch(
`https://api.canva.com/rest/v1/designs/${designId}/export`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
format: 'pdf',
export_quality: 'regular',
}),
}
);
const { job_id } = await exportRes.json();
// 2. Poll for completion
let exportJob;
while (!exportJob || exportJob.status !== 'success') {
await sleep(2000);
const pollRes = await fetch(
`https://api.canva.com/rest/v1/designs/export/${job_id}`,
{ headers: { 'Authorization': `Bearer ${accessToken}` } }
);
exportJob = await pollRes.json();
}
// 3. Download the file (URL valid for 30 minutes)
const downloadUrl = exportJob.urls[0];
const fileRes = await fetch(downloadUrl);
const buffer = await fileRes.arrayBuffer();
// Save to disk, S3, etc.Export Formats
| Format | Use Case |
|---|---|
pdf | Print, sharing |
png | Web images |
jpg | Compressed images |
gif | Animated designs |
mp4 | Video designs |
pptx | PowerPoint export |
Webhook-Based Export
Instead of polling, use webhooks for production systems:
- Register
design.export.completedwebhook - Trigger export as normal
- Your webhook receives notification when done
- Download the file from the provided URL
Error Handling
javascript
if (exportJob.status === 'failed') {
console.error('Export failed:', exportJob.error);
// Retry logic here
}