On September 25th, 2024, we released v2 of the Apps SDK. To learn what’s new and how to upgrade, see Migration FAQ and Migration guide.

Canva CLI

CLI for creating and managing Canva Apps.

Introduction

@canva/cli is a command line tool designed for creating and managing Canva Apps. Use @canva/cli to get started creating and testing your app. The Canva CLI allows you to create apps from the command line, and to use Canva's recommended development tools and templates.

To learn more about app development, visit the official documentation.

Requirements

Before using the CLI, make sure that you have the following:

  • Node.js v18.20.4 or v20.17.0.

  • npm v9 or v10.

  • A Canva account(opens in a new tab or window).

    If you are using a version manager such as nvm, run the nvm install 20.17.0 command to make sure you have the correct Node.js version.

Quickstart

The following commands create a new Canva app using the Canva CLI.

npm install -g @canva/cli@latest
canva login
canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
cd my-new-app
npm start
SHELL

Use the Canva CLI

Step 1: Install and log in

Installing the Canva CLI allows you to create new apps from the command line.

To get started:

  1. Install the Canva CLI globally.

    npm install -g @canva/cli@latest
    SHELL
  2. Log in to the Canva CLI. The Canva CLI then opens an access request page in your browser.

    canva login
    SHELL
  3. In your browser, click Allow to grant the Canva CLI access to create and edit apps on your behalf. When you grant access, the Canva CLI generates an auth token and stores it locally. For more information on the auth token, read the following section on auth token storage and removal.

  4. Copy the confirmation code shown in your browser, and paste it into the Canva CLI input.

Step 2: Create your app

After you log in to the Canva CLI and authorize it, you can create your app.

To create a new app:

  1. Run the canva apps create command. The flags in the following code snippet are optional, and you can instead configure these settings during the apps creation process. See the CLI Reference for more information on each flag.

    canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
    SHELL

    You can't change the distribution type after creating an app.

Step 3: Preview your app

When your new app is ready, the Canva CLI automatically opens the Developer Portal(opens in a new tab or window) to your new app's Configuration page in your browser. You can then continue to preview and manage your new app.

To preview your app:

  1. Change into your new app's folder.

    cd my-new-app
    SHELL
  2. Run the following command to start your app.

    npm start
    SHELL
  3. The preview URL will be generated and opened automatically in your browser.

  4. If this the first time previewing your app, click Open to preview your new app.

Step 4: Run a health check on your app

After creating your app, you can diagnose potential issues using:

canva apps doctor
SHELL

This checks for missing dependencies, outdated packages, and other issues.

Log out, auth token storage, and removal

When you log in to the Canva CLI using the canva login command, and then grant the Canva CLI access to manage apps in your Canva account, an auth token is encrypted and stored locally on your machine. The token provides authentication for future requests so you don't need to grant the Canva CLI access each time it sends a request.

When you log out of the Canva CLI with the canva logout command, the auth token is revoked, and deleted.

Token Location

The auth token is located in your home directory under the .canva-cli folder.

Removing the Token

To delete the token, there are two options. However only the canva logout command revokes and deletes the token. If there's a copy of the token, it's possible to reconnect the Canva CLI to your account's apps using the token.

Log out

  1. Use the canva logout command to revoke access and delete the stored token.

    canva logout
    SHELL

Delete the file manually

  1. Locate the credentials file, which is stored in the following locations:

    • macOS and Linux: The token is stored in ~/.canva-cli/credentials.
    • Windows: The token is stored in %USERPROFILE%\.canva-cli\credentials.
  2. Delete the file.

CLI Reference

After installation, you can use the Canva CLI by running:

canva <command-name>
SHELL

Flags

Top-level flags applicable to commands:

  • --help: Show help information about commands and flags.
  • --lite: Enable a simplified CLI interface for enhanced accessibility.
  • --version: Show the CLI version number.

Commands

welcome

Show the welcome page and general information.

canva welcome
SHELL

tip

Print a random development tip for working with the Apps SDK.

canva tip
SHELL
  • Aliases:
    • tips: Also prints a random development tip.

login

Log in to the Canva CLI.

canva login
SHELL

logout

Log out of the Canva CLI, and delete the saved auth token:

canva logout
SHELL

mcp

Start the canva MCP(opens in a new tab or window) server. This is usually called by your MCP client, such as Claude Desktop, Cursor, or other compatible tools. For more information on how to configure your MCP client to use the Canva MCP server, please see MCP Server in the developer documentation.

apps

Manage your Canva apps.

canva apps
SHELL
create

Create a new Canva app.

canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
SHELL
  • Arguments:

    • --name: Sets the app's name. Provide the name you want for the app.
  • Flags:

    • --template: Specifies the starting template for the app.

      Available templates:

      • "hello_world": Basic starting point.
      • "dam": Digital asset management integration.
      • "gen_ai": Generative AI app creation.
    • --distribution: Sets the app's distribution type.

      Available types:

      • "public": Available to all Canva users, subject to Canva review.

      • "private": Only available to your team, and requires team admin approval.

        You can't change the distribution setting after creating a new app with the canva apps create command.

    • --git: Initializes a Git repository in the project directory.

    • --installDependencies: Automatically installs necessary npm dependencies during the app creation process.

    • --offline: Scaffold the app locally without also creating an app in the Developer Portal.

list

List all Canva apps.

canva apps list
SHELL
  • Flags:

    • --appId: Specifies an App ID to select.
    • --all, -a: Lists all apps at once without pagination.
    • --print, -p: Prints the list of apps to the console without interactivity.
preview

Preview your app.

canva apps preview
SHELL
doctor

Run diagnostics on your Canva App to identify and fix issues.

canva apps doctor
SHELL
  • Flags:

    • --fix: Automatically apply fixes for issues where possible.
    • --report: Output check results without prompting for fixes.
    • --verbose: Show detailed diagnostic output optimized for AI agent assistance.

logout

Log out and revoke Canva CLI access.

canva logout
SHELL

Next Steps

Limitations

You must manage your new app created through the Canva CLI through the Developer Portal(opens in a new tab or window). You can't manage apps completely through the Canva CLI.

Updates

To update the CLI to the latest version, run:

npm update -g @canva/cli@latest
SHELL

Contributions

Currently the Canva CLI doesn't accept third-party contributions. Please submit any feature requests through the Canva Developers Community(opens in a new tab or window).

License

Refer to the LICENSE.md file for more information.