Canva Integration Guide
What is Canva for developers?
PKCE → single-use refresh tokens → capability check → POST /v1/autofills → poll → POST /v1/exports → copy to R2 within 24 h.
Exchange the code at api.canva.com/auth/v1/oauth/token with HTTP Basic client auth; access tokens last 4 h (up to 4 KB) and each refresh token works exactly once, so persist the new one inside a per-user lock. Autofill takes type create_from_brand_template | create_from_design | update_design, with text, image/video (asset_id, never a URL), chart (≤100×20) and sheet values — read field names from the dataset endpoint first. Limits are per user per minute: autofill 60, export 20 (plus 75 per 5 min / 500 per day per user), polls 120. url-asset-uploads, generations, comments and merges are preview APIs — fine internally, but they fail Canva's public app review. For scripts, @canva/cli 2.14.1 adds canva api … with a JSON envelope; for AI products, point an MCP client at api.canva.com/connect/v1/mcp.
Five Canva primitives
Per-user OAuth plus async jobs; autofill is the reason to reach for it.
██████╗ █████╗ ███╗ ██╗██╗ ██╗ █████╗
██╔════╝██╔══██╗████╗ ██║██║ ██║██╔══██╗
██║ ███████║██╔██╗ ██║██║ ██║███████║
██║ ██╔══██║██║╚██╗██║╚██╗ ██╔╝██╔══██║
╚██████╗██║ ██║██║ ╚████║ ╚████╔╝ ██║ ██║
╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝Canva Integration Guide
Focus: Programmatic design with the Canva REST APIs (OAuth 2.0 + PKCE): create designs, autofill brand templates, upload assets, export to PNG/PDF/MP4. Also covers the Canva MCP server (Canva tools for AI assistants, including Claude Code), the Canva CLI, and the Apps SDK for apps that run inside the Canva editor.
Overview
Canva now calls its platform the Canva Developers SDK. It has three surfaces, and
all of them are documented under canva.dev/docs/apps/. The old /docs/connect/ URLs
301-redirect there.
| Surface | What it is | When codeAmani uses it |
|---|---|---|
| Canva for your platform (REST APIs, formerly "Connect API") | REST at https://api.canva.com/rest/v1/, per-user OAuth | Default. Server-side autofill, export, and asset sync |
| Canva for AI assistants (Canva MCP server) | Remote MCP server exposing Canva as tools | Ad-hoc design work from Claude; embedding Canva in our own AI products |
| Apps inside Canva (Apps SDK) | JS app in an iframe in the Canva editor, built with @canva/* packages | Only if we ship a Canva Marketplace or team app |
No first-party npm client exists for the REST APIs. You have three options:
- Write plain
fetchcalls. Seeexamples/canva-rest.ts, which is type-checked. - Generate a client from the public OpenAPI description
(
https://www.canva.dev/sources/connect/api/latest/api.yml, API version2024-06-18). The official Starter Kit does this with@hey-api/openapi-ts. - Use the Canva CLI
canva api …commands for scripts and agents (see §7).
Official Documentation
1. Set up the app and credentials
- In the Developer Portal, create an app. Under Outside Canva → Configuration → Integration methods, turn on Canva REST APIs, Canva MCP, or both. Copy the client ID and generate a client secret.
- Select the scopes and add at least one redirect URL. Only scopes enabled here can be requested at runtime.
Only the client secret is a secret. Put it in the vault, or in .env.local for local
development:
CANVA_CLIENT_SECRET=cnvca_...| Setting | Value | Notes |
|---|---|---|
CANVA_CLIENT_ID | from the Developer Portal | Identifies the app; not a secret, but keep it server-side with the secret |
CANVA_REDIRECT_URI | https://<app>/api/canva/callback | Must exactly match a URL registered in the Portal |
| REST base URL | https://api.canva.com/rest | |
| OAuth token host | https://api.canva.com/auth | Spec's primary server; /rest is listed as deprecated |
Each user's access and refresh tokens belong in your database, encrypted, keyed by user. They do not go in environment variables.
2. Authentication (OAuth 2.0 Authorization Code + PKCE)
- Generate a
code_verifier(43–128 chars) andcode_challenge = base64url(sha256(verifier)). Generate a randomstateas well. Store both server-side. - Redirect the user to
https://www.canva.com/api/oauth/authorize?code_challenge=…&code_challenge_method=s256&scope=…&response_type=code&client_id=…&state=…&redirect_uri=…. - On the callback, check
state, thenPOST /v1/oauth/tokenwithgrant_type=authorization_code,code, andcode_verifier. Authenticate with HTTP Basic (base64(client_id:client_secret)), which Canva recommends. - Call the APIs with
Authorization: Bearer <access_token>.
Rules that cause production bugs:
- Access tokens last 4 hours (
expires_in: 14400, "subject to change") and can be up to 4 KB, so size DB columns accordingly. - Each refresh token works only once. Every refresh returns a new refresh token. Persist it atomically, and serialize refreshes per user so two workers don't race on the same token.
- Scopes are not cumulative.
asset:writedoes not grantasset:read; request both. On refresh you can narrow the scope but not widen it. - Token calls are server-only. Canva's CORS policy blocks browser calls that carry the client secret.
- Token host: the OpenAPI spec lists
https://api.canva.com/auth/v1/oauth/tokenas primary andhttps://api.canva.com/rest/v1/oauth/tokenas deprecated. The current reference page examples still show the/restform. Both work. See NOTES.md. POST /v1/oauth/introspectchecks a token.POST /v1/oauth/revokerevokes one, for example when a user disconnects.- OIDC is available: the
openid,profile, andemailscopes, plusGET https://api.canva.com/auth/v1/oidc/userinfo(10 req/min).
Common scopes:
| Scope | Grants |
|---|---|
design:meta:read | List or get designs; poll autofill jobs |
design:content:read | Read design content; export; read design datasets |
design:content:write | Create designs, autofill, imports, resizes (with read) |
asset:read / asset:write | Read / upload, update, or delete assets |
brandtemplate:meta:read | List or get brand templates |
brandtemplate:content:read | Read a brand template's dataset (autofill fields) |
brandtemplate:content:write | Publish a design as a brand template (preview) |
folder:read / folder:write / folder:permission:write | Folders |
comment:read / comment:write | Comments (preview APIs) |
profile:read | User profile and capabilities |
collaboration:event | Receive webhooks |
3. Plans and capabilities (check before calling)
Some APIs are tied to the user's Canva plan. They declare an
x-required-capabilities value in the spec. If the user lacks the capability, the call
fails with 403. Call GET /v1/users/me/capabilities (scope profile:read,
10 req/min) first and hide UI the user can't use.
Capability values: autofill, brand_template, resize, design_generation,
background_removal, export_png_transparency, image_to_design_imports,
analytics, team_restricted_app.
| Feature | Who can use it (per canva.dev, 2026-10-20) |
|---|---|
| Autofill (designs + brand templates) | Canva Pro (incl. Education, Nonprofits), Teams, Enterprise. Opened beyond Enterprise on 2026-09-21; "usage limits will be introduced in the future" |
| Brand templates (list, get, dataset) | Plans with brand templates: Pro, Teams, Enterprise |
| Resize | resize capability (Pro and above; Free gets a limited trial via MCP) |
Export export_quality: "pro", transparent PNG | Pro and above. Premium elements without a licence give license_required |
| Free-plan PNG export | Can't upscale a fixed-size design by more than 1.125× |
| Design analytics (preview) | analytics capability |
| Design/image generation, background removal (preview) | Uses the user's Canva AI credits |
Canva's Help Center contradicts itself on autofill plans. One page says Enterprise only; another says every plan except Free and Pro Lite. Trust the capability check, not a plan name. See NOTES.md.
4. Brand template autofill (the high-leverage feature)
A designer builds a template with named data fields. Your server then fills those fields from data, at scale.
POST /v1/autofills accepts three type modes. All of them are GA as of 2026-08-25:
type | Source | Result |
|---|---|---|
create_from_brand_template (default if type is omitted) | brand_template_id | New design in the user's root folder |
create_from_design | design_id of a design with data fields | New design |
update_design | design_id | Fills the same design in place |
Data value types: text (text), image (asset_id), video (asset_id, placed
into an image field), chart (chart_data, max 100 rows × 20 columns, optional
column_configs), and sheet (sheet_data). Number cells with formatting metadata
and media cells are rejected for chart and sheet.
curl -X POST 'https://api.canva.com/rest/v1/autofills' \
-H "Authorization: Bearer $CANVA_ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"type":"create_from_brand_template","brand_template_id":"DAFVztcvd9z",
"title":"Fall promo - October",
"data":{
"headline":{"type":"text","text":"20% off this week"},
"hero":{"type":"image","asset_id":"Msd59349ff"}
}}'
# -> { "job": { "id": "...", "status": "in_progress" } }Gotchas:
- Get field names from
GET /v1/brand-templates/{id}/dataset. For designs, useGET /v1/designs/{id}/dataset. Never hard-code them; designers rename fields. - Image and video fields take an
asset_id, never a URL. Upload the file first (§6). - Job error codes:
autofill_error,thumbnail_generation_error,create_design_error,design_approval_error,design_update_error, andtrial_quota_exceeded. The last one applies to users on a plan without autofill who have a limited trial.result.trial_information(uses_remaining,upgrade_url) is itself a preview field. GET /v1/brand-templates?dataset=non_emptylists only templates that have autofill fields.
5. Export a design (async job)
curl -X POST 'https://api.canva.com/rest/v1/exports' \
-H "Authorization: Bearer $CANVA_ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"design_id":"DAVZr1z5464","format":{"type":"png","export_quality":"regular"}}'
# poll GET /v1/exports/{exportId} until status == success -> job.urls[]- Formats:
pdf,jpg(requiresquality),png,pptx,gif,mp4(requiresquality),html_bundle,html_standalone(email designs), andcsv(Canva Sheets only). CallGET /v1/designs/{id}/export-formatsto see what a given design supports, page by page. export_quality:regular(default) orpro. Aproexport can fail withlicense_requiredif the design has premium elements and the user's plan doesn't cover them.- Other error codes:
approval_required(the design needs reviewer approval) andinternal_failure. - MP4
quality(horizontal_1080p,vertical_4k, and so on) is a target pixel count. Since 2026-09-18 the video keeps the design's own aspect ratio, so a square design at*_4kcomes out 2880×2880. urls[]are valid for 24 hours, served fromexport-download.canva.com. You get one per page for some formats. Download them and store the files in R2.- Export-specific throttles, on top of 20 create requests/min/user:
- App: 750 per 5 min and 5,000 per 24 h
- Document: 75 per 5 min
- User: 75 per 5 min and 500 per 24 h
6. Upload an asset
# Binary (GA): name goes base64-encoded in a header
curl -X POST 'https://api.canva.com/rest/v1/asset-uploads' \
-H "Authorization: Bearer $CANVA_ACCESS_TOKEN" -H "Content-Type: application/octet-stream" \
-H 'Asset-Upload-Metadata: {"name_base64":"aGVyby5wbmc="}' --data-binary '@hero.png'
# From a public URL (PREVIEW API; videos limited to 100 MB)
curl -X POST 'https://api.canva.com/rest/v1/url-asset-uploads' \
-H "Authorization: Bearer $CANVA_ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"hero","url":"https://cdn.example.com/hero.png"}'Poll GET /v1/asset-uploads/{jobId} or GET /v1/url-asset-uploads/{jobId}. On
success the response contains job.asset.id. URL uploads are a preview API. Public
apps that use preview APIs fail Canva's review, so production code should use the
binary upload.
7. Canva CLI (@canva/cli)
npm i -g @canva/cli. The package declares node >=22; the docs ask for Node v24 and
npm v11. canva login stores an encrypted token locally, and canva logout revokes it.
| Command | Purpose |
|---|---|
canva apps create "Name" --template=hello_world --distribution=public --git --installDependencies | Scaffold an Apps SDK app |
canva apps start / build / upload / doctor / migrate | Dev server, production build, upload a bundle, health check, migrate to @canva/app-scripts |
canva api designs list | jq '.data.items[].id' | New: call the REST APIs with your CLI login. Output is one JSON object {ok,data,next,meta}, which suits agents |
canva api describe exports create | Show an operation's scopes, capabilities, rate limit, and flags |
canva api post /v1/designs --body @body.json | Raw request to any REST path |
canva profile switch work / --profile / CANVA_CLI_PROFILE | Multiple stored logins |
canva mcp | Start the Dev MCP server (docs and SDK help, not design access) |
If you logged in with a CLI version older than the api command, run canva login
again so the stored token carries the REST scopes.
8. Canva MCP server (Canva for AI assistants)
Canva runs a remote MCP server that exposes design generation, editing transactions, search, autofill, export, resize, comments, folders, and image tools. Every user authenticates individually. There is no org-wide service account, and tools only see what that user can see in Canva.
| Use case | Endpoint and setup |
|---|---|
| codeAmani devs in Claude Code / claude.ai | The claude.ai Canva connector is already wired in. Tools appear as mcp__claude_ai_Canva__* (generate-design, autofill-design, export-design, resize-design, …). The Canva plugin skills (canva:*) build on them |
| Embedding Canva in our own AI product | Register an app, turn on Canva MCP, and use client ID and secret against https://api.canva.com/connect/v1/mcp (streamable HTTP; per-user OAuth). If the client has no remote-MCP support, use the mcp-remote stdio bridge |
| Public "Canva AI Connector" | https://mcp.canva.com/mcp (OAuth with dynamic registration; consumer assistants use it). canva.dev doesn't document this URL; it was verified live via its OAuth metadata |
| Writing Apps SDK code with AI | claude mcp add canva-dev -- npx -y @canva/cli@latest mcp (local stdio Dev MCP server) |
MCP limits and plans (from /docs/apps/mcp/tools/):
- Each tool has its own per-minute limit, for example
generate-design20,generate-image10,export-design20,autofill-design60, andperform-editing-operations50. - Tools without their own limit share a cap of 300 req/min per user, counted across all of that user's MCP clients.
autofill-design, the brand-template tools,list-brand-kits, andresize-designneed Pro or above. Everything else works on all plans.generate-designcan be slow, so set client timeouts to about 60 s.- Allow responses from both the
canva.comandcanva.aidomains. - Team admins can turn the AI Connector off for the whole team. When they do, existing connections stop working.
9. Webhooks and return navigation
- Webhooks need the
collaboration:eventscope, plus a per-type scope; for example, comments also needdesign:meta:readandcomment:read. Types includecomment,share_design,share_folder,design_approval_*,design_access_requested,folder_access_requested,design_mention,suggestion, andteam_invite. Reply with200quickly and do the work async. - Verify every webhook. Canva publishes Ed25519 public keys (JWK,
kid-rotated) atGET https://api.canva.com/rest/v1/connect/keys. That endpoint is public and currently preview. Cache keys bykidand refetch only when you see an unknownkid. - Return navigation: when a user finishes editing in Canva, they are redirected to
your app with a
correlation_jwtquery parameter. Verify it withjose.jwtVerify(token, createRemoteJWKSet(keysUrl), { audience: CANVA_CLIENT_ID }), as the Starter Kit does (seeexamples/canva-rest.ts).
10. Other REST APIs worth knowing
| API | Status | Notes |
|---|---|---|
Designs: create (preset/custom), list, get, pages, export-formats, dataset | GA. Create-by-copy (type: design) and create-from-brand-template are preview | Custom designs: each side 40–8000 px, max 25M px². Blank designs are auto-deleted if left unedited |
Resizes (POST /v1/resizes) | GA, needs the resize capability | 20/min |
| Design imports (file, URL) | GA | Import PDF/PPTX and similar files as editable designs |
| Folders | GA | list items can include brand_template items |
| Comments, image-to-design imports, merges, design generations (2026-09-29), image generations (2026-10-01), image transformations (background removal), analytics, publish brand template | Preview | Generation and transformation consume Canva AI credits. Don't ship preview APIs in public apps |
Rate limits (REST, requests/min/client-user, from the OpenAPI spec)
Over the limit returns 429 with error code too_many_requests. Back off
exponentially and honour Retry-After.
| Operation | Limit |
|---|---|
| Create design / resize / import / export | 20 |
| Create asset upload (binary or URL) | 30 |
| Poll asset upload | 180 |
| Create autofill | 60 |
| Poll autofill / export / resize / import | 120 |
| List / get brand templates, get dataset | 100 |
| Publish brand template (preview) | 20 |
| Get/list designs, folders, assets | 100 |
users/me, capabilities, profile, OIDC userinfo | 10 |
Exports have extra throttles; see §5.
11. Apps SDK (apps inside Canva)
Use the Apps SDK only for in-editor apps. It runs in an iframe with a strict CSP, and your backend must allow CORS. All new apps must implement at least one intent: Content Publisher, Data Connector, Design Editor, or URL Expander.
| Package | Version (npm, 2026-10-20) |
|---|---|
@canva/app-ui-kit | 5.15.0 |
@canva/design | 2.13.1 |
@canva/intents | 2.7.1 |
@canva/asset | 2.3.1 |
@canva/user | 2.3.0 |
@canva/platform | 2.2.3 |
@canva/error | 2.2.2 |
@canva/app-components | 2.8.1 |
@canva/app-i18n-kit | 1.3.0 |
@canva/app-scripts | 1.1.2 |
Canva injects the SDK methods at runtime; the npm packages contain only type
declarations. Rolling a package back therefore never fixes a runtime bug. Preview
methods ship under the @beta dist-tag, and apps that use them fail app review.
codeAmani notes
- Default path: use the REST APIs from a Next.js route handler or server action. The client secret and per-user tokens never reach the browser. Store tokens encrypted in Supabase/Neon, and serialize refreshes because refresh tokens are single-use.
- Brand templates + autofill are still the highest-leverage feature. Autofill is
now available on Pro and Teams, so small US business customers on Canva Pro can use
it. Gate the UI on
GET /v1/users/me/capabilities(autofill,brand_template) rather than assuming a plan. - Persist exports: copy
urls[]into R2 (the same pipeline as the dashboard thumbnails atthumbs.codeamanilabs.org) within 24 h. Never store the Canva URL itself. - AI routing: Canva's generation APIs and MCP tools spend the user's Canva AI credits, not our Anthropic or OpenAI budget. Use Claude for copy and structure, then Canva to render on-brand designs.
- Payments: Canva is a design dependency, not a payment rail. Stripe stays the
default. M-Pesa applies only to Kenya-targeted projects, for example the
duka-order-botpromo graphics. - Kenya-targeted apps: autofill output can carry KES pricing text, for example
"KES 499". Export compressedjpgorpngat small sizes for 2G/3G WhatsApp delivery rather than large PDFs. - Preview APIs: fine for internal tools, never for anything we publish to Canva's Marketplace.