CLI for creating and managing Canva Apps.
- Introduction
- Requirements
- Quickstart
- Use the Canva CLI
- Log out, auth token storage, and removal
- CLI reference
- Next steps
- Limitations
- Updates
- Contributions
- License
@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.
Before using the CLI, make sure that you have the following:
-
Node.js
v18.20.4
orv20.17.0
. -
npm
v9
orv10
. -
Note: 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.
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
Installing the Canva CLI allows you to create new apps from the command line.
To get started:
-
Install the Canva CLI globally.
npm install -g @canva/cli@latest
-
Log in to the Canva CLI. The Canva CLI then opens an access request page in your browser.
canva login
-
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.
-
Copy the confirmation code shown in your browser, and paste it into the Canva CLI input.
After you log in to the Canva CLI and authorize it, you can create your app.
To create a new app:
-
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
Note: You can't change the distribution type after creating an app.
When your new app is ready, the Canva CLI automatically opens the Developer Portal 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:
-
Change into your new app's folder.
cd my-new-app
-
Run the following command to start your app.
npm start
-
The preview URL will be generated and opened automatically in your browser.
-
If this the first time previewing your app, click Open to preview your new app.
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.
The auth token is located in your home directory under the .canva-cli
folder.
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.
-
Use the
canva logout
command to revoke access and delete the stored token.canva logout
-
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
.
-
macOS and Linux: The token is stored in
-
Delete the file.
After installation, you can use the Canva CLI by running:
canva <command-name>
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.
Show the welcome page and general information.
canva welcome
Print a random development tip for working with the Apps SDK.
canva tip
-
Aliases:
-
tips
: Also prints a random development tip.
-
Log in to the Canva CLI.
canva login
Log out of the Canva CLI, and delete the saved auth token:
canva logout
Manage your Canva apps.
canva apps
-
create "app-name"
: Create a new Canva app.canva apps create "My New App" --template="hello_world" --distribution="public" --git --installDependencies
-
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.Note: 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
-
preview
: Preview your app.canva apps preview
Log out and revoke Canva CLI access.
canva logout
You must manage your new app created through the Canva CLI through the Developer Portal. You can't manage apps completely through the Canva CLI.
To update the CLI to the latest version, run:
npm update -g @canva/cli@latest
Currently the Canva CLI doesn't accept third-party contributions. Please submit any feature requests through the Canva Developers Community.
Refer to the LICENSE.md
file for more information.