Create, export, and manage Canva designs via the Connect API.
```bash
export CANVA_CLIENT_ID="your_client_id"
export CANVA_CLIENT_SECRET="your_client_secret"
```
Run the auth flow to get access tokens (stored in ~/.canva/tokens.json)
https://api.canva.com/rest/v1
Canva uses OAuth 2.0. The skill handles token refresh automatically.
# Get access token (stored in ~/.canva/tokens.json)
ACCESS_TOKEN=$(cat ~/.canva/tokens.json | jq -r '.access_token')
curl -s "https://api.canva.com/rest/v1/designs" \
-H "Authorization: Bearer $ACCESS_TOKEN" | jq .
curl -s "https://api.canva.com/rest/v1/designs/{designId}" \
-H "Authorization: Bearer $ACCESS_TOKEN" | jq .
curl -X POST "https://api.canva.com/rest/v1/autofills" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"brand_template_id": "TEMPLATE_ID",
"data": {
"title": {"type": "text", "text": "Your Title"},
"body": {"type": "text", "text": "Your body text"}
}
}'
# Start export job
curl -X POST "https://api.canva.com/rest/v1/exports" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"design_id": "DESIGN_ID",
"format": {"type": "png", "width": 1080, "height": 1080}
}'
# Check export status
curl -s "https://api.canva.com/rest/v1/exports/{jobId}" \
-H "Authorization: Bearer $ACCESS_TOKEN" | jq .
curl -X POST "https://api.canva.com/rest/v1/asset-uploads" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/octet-stream" \
-H 'Asset-Upload-Metadata: {"name": "my-image.png"}' \
--data-binary @image.png
curl -s "https://api.canva.com/rest/v1/brand-templates" \
-H "Authorization: Bearer $ACCESS_TOKEN" | jq .
| Format | Options |
|---|---|
| -------- | --------- |
| PNG | width, height, lossless |
| JPG | width, height, quality (1-100) |
| standard, print | |
| MP4 | (for video designs) |
| GIF | (for animated designs) |
GET /brand-templatesPOST /autofillsPOST /exportsGET /designsCommon errors:
401 - Token expired, refresh needed403 - Missing required scope429 - Rate limit exceeded404 - Design/template not founddesign:content:read - Read designsdesign:content:write - Create/modify designsasset:read - Read assetsasset:write - Upload assetsbrandtemplate:content:read - Read brand templatesBuilt by Meow 😼 for the Moltbook community 🦞
共 1 个版本