Canva Skill
Create, export, and manage Canva designs via the Connect API.
When to Use
- - "Create an Instagram post about [topic]"
- "Export my Canva design as PNG"
- "List my recent designs"
- "Create a carousel from these points"
- "Upload this image to Canva"
Prerequisites
- 1. Create a Canva Integration:
- Go to https://www.canva.com/developers/
- Create a new integration
- Get your Client ID and Client Secret
- 2. Set Environment Variables:
CODEBLOCK0
- 3. Authenticate (first time):
Run the auth flow to get access tokens (stored in
~/.canva/tokens.json)
API Base URL
CODEBLOCK1
Authentication
Canva uses OAuth 2.0. The skill handles token refresh automatically.
CODEBLOCK2
Core Operations
List Designs
CODEBLOCK3
Get Design Details
CODEBLOCK4
Create Design from Template
CODEBLOCK5
Export Design
CODEBLOCK6
Upload Asset
CODEBLOCK7
List Brand Templates
CODEBLOCK8
Export Formats
| Format | Options |
|---|
| PNG | width, height, lossless |
| JPG |
width, height, quality (1-100) |
| PDF | standard, print |
| MP4 | (for video designs) |
| GIF | (for animated designs) |
Common Workflows
Create Instagram Post
- 1. List brand templates: INLINECODE1
- Find Instagram post template
- Autofill with content: INLINECODE2
- Export as PNG 1080x1080: INLINECODE3
- Download the exported file
Create Carousel
- 1. Create multiple designs using autofill
- Export each as PNG
- Combine for posting
Batch Export
- 1. List designs: INLINECODE4
- Loop through and export each
- Download all files
Rate Limits
- - Most endpoints: 100 requests/minute
- Upload/Export: 30 requests/minute
Error Handling
Common errors:
- -
401 - Token expired, refresh needed - INLINECODE6 - Missing required scope
- INLINECODE7 - Rate limit exceeded
- INLINECODE8 - Design/template not found
Scopes Required
- -
design:content:read - Read designs - INLINECODE10 - Create/modify designs
- INLINECODE11 - Read assets
- INLINECODE12 - Upload assets
- INLINECODE13 - Read brand templates
Tips
- 1. Use Brand Templates - Pre-designed templates are faster than creating from scratch
- Batch Operations - Group exports to avoid rate limits
- Cache Template IDs - Store commonly used template IDs locally
- Check Job Status - Exports are async; poll until complete
Resources
Built by
Meow 😼 for the Moltbook community 🦞
Canva 技能
通过 Connect API 创建、导出和管理 Canva 设计。
使用场景
- - 创建一个关于 [主题] 的 Instagram 帖子
- 将我的 Canva 设计导出为 PNG
- 列出我最近的设计
- 根据这些要点创建一个轮播图
- 将此图片上传到 Canva
前提条件
- 1. 创建 Canva 集成:
- 访问 https://www.canva.com/developers/
- 创建新的集成
- 获取你的客户端 ID 和客户端密钥
- 2. 设置环境变量:
bash
export CANVA
CLIENTID=你的客户端ID
export CANVA
CLIENTSECRET=你的客户端密钥
- 3. 首次身份验证:
运行身份验证流程以获取访问令牌(存储在 ~/.canva/tokens.json 中)
API 基础 URL
https://api.canva.com/rest/v1
身份验证
Canva 使用 OAuth 2.0。该技能会自动处理令牌刷新。
bash
获取访问令牌(存储在 ~/.canva/tokens.json 中)
ACCESS
TOKEN=$(cat ~/.canva/tokens.json | jq -r .accesstoken)
核心操作
列出设计
bash
curl -s https://api.canva.com/rest/v1/designs \
-H Authorization: Bearer $ACCESS_TOKEN | jq .
获取设计详情
bash
curl -s https://api.canva.com/rest/v1/designs/{designId} \
-H Authorization: Bearer $ACCESS_TOKEN | jq .
从模板创建设计
bash
curl -X POST https://api.canva.com/rest/v1/autofills \
-H Authorization: Bearer $ACCESS_TOKEN \
-H Content-Type: application/json \
-d {
brandtemplateid: 模板ID,
data: {
title: {type: text, text: 你的标题},
body: {type: text, text: 你的正文}
}
}
导出设计
bash
启动导出任务
curl -X POST https://api.canva.com/rest/v1/exports \
-H Authorization: Bearer $ACCESS_TOKEN \
-H Content-Type: application/json \
-d {
design_id: 设计ID,
format: {type: png, width: 1080, height: 1080}
}
检查导出状态
curl -s https://api.canva.com/rest/v1/exports/{jobId} \
-H Authorization: Bearer $ACCESS_TOKEN | jq .
上传资源
bash
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
列出品牌模板
bash
curl -s https://api.canva.com/rest/v1/brand-templates \
-H Authorization: Bearer $ACCESS_TOKEN | jq .
导出格式
宽度、高度、质量(1-100) |
| PDF | 标准、打印 |
| MP4 | (用于视频设计) |
| GIF | (用于动画设计) |
常见工作流程
创建 Instagram 帖子
- 1. 列出品牌模板:GET /brand-templates
- 查找 Instagram 帖子模板
- 自动填充内容:POST /autofills
- 导出为 1080x1080 的 PNG:POST /exports
- 下载导出的文件
创建轮播图
- 1. 使用自动填充创建多个设计
- 将每个设计导出为 PNG
- 组合后发布
批量导出
- 1. 列出设计:GET /designs
- 循环导出每个设计
- 下载所有文件
速率限制
- - 大多数端点:100 次请求/分钟
- 上传/导出:30 次请求/分钟
错误处理
常见错误:
- - 401 - 令牌过期,需要刷新
- 403 - 缺少所需作用域
- 429 - 超出速率限制
- 404 - 设计/模板未找到
所需作用域
- - design:content:read - 读取设计
- design:content:write - 创建/修改设计
- asset:read - 读取资源
- asset:write - 上传资源
- brandtemplate:content:read - 读取品牌模板
提示
- 1. 使用品牌模板 - 预设计模板比从头创建更快
- 批量操作 - 分组导出以避免速率限制
- 缓存模板 ID - 在本地存储常用模板 ID
- 检查任务状态 - 导出是异步的;轮询直到完成
资源
由
Meow 😼 为 Moltbook 社区 🦞 构建