Canvas CLI
Getting Started #
Installation using pip #
To install the Canvas CLI using pip, execute pip install canvas. Python 3.11, 3.12, or 3.13 is required.
To upgrade the Canvas CLI if you installed using pip, execute pip install --upgrade canvas.
Installation using uv #
To install the Canvas CLI using uv, execute uv tool install canvas. uv will find or procure an acceptable Python version.
To upgrade the Canvas CLI if you installed using uv, execute uv tool upgrade canvas.
Signing in to Canvas Platform #
The Canvas CLI signs in to Canvas Platform, which hosts each plugin’s git repository and deploys it to the instances your organizations manage. Sign in once per machine:
$ canvas login
Signed in to https://platform.canvasmedical.com as you@example.com.
Acme Health (acme): plugin prefix acme__
canvas login opens your browser and also prints the sign-in URL, for a machine without a browser. Once you approve or decline the sign-in, the browser tab ends on a Canvas Platform page that says whether you signed in, and you can close it. The command then lists each organization you belong to with its plugin prefix. The session is stored in ~/.canvas/platform-credentials.json, readable only by you, and refreshes itself. canvas logout revokes it. A CI/CD pipeline signs in with a service account instead.
A plugin’s name is used for the manifest name, the package folder and its imports. It starts with a lowercase letter, holds only lowercase letters, digits and underscores, and is at most 255 characters. A plugin that already runs on your instances under a name outside that rule, such as one with hyphens or uppercase letters, keeps its name: canvas deploy deploys it as long as one of your organizations publishes a plugin of exactly that name on Canvas Platform. We recommend naming a plugin with your organization’s prefix, <org prefix>__<package> (for example acme__intake), which canvas init does for you.
The organization that publishes a plugin is its manifest publisher, the organization slug that canvas login lists in parentheses (acme above). canvas deploy chooses the publisher when the manifest has none.
canvas login --platform <url> or the CANVAS_PLATFORM_URL environment variable points the CLI at a platform other than https://platform.canvasmedical.com, and later commands keep using the platform you last signed in to.
canvas whoami shows which platform the CLI is using, why, and who you are signed in as there:
$ canvas whoami
Platform: https://platform.canvasmedical.com (from your last `canvas login`)
Signed in as you@example.com (browser session from `canvas login`)
Acme Health (acme): plugin prefix acme__, can push, deploy, configure, uninstall
You are now ready to use the Canvas CLI. Continue with canvas init and canvas deploy.
Service accounts for CI/CD #
The Canvas CLI supports service accounts for automated pipelines such as GitHub Actions, GitLab CI or any other CI/CD system. A service account is an identity that belongs to your organization rather than to a person, so a pipeline that publishes and deploys plugins keeps working when the person who set it up leaves, and Canvas Platform’s audit log names the service account behind each push and deploy. A pipeline signs in with the account’s token instead of canvas login, which needs a browser.
Create a service account. An Organization admin, Plugin developer or Deploy manager creates one on the Credentials page in Canvas Platform. A service account can hold the Plugin developer and Deploy manager roles. An Organization admin can give it either role; a Plugin developer or Deploy manager can give only the roles they hold, so a Plugin developer cannot create an account that deploys. Its token is shown once and is valid for a year.
Use it in a pipeline. Store the token as a secret in your CI/CD system and expose it to the job as the CANVAS_PLATFORM_TOKEN environment variable. No canvas login step is needed:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install canvas
- run: canvas deploy my-plugin/acme__my_plugin --instance acme-staging --yes
env:
CANVAS_PLATFORM_TOKEN: ${{ secrets.CANVAS_PLATFORM_TOKEN }}
- Check out the full history (
fetch-depth: 0in GitHub Actions).canvas deploypushes the checkout to the plugin’s repository on Canvas Platform, and git refuses to push a shallow clone to a repository that lacks its history.--snapshotpushes a new commit instead and needs no git identity. Give it full history too, without file contents if the repository is large (fetch-depth: 0withfilter: blob:none): its rollback check needs the commitmainwas last deployed from, and it skips that check in a shallow checkout. The push to Canvas Platform’s
mainis not forced, so it is refused when Canvas Platform’smainhas a commit the checkout lacks, such as one a developer deployed from their machine without pushing it to the repository the pipeline checks out. Once a pipeline deploys a plugin, deploy it only from the pipeline.- When
CANVAS_PLATFORM_TOKENis set, every command uses it in place of acanvas loginsession, including the git pushescanvas deploymakes. It takes precedence over a session already stored on the machine, so a runner always acts as its service account. --yescommits uncommitted changes without prompting. A deployment that needs consent for another plugin’s custom data exits non-zero and lists the requests, because only a person at a terminal answers those.CANVAS_PLATFORM_URLpoints the job at a platform other than https://platform.canvasmedical.com.
Rotate or revoke it. The token does not refresh. Rotating it on the Credentials page ends the old token, and revoking the service account ends it for good; either way the CLI’s next request says that Canvas Platform did not accept CANVAS_PLATFORM_TOKEN. canvas logout signs out only a browser session and leaves the token alone.
Instance API credentials (credentials.ini): deprecated #
With credentials.ini, the CLI authenticates to each instance with an OAuth client registered on that instance. canvas install always authenticates this way. enable, disable, config list, config set, config unset, uninstall, list, logs and the namespace commands use it when you’re not signed in to Canvas Platform, and for localhost. Signed in, they refuse a plugin or instance Canvas Platform does not manage, so sign out with canvas logout to reach it with credentials.ini. Keep credentials.ini while you still work with plugins or instances that Canvas Platform does not manage.
From midnight UTC on December 14, 2026, Canvas instances refuse the commands among these that change a plugin directly: canvas install, enable, disable, and config set, config unset and uninstall for a plugin Canvas Platform does not manage. Each one fails with an error that points to canvas deploy. list, config list, logs and the namespace commands keep working with credentials.ini.
A machine can hold both a Canvas Platform sign-in and credentials.ini at once. The CLI picks per plugin for plugin commands, as described in Which plugins go through Canvas Platform, and per instance for instance commands, as described in Which instances go through Canvas Platform.
The file has a section for each Canvas instance subdomain, with that instance’s client_id and client_secret. For example, if your Canvas instance URL is https://buttered-popcorn.canvasmedical.com/, its section is [buttered-popcorn]. Customer Authentication explains how to register a client.
Example:
[buttered-popcorn]
client_id=butter
client_secret=salt
[dev-buttered-popcorn]
client_id=devbutter
client_secret=devsalt
is_default=true
[localhost]
client_id=localclientid
client_secret=localclientsecret
You can define your default host with is_default=true. If no default is explicitly defined, the Canvas CLI will use the first instance in the file as the default for each of the CLI commands.
Deprecation notices #
canvas install prints a deprecation warning each time it installs onto a Canvas instance at canvasmedical.com. It prints none for a preview environment such as https://pull-x.preview.canvasmedical.com, for localhost, or for another host outside canvasmedical.com. canvas list, logs, enable, disable, config list, config set, config unset, uninstall and the namespace commands print the warning each time they connect to a Canvas instance with credentials.ini. list, logs and the namespace commands print no deprecation notice for localhost or another host that is not a Canvas instance, because canvas login can’t serve those hosts. The plugin commands skip the notice for such a host too, whether you name it with --host or --instance or it’s the default host in credentials.ini. Separately, at most once a day, any command, canvas install included, prints a notice that authentication and deployment are changing, with a link to the migration steps. All of these notices go to standard error, so they do not interfere with piped or redirected output.
Which plugins go through Canvas Platform #
canvas enable, canvas disable, canvas config list, canvas config set, canvas config unset and canvas uninstall work for plugins Canvas Platform manages and for plugins installed straight onto an instance, and each decides per plugin:
- When the target is
localhostor another host that is not a Canvas instance, the command goes straight to that host with itscredentials.iniclient, signed in or not, without asking Canvas Platform. The target is every host you name with--hostor--instance, or, with neither option, the default host incredentials.ini. For example, with a[localhost]default,canvas enable acme__intakeenables the plugin onlocalhost, even when Canvas Platform has it installed onacme. - On a machine that is not signed in, the command goes straight to the instance with its
credentials.iniclient. - Signed in with
canvas loginor a service account token, the CLI asks Canvas Platform for the plugin, whatever its name. If Canvas Platform manages it, the command goes through Canvas Platform, and each--instancemust be one Canvas Platform manages in your list of instances. Any other plugin aimed at a Canvas instance, or named with no--instance, no--hostand no default host incredentials.ini, is refused, and so is an--instanceoutside your list. The refusal comes with the way to sign out:canvas logout, or unsettingCANVAS_PLATFORM_TOKENwhen a service account token is in use.
To work with a plugin Canvas Platform does not manage on a Canvas instance, sign out first. credentials.ini keeps working for those plugins until December 14, 2026.
--instance names the target instances for either kind of plugin, and you can repeat it. For a plugin Canvas Platform does not manage, the CLI connects to each --instance directly with its credentials.ini client. --host names a single instance instead, and without either option the command uses the default host from credentials.ini; pass --instance or --host, not both. For a plugin Canvas Platform manages, the CLI refuses --host.
Until December 14, 2026, an instance accepts direct writes for every plugin, including one Canvas Platform deployed. A canvas install, config set, config unset or uninstall that goes straight to the instance changes that instance’s copy of the plugin. The next deploy from Canvas Platform installs its own revision over it and replaces the plugin’s variables with the values Canvas Platform stores. Canvas Platform can also deploy over a plugin first installed with canvas install.
git signs in to Canvas Platform’s git server through canvas git-credential, a hidden command that canvas deploy, canvas init and canvas clone register as the repository’s credential helper. It mints a one-hour git token for the plugin and publisher named in the repository path.
Which instances go through Canvas Platform #
canvas list, canvas logs and the canvas namespace commands act on a whole instance, and each decides per instance:
- When you’re signed in with
canvas loginor a service account token, and the instance is one Canvas Platform manages in your list of instances, the command goes through Canvas Platform. - Signed in, any other Canvas instance is refused with the way to sign out:
canvas logout, or unsettingCANVAS_PLATFORM_TOKENwhen a service account token is in use. - When you’re not signed in, or for
localhostand other hosts that are not Canvas instances, the command connects to the instance with itscredentials.iniclient.
To work with an instance Canvas Platform does not manage, sign out first. credentials.ini keeps working for those instances until December 14, 2026.
When Canvas Platform refuses a command for a managed instance, the CLI prints Canvas Platform’s reason and exits. It doesn’t retry with credentials.ini. To run the command against the instance with credentials.ini instead, sign out with canvas logout, or unset CANVAS_PLATFORM_TOKEN when a service account token is in use.
Update Notifications #
The Canvas CLI automatically checks PyPI for newer versions. If an update is available, a notice is printed to standard error after the command output:
[notice] A newer version of canvas is available (0.112.0 → 0.113.0). Upgrade with: pip install --upgrade canvas
- The check runs at most once every 12 hours; the result is cached locally to avoid unnecessary network requests.
- Because the notice is printed to standard error, it will not interfere with piped or redirected command output.
- To disable update checks, set the environment variable
CANVAS_NO_UPDATE_CHECK=1.
Checking the SDK/runtime version on an instance #
canvas --version reports the version of the locally installed CLI. To find the SDK/runtime version actually running on a given Canvas instance — useful when verifying that an expected SDK change is live — import version from canvas_sdk.handlers.base inside a plugin running on that instance:
from canvas_sdk.handlers.base import version
from logger import log
log.info(f"SDK version: {version}")
Usage #
$ canvas [OPTIONS] COMMAND [ARGS]...
Options:
--version--help: Show this message and exit.
Commands #
login: Sign in to Canvas Platform through your browserlogout: Sign out of Canvas Platformwhoami: Show which Canvas Platform you are signed in to, and as whominit: Create a new plugindeploy: Publish a plugin to Canvas Platform and deploy itclone: Clone a plugin’s repository from Canvas Platformuninstall: Uninstall a pluginenable: Enable a plugindisable: Disable a pluginlist: List all plugins from a Canvas instancevalidate: Validate a plugin’s manifest and that all handlers load in the sandboxvalidate-manifest: Validate the Canvas Manifest json filelogs: Listen and print log streams from a Canvas instanceconfig list: List plugin variablesconfig set: Set plugin variablesconfig unset: Clear plugin variablesinstall: Install a plugin into a Canvas instance (deprecated; usedeploy)
canvas login #
Sign in to Canvas Platform through your browser (OAuth authorization code with PKCE). The sign-in URL is also printed, for a machine without a browser. See Signing in to Canvas Platform.
Usage:
$ canvas login [OPTIONS]
Options:
--platform TEXT: Canvas Platform URL. Defaults to$CANVAS_PLATFORM_URL, the platform you last signed in to, or https://platform.canvasmedical.com--help: Show this message and exit.
canvas logout #
Revoke this machine’s Canvas Platform session and delete its stored tokens. A service account token in CANVAS_PLATFORM_TOKEN is left alone, and the command says that commands still act as that account.
Usage:
$ canvas logout [OPTIONS]
Options:
--platform TEXT: Canvas Platform URL--help: Show this message and exit.
canvas whoami #
Show the Canvas Platform the CLI uses and where that choice came from (--platform, CANVAS_PLATFORM_URL, your last canvas login, or the default), then the account it signs in as, whether the credential is a browser session or a service account token, and each organization’s plugin prefix and what you can do there. When CANVAS_PLATFORM_TOKEN is set alongside a stored session, it says the token takes precedence.
whoami asks Canvas Platform, so a revoked or expired credential is reported rather than shown as signed in. It never prints a token, so it is safe to run in a CI job’s log. It exits non-zero when you are not signed in, with the canvas login command to run.
Usage:
$ canvas whoami [OPTIONS]
Options:
--platform TEXT: Canvas Platform URL--help: Show this message and exit.
canvas init #
Create a new plugin. Signed in to Canvas Platform, the package is named <org prefix>__<package>, the manifest’s publisher is set to the publishing organization, and the plugin is registered with Canvas Platform and given a git repository whose origin is Canvas Platform, ready for canvas deploy. Signed out, the package is named from the project name alone, and init creates it without registering it or giving it a git repository. Run canvas login and then canvas init for a registered plugin. Run canvas whoami first if you are unsure which platform you are signed in to.
Usage:
$ canvas init [OPTIONS] [PLUGIN_TYPE]
Arguments:
PLUGIN_TYPE:handler(default) orapplication
Options:
--org TEXT: Organization that publishes the plugin, when you can publish in several. Without it,initasks.--help: Show this message and exit.
canvas deploy #
Publish a plugin’s code to Canvas Platform and deploy it to one or more instances. With --plugin, deploy released versions of one or more plugins in one deployment instead, without a plugin folder or a push.
Usage:
$ canvas deploy [OPTIONS] PLUGIN_DIR
$ canvas deploy --plugin [PUBLISHER/]NAME@VERSION [--plugin ...] [OPTIONS]
Arguments:
PLUGIN_DIR: Path to the plugin package, the folder that holdsCANVAS_MANIFEST.json. Required unless you pass--plugin, and left out when you do.
Options:
--plugin TEXT: A released plugin to deploy, written[<publisher>/]<name>@<version>, such ascanvas-medical/scribe_core@2.0.0. The version is one exact version in its normal form. Without a publisher, Canvas Platform finds the plugin by name. Repeatable; every--plugingoes out in one deployment. Takes noPLUGIN_DIR,--ref,--no-push,--push-only,--snapshot, or--branch. See Deploying released plugins together.--instance TEXT: Instance slug to deploy to, repeatable. Without it,deploytargets the only instance you can deploy to, and otherwise lists the choices.--ref TEXT: Deploy a pushed branch, tag or commit as-is, without pushing. Canvas Platform deploys a commit that isn’t onmain, such as one pushed with--branch, only to your organization’s test instances. When any instance you name isn’t one of them, nothing is deployed, anddeployexits non-zero with a message that names your organization’s test instances, or says it has none.--no-push: Deploy the pushedmainas-is, without pushing.--push-only: Push HEAD tomain, or to the--branchbranch, without deploying it to any instance, so the plugin’s code and its catalog listing are updated on Canvas Platform. Takes no--instance,--refor--no-push.--branch TEXT: Push HEAD to this branch on Canvas Platform instead ofmainand deploy that commit. Canvas Platform deploys a commit that isn’t onmainonly to your organization’s test instances. Refusesmainand the plugin’s default branch. Works with--push-onlyand--snapshot, and takes no--refor--no-push.--snapshot: Push the committed contents of a plugin inside a larger repository, such as a monorepo, as one new commit onmain, or on the--branchbranch, leaving that repository’s remotes and config alone. See Deploying from a larger repository. Takes no--refor--no-push.-y, --yes: Commit uncommitted changes without prompting, with the default message. Does not approve consent requests.--help: Show this message and exit.
Example:
$ canvas deploy paperwork-eviscerator/acme__paperwork_eviscerator --instance acme-staging
Notes:
What deploy does
- Checks the manifest
nameis a valid plugin name, or a name one of your organizations publishes on Canvas Platform, and that the package folder has the same name. - Runs the same checks as
canvas validate: manifest validation, the static lint, and sandbox-load validation. If any check fails,deployexits with code 1 before it registers, commits, pushes, or deploys anything. - Refuses the package if git ignores any of its Python files (see Plugin repository layout below). Then registers the plugin with Canvas Platform under its publisher (see Choosing the publisher below).
- Points the repository’s
originat Canvas Platform, withcanvasas git’s credential helper for it. - Commits uncommitted changes after you confirm. Without a terminal to confirm at, it refuses uncommitted changes unless you pass
--yes. - Pushes HEAD to
main, or to the branch--branchnames, deploys that commit to each instance, and waits for each instance’s outcome. A commit on a--branchbranch deploys only to your organization’s test instances.
The command exits non-zero unless every instance succeeds, so it can gate a CI job.
With --push-only, deploy stops after the push and prints the command that installs the pushed commit on an instance:
$ canvas deploy paperwork-eviscerator/acme__paperwork_eviscerator --push-only
Pushed acme__paperwork_eviscerator 5d768a166204 to main on Canvas Platform.
To install this commit on an instance: canvas deploy paperwork-eviscerator/acme__paperwork_eviscerator --ref 5d768a166204
Deploying a branch to a test instance
To deploy plugin code not yet merged to main on a test instance, use --branch:
$ canvas deploy paperwork-eviscerator/acme__paperwork_eviscerator --branch try-new-intake --instance acme-staging
deploy pushes HEAD to that branch on Canvas Platform, creating the branch if it doesn’t exist, and deploys the pushed commit. Canvas Platform only allows deploys of a commit that isn’t on main to your organization’s test instances. When any instance you name isn’t one of them, the branch push still happens, nothing is deployed, and deploy exits non-zero with a message that names your organization’s test instances, or says it has none. To choose your test instances, see Designating Test Instances.
deploy pushes to the branch without force, so it can’t replace a commit the branch already holds. After you amend or rebase commits you already pushed, deploy them under a new branch name. With --snapshot, each deploy adds a new commit on top of the branch, so you can keep deploying to the same branch after an amend or rebase. The checks in Deploying from a larger repository still apply.
Plugins built in Canvas Studio
Canvas Studio keeps a plugin’s work in progress on its canvas-studio branch on Canvas Platform. When a Studio project is opened, and before any deploy from it, Studio brings in new commits on main and canvas-studio that it has not synced yet, so changes you push from a canvas clone checkout become part of the project. In Test & Iterate, its next deploy waits for a Studio user to acknowledge the new commits. In Final Review or Published, the project keeps its stage: Studio updates its Testing Checklist to the new commits and redeploys them to the Studio test instance, asking a Studio user first unless that user’s own open or Publish brought the commits in. A gated project that has been promoted does this only in Promoted, while its pull request is open or after it is merged, as described in Working with a monorepo.
- Gated release: Studio’s changes reach you as a pull request in your organization’s repository, and your snapshot deploys on
mainare brought back into the project. See Working with a monorepo. - Direct release: Studio pushes plugin code to
mainwhen a Studio user publishes. To work on in-progress changes with Studio users, push tocanvas-studiowith--branch canvas-studio, which deploys only to your organization’s test instances. Acanvas clonecheckout starts onmain, anddeploypushes without force, so the push is rejected whilecanvas-studioholds commits that HEAD lacks. Rungit fetchandgit checkout canvas-studiofirst, then commit your changes and deploy.
Choosing the publisher
canvas deploy publishes the plugin as:
- The manifest
publisher, when it’s set. - Otherwise, your organization whose prefix the plugin name carries, such as
acmeforacme__intake. - Otherwise, the only organization you can publish in.
- Otherwise, the organization you pick at a terminal. A regular push writes
"publisher"intoCANVAS_MANIFEST.jsonand commits it with the push, so later deploys don’t ask. With--ref,--no-pushor--snapshot, deploy prints the line to add to the manifest instead.
Without a terminal, such as in CI, a deploy stops until the manifest names a publisher when you can publish in several organizations and the name carries none of their prefixes. Add the publisher’s slug to CANVAS_MANIFEST.json and commit it:
"publisher": "acme"
A service account belongs to one organization, so a pipeline that signs in with one publishes as that organization.
Waiting for the outcome
For a plugin Canvas Platform manages, canvas deploy, canvas config set, canvas config unset and canvas uninstall each create a deployment, wait for it to finish, and print each instance’s outcome. They stop waiting after 300 seconds, print a message such as Deploy of acme__intake is still running after 300s (deployment <id>)., and exit non-zero. The CLI does not cancel the deployment when it stops waiting.
Canvas Platform sends a plugin only the stored values whose keys the deployed revision’s manifest declares in variables. When it leaves stored values out, the CLI lists them under that instance’s outcome:
acme__intake on acme-staging: succeeded
Stored values left out because this revision does not declare them: OLD_FLAG
If the plugin still needs one of these values, declare its key in the manifest and deploy again.
Plugins with dependencies, and bundles
A plugin whose manifest names dependencies, including a bundle, deploys like any other: deploy pushes it and creates one deployment that names it. Canvas Platform installs the dependencies in waves, so a plugin goes in after the plugins it depends on. A bundle itself is never sent to an instance; only the plugins it names are. When Canvas Platform reports a target’s wave, the outcome shows it:
acme__intake_form on acme-staging (wave 0): succeeded
acme__intake_summary on acme-staging (wave 1): succeeded
Every dependency must already be on Canvas Platform at a version its pin accepts. Its publisher pushes each release with canvas deploy <plugin dir> --push-only, adding --snapshot for a plugin inside a larger repository.
Deploying released plugins together #
canvas deploy --plugin deploys versions already on Canvas Platform, with no plugin folder and no push. Name each plugin with --plugin; they all go out in one deployment:
$ canvas deploy --plugin canvas-medical/scribe@2.0.0 --plugin acme/intake@3.0.0 --instance acme-staging
Use it when plugins have to change at the same time. For example, when two plugins pin the same dependency, moving that dependency to a new major version means deploying a release of each plugin that pins the new major version, in the same deployment. Canvas Platform deploys the newest commit on the plugin’s main that carries the version a --plugin names.
--plugin is also how you deploy a plugin another organization publishes. Name its publisher, such as --plugin canvas-medical/scribe_core@2.0.0.
When a deployment would leave the plugins on an instance pinning different versions of a dependency, Canvas Platform refuses it and names the plugins. If each plugin in the way has a release that fits, the refusal ends with the canvas deploy --plugin ... command that deploys them together, and deploy prints it as an error. For a deploy of one plugin at a terminal, deploy then asks Deploy them together? [y/N]. Answer y to send the same deployment again, with the plugin at the commit or version you named it at and the plugins in the way added at those releases. Under --yes, without a terminal, for a deploy that names several --plugin, or if you answer n, nothing is deployed; run the printed command to deploy them together.
Plugin repository layout
Canvas Platform hosts one git repository per plugin, rooted at the directory that contains the package:
paperwork-eviscerator/ # repository root
├── acme__paperwork_eviscerator/
│ ├── CANVAS_MANIFEST.json
│ ├── OVERVIEW.md # the plugin's overview in the catalog
│ └── handlers/
├── pyproject.toml
└── tests/
canvas init creates this layout. If the package is not in a git repository yet, deploy offers to create one at its parent directory. A package nested deeper inside a larger repository is refused unless you pass --snapshot; see the next section.
Because deploy pushes a git commit, .gitignore decides what reaches Canvas Platform. Keep virtual environments, node_modules and local secrets out of the repository with it.
Validation reads the package on disk, so a Python file that git ignores passes validation but never reaches the instance. deploy refuses a package that holds one, with or without --snapshot, and names the files. Stop ignoring them in .gitignore, or move them out of the package, then deploy again. Python files under a folder whose name starts with a dot, such as .venv, or under node_modules are skipped, since validation skips them too.
Deploying from a larger repository #
A plugin that lives inside a larger repository, such as a monorepo holding many plugins and other code, deploys with --snapshot. Pass the path to the package folder from anywhere in that repository:
$ canvas deploy plugins/acme__intake --snapshot --instance acme-staging
With --snapshot, deploy:
- Refuses uncommitted changes in the package rather than committing them, even with
--yes. It also refuses a package holding a git submodule, a symbolic link, or a file stored through a git filter such as Git LFS or git-crypt, which would not reach an instance as their content. - Builds one new commit on top of Canvas Platform’s
mainwhose package folder is the package as committed at HEAD. Files onmainbeside the package folder are kept. If the package is unchanged, nothing is pushed and the commit already onmainis deployed. - Pushes that commit from a temporary repository, so the larger repository’s
origin, git config and index are never changed. It then deploys the commit, or stops there with--push-only.
The commit is authored as the person or service account the CLI is signed in as, and its message names its source:
Snapshot of plugins/acme__intake at 3f9a1c2e7b40
Monorepo-Commit: 3f9a1c2e7b40d8e1a6c5f4b3a2918e7d6c5b4a39
Monorepo-Path: plugins/acme__intake
deploy starts from the newest commit on main’s first-parent history that carries a Monorepo-Commit trailer or a snapshot-baseline/ tag, as Canvas Studio tags the commit it starts main from. Lightweight and annotated tags both count. A tagged commit without a Monorepo-Commit trailer names no source commit, so deploy skips the rollback check described below. To mark a commit on main as the starting point yourself, tag it in a canvas clone checkout and push the tag:
$ git tag snapshot-baseline/<sha> <sha>
$ git push origin snapshot-baseline/<sha>
deploy --snapshot stops instead of pushing in two cases:
- HEAD lacks changes
mainwas last deployed with. When the checkout has the commit thatmainwas last snapshotted from,deploycompares it with HEAD from their common ancestor. A package file that commit changed and HEAD did not would go back to its older content, sodeploylists those files and stops. Update the checkout and run it again. A branch that was deployed and then squash- or rebase-merged passes, because HEAD carries its changes under another commit. A shallow checkout usually lacks the deployed commit, sodeploysays on standard error that it could not check, and continues. mainhas changes the snapshot would replace. When package files onmainchanged since the last snapshot, for example through an edit to the plugin’s catalog listing in Canvas Platform, and the snapshot holds different versions of them,deploylists the files. At a terminal it asks whether to replace them; without one it exits non-zero. To keep the changes, copy Canvas Platform’s versions into the package (canvas clonechecks them out), commit them, and run it again. Whenmainhas no snapshot and nosnapshot-baseline/tag yet, every package file already onmaincounts as such a change.
With --branch, the snapshot commit goes to that branch. If the branch exists on Canvas Platform, the commit builds on the branch’s tip, and both checks compare against the branch: a snapshot from a checkout that lacks what the branch was last deployed from stops, while edits made on main after the branch was pushed don’t. A new branch builds on the plugin’s default branch on Canvas Platform and is checked against it. If the package matches the default branch, the new branch points at the default branch’s commit. When the second check stops on a branch, canvas clone the plugin and git checkout that branch to get Canvas Platform’s versions of the files.
deploy also warns when HEAD is on no remote branch, since that code has not been pushed to the larger repository for review. The manifest name decides which Canvas Platform repository a snapshot goes to, so deploys from any checkout or pipeline land on the same main. Working with a monorepo walks through the setup.
Consent for cross-plugin data access
A plugin that reads another plugin’s custom data needs consent before it deploys. At a terminal, deploy shows each consent request and asks you to answer it. Under --yes, or without a terminal, it lists the requests with the deployment id and exits non-zero without answering them.
Validation before push
deploy validates the package whenever it pushes local code: by default, and with --push-only, --branch or --snapshot. With --ref or --no-push, it deploys a commit that is already on Canvas Platform, so it doesn’t validate the local package.
When a handler has new CQM meta properties, manifest validation writes them into CANVAS_MANIFEST.json, as it does under canvas install. By default deploy commits that change with the rest. With --snapshot, the rewritten manifest is an uncommitted change, so commit it and run deploy again.
canvas clone #
Clone a plugin’s repository from Canvas Platform with origin and the credential helper set, ready for canvas deploy.
Usage:
$ canvas clone [OPTIONS] NAME [DIRECTORY]
Arguments:
NAME: Plugin name, e.g.acme__intake[required]DIRECTORY: Where to clone it, a directory named after the plugin by default
Options:
--publisher TEXT: Slug of the organization that publishes the plugin, when two publishers have plugins with the same name--help: Show this message and exit.
canvas install #
Install a plugin into a Canvas instance. A bundle can’t be installed this way; deploy it with canvas deploy.
Usage:
$ canvas install [OPTIONS] PLUGIN_NAME
Arguments:
PLUGIN_NAME: Path to plugin to install [required]
Options:
--variable TEXT: Non-sensitive variables to set, e.g. Key=value--secret TEXT: Sensitive variables to set (treated as sensitive=true), e.g. Key=value--enable / --disable: Install the plugin in an enabled or disabled state. Defaults to--enable.--host TEXT: Canvas instance to connect to--help: Show this message and exit.
Notes:
Where to run it
Run it from one directory above the plugin folder, the one that holds
CANVAS_MANIFEST.json, and pass the folder name. If the manifest is atextensions/encounter_list/CANVAS_MANIFEST.json, run this fromextensions:$ canvas install encounter_list --host your-host- Or run
canvas install .from inside the plugin folder. - The command is
canvas install. There is nocanvas plugin install.
Plugin folder layout
- Keep the manifest, the package’s
__init__.py, and the folders it references (such asroutes/andprotocols/) in the same directory. Class paths in the manifest, such asmy_plugin.routes.charting, resolve from there. - An extra level of nesting, with the manifest outside the inner package folder, makes those paths resolve one level too deep. The plugin loads, but its SimpleAPI endpoints return an empty 404, often with nothing in
canvas logs. If that happens, check the folder structure and that every import in the referenced modules resolves.
Validation before upload
canvas install runs the same checks as canvas validate before it uploads anything:
- Manifest validation (schema, tags, handler resolution)
- Static lint (scans your source for sandbox-forbidden constructs and Custom Data mistakes)
- Sandbox-load validation (imports every handler in the sandbox)
If the static lint reports an error, or a handler fails to load (for example, because of a disallowed import like subprocess), the install stops before the plugin is built or uploaded. Run canvas validate first for detailed per-handler results.
What gets packaged
The CLI packages every file in the plugin folder except:
__pycache__directories*.pycand*.pyofilesnode_modulesdirectories- Hidden files and directories (for example,
.gitand.env) - Symlinks
To exclude more files, add a .canvasignore file:
- Put it in the directory you run
canvas installfrom. The CLI reads it from the current working directory, not from the plugin folder. - It uses .gitignore syntax, and its patterns match paths relative to the plugin folder.
# Exclude test files
test_*.py
The CLI prints a warning, but still installs, when a single file is over 1 MB, the package holds more than 100 files, or its total size is over 1 MB.
Troubleshooting
- The install fails with an HTTP 500: the package usually has too many files, most often because a Python virtual environment was created inside the plugin folder. Rename the folder so it starts with a dot (for example,
.canvas-env), since hidden folders aren’t packaged, or list it in.canvasignore.
canvas uninstall #
Uninstall a plugin. A plugin Canvas Platform manages is removed by an uninstall deployment from each --instance, which is required. Any other plugin is removed from the instance directly once you’re signed out (see Which plugins go through Canvas Platform), using credentials.ini (deprecated; see Instance API credentials).
The plugin’s custom data stays on the instance after an uninstall: its namespace, with every CustomModel table and AttributeHub in it, is kept, because another plugin may share the namespace. A plugin deployed with canvas deploy regains access to that data on its next deploy. A plugin installed with canvas install loses its namespace keys along with its other secrets, so save them before uninstalling; see Uninstalling and Reinstalling a Plugin. To delete the data itself, drop the namespace with canvas namespace drop.
Usage:
$ canvas uninstall [OPTIONS] NAME
Arguments:
NAME: Plugin name to uninstall [required]
Options:
--instance TEXT: Instance slug to uninstall from, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--force: Uninstall an enabled plugin from an instance directly--help: Show this message and exit.
canvas enable #
Enable a plugin. For a plugin Canvas Platform manages, an enable deployment switches it on at each --instance. Without --instance, the CLI targets the only instance the plugin is installed on that you can deploy to. For any other plugin, once you’re signed out (see Which plugins go through Canvas Platform), the CLI enables it on the instance directly with credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas enable [OPTIONS] PLUGIN_NAME
Example:
$ canvas enable acme__my_plugin --instance acme-staging
Arguments:
PLUGIN_NAME: Plugin name to enable [required]
Options:
--instance TEXT: Instance slug to enable the plugin on, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--help: Show this message and exit.
canvas disable #
Disable a plugin. For a plugin Canvas Platform manages, a disable deployment switches it off at each --instance. Without --instance, the CLI targets the only instance the plugin is installed on that you can deploy to. For any other plugin, once you’re signed out (see Which plugins go through Canvas Platform), the CLI disables it on the instance directly with credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas disable [OPTIONS] PLUGIN_NAME
Example:
$ canvas disable acme__my_plugin --instance acme-staging
Arguments:
PLUGIN_NAME: Plugin name to disable [required]
Options:
--instance TEXT: Instance slug to disable the plugin on, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--help: Show this message and exit.
canvas list #
List all plugins on a Canvas instance, with each plugin’s version and whether it’s enabled.
For an instance Canvas Platform manages (see Which instances go through Canvas Platform), the list is Canvas Platform’s most recent inventory of the instance, and the CLI prints the time Canvas Platform collected it to standard error. The inventory can be hours older than the instance’s current state. Until Canvas Platform has collected an inventory of the instance, canvas list reports that it has none and exits with status 1. To read the list from the instance itself, sign out with canvas logout, or unset CANVAS_PLATFORM_TOKEN, and use credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas list [OPTIONS]
Options:
--host TEXT: Canvas instance to connect to--help: Show this message and exit.
canvas validate #
Validate a plugin’s manifest and that all handlers load in the sandbox.
Usage:
$ canvas validate [OPTIONS] PLUGIN_NAME
Arguments:
PLUGIN_NAME: Path to plugin to validate [required]
Options:
--help: Show this message and exit.
This command runs full pre-flight validation combining:
- Manifest validation — Schema checks, tag validation, handler resolution, and unreferenced handler warnings (everything
validate-manifestdoes). - Static lint — Scans the plugin’s source for sandbox-forbidden constructs and Custom Data mistakes before any code runs.
- Sandbox-load validation — Imports every handler the way the plugin runner will, catching violations that would otherwise surface only at runtime on the instance.
Static lint #
Before it loads any handlers, canvas validate scans every .py file in the plugin — skipping directories like tests, build, and dist within the plugin — for patterns that compile cleanly but fail, or silently misbehave, once your code runs on the instance. Each finding is reported with a rule code in brackets. Warnings are printed but do not block validation; any error fails the command and exits with code 1.
$ canvas validate my_plugin
⚠ my_plugin/handlers/protocol.py:42 [custom-model-id-vs-dbid] Widget.objects.filter(id=…) — CustomModels use `dbid` as their primary key (only core SDK models have `id`). Use `dbid=…` instead.
These issues will fail on the instance (sandbox / Custom Data):
✗ my_plugin/handlers/protocol.py:18 [type-blocked] `type()` takes one argument in the sandbox. Declare classes with `class … :` rather than `type(name, bases, dict)`.
Sandbox constructs (errors). These compile under RestrictedPython but are rejected when a handler runs on the instance, so a plain sandbox load can miss them. See Sandboxing and Allowed Imports for the full list and the allowed alternatives.
| Rule code | Flags |
|---|---|
type-blocked | A type() call with anything other than a single argument, such as type(name, bases, dict). The sandbox’s type takes one argument, so declare classes with class …: instead. type(x) is not flagged. |
augmented-subscript | Augmented assignment on a subscript, e.g. d[k] += v — rewrite as d[k] = d[k] + v |
augmented-attribute | Augmented assignment on an attribute, e.g. obj.attr += v — rewrite as obj.attr = obj.attr + v |
@dataclass(frozen=True) and @dataclass(slots=True) load and run fine in the sandbox and are intentionally not flagged.
Custom Data (errors). Both leave tables silently uncreated, so queries fail at runtime. See Custom Models and the Quick Start for setup.
| Rule code | Flags |
|---|---|
custom-model-wrong-dir | A CustomModel subclass defined outside <plugin>/models/ — Canvas only loads models from that directory |
missing-custom-data-block | CustomModels are present but the manifest has no custom_data block (an empty block counts as missing — it must be non-empty) |
Custom Data (warnings). These don’t block validation but usually indicate a bug:
| Rule code | Flags |
|---|---|
custom-model-id-vs-dbid | .filter(id=…) / .get(id=…) on a local CustomModel — CustomModels key on dbid, not id. Use dbid=… |
lazy-fk-string-ref | A ForeignKey/OneToOneField/ManyToManyField with a string reference to a CustomModel defined in this plugin — import the class and pass it directly |
Request handling (warnings). This code runs without errors, so a sandbox load doesn’t catch it, but it makes the plugin less secure or less reliable:
| Rule code | Flags |
|---|---|
secret-compared-with-eq | == or != between a plugin secret (self.secrets[...], self.secrets.get(...), or a local variable assigned from one) and a value from the request (a credentials field, a header, a query parameter, or a path parameter). Compare secrets in constant time instead: use APIKeyAuthMixin, or hmac.compare_digest(a.encode(), b.encode()). A secret compared with a constant isn’t flagged. |
requests-no-timeout | A requests.get, post, put, patch, delete, head, options, or request call with no timeout= argument and no **kwargs. Without a timeout, requests waits for a slow server indefinitely, and the handler waits with it. Pass timeout=, or use Http, which always sets one. |
Sandbox-load validation #
After the static lint passes, sandbox-load validation executes each handler module in the plugin sandbox to catch:
- Disallowed imports — Modules like
subprocess,socket, orosthat are blocked by the sandbox. - RestrictedPython compile-time errors — Syntax or constructs that RestrictedPython cannot compile.
- Import errors — Missing dependencies or broken imports.
- Refused code in helper modules — Functions in the modules your handlers import that contain code the sandbox refuses. Every handler fails with a
PluginInstallationErrorlisting each construct by module and line. See Helper modules.
For each handler, the output shows whether it loaded successfully:
$ canvas validate my_plugin
Loading 2 handler(s) in the sandbox:
✓ my_plugin.handlers.events:MyHandler
✗ my_plugin.handlers.api:APIHandler
ImportError: 'subprocess' is not an allowed import
1 of 2 handler(s) failed to load in the sandbox.
The command exits with code 1 if any handler fails validation.
If your handlers read attributes that don’t exist while they load, the output ends with a warning that lists them. In the sandbox those reads return None for now, and a future release will raise AttributeError instead (see Attributes that don’t exist). The warning doesn’t fail validation:
$ canvas validate my_plugin
Loading 1 handler(s) in the sandbox:
✓ my_plugin.handlers.events:MyHandler
Warning: these names do not exist. Each reads as None today and will raise an AttributeError in a future release:
- Settings.retry_limit
Limitations #
A passing canvas validate confirms that handlers import cleanly under the sandbox — it does not guarantee the plugin is fully sandbox-clean. RestrictedPython checks attribute and item access inside compute() at request time, not at import time, so violations during handler execution won’t be caught by this command.
canvas validate-manifest #
Validate the Canvas Manifest json file.
Usage:
$ canvas validate-manifest [OPTIONS] PLUGIN_NAME
Arguments:
PLUGIN_NAME: Path to plugin to validate [required]
Options:
--help: Show this message and exit.
Validations performed:
- Schema validation — Checks that
CANVAS_MANIFEST.jsoncontains all required fields and valid values. - Handler resolution — Verifies that every handler class declared in the manifest (
protocols,applications, andhandlers) resolves to a file the plugin runner can find at runtime.
Handler resolution and directory layout #
The plugin runner loads handlers by mapping dotted module paths to files relative to the plugin’s install directory. For a plugin named my_plugin with a handler class my_plugin.handlers.events:MyHandler, the runner expects handlers/events.py inside the plugin directory — the directory containing CANVAS_MANIFEST.json.
A common mistake is placing CANVAS_MANIFEST.json in a parent directory above the plugin package. This passes schema validation and works locally, but fails at runtime with ModuleNotFoundError — the handler files are nested one level too deep.
Correct layout:
my_plugin/
├── CANVAS_MANIFEST.json # ← manifest inside the package
├── handlers/
│ └── events.py
└── ...
Incorrect layout:
project/
├── CANVAS_MANIFEST.json # ← manifest above the package (wrong!)
└── my_plugin/
└── handlers/
└── events.py
If validate-manifest detects handlers that won’t resolve, it reports which classes are affected and the file paths the runner expects:
Error: these handler classes won't be found by the plugin runner with the current directory layout:
- my_plugin.handlers.events:MyHandler
runner expects: my_plugin/handlers/events.py
CANVAS_MANIFEST.json must live inside the plugin's package directory (the directory whose name matches the manifest "name"), alongside the handler packages — not in a parent directory above them.
canvas logs #
Subscribes to a log stream and prints to your console. Optionally fetches historical logs first.
canvas logs chooses its credential per instance:
- An instance Canvas Platform manages, when you’re signed in with
canvas loginor a service account token: the CLI reads the logs with a 15-minute log token from Canvas Platform. It gets a new token before the current one expires, and a live follow reconnects with a new token when the log stream ends the old one, so a long history read or a live follow keeps running. - Any other Canvas instance, while you’re signed in:
canvas logsrefuses it with the way to sign out (canvas logout, or unsettingCANVAS_PLATFORM_TOKEN). - Any instance when you’re not signed in, or
localhost: the CLI uses the instance’scredentials.iniclient (deprecated; see Instance API credentials). For a Canvas instance, it also prints a deprecation notice.
When Canvas Platform can’t issue a log token for a managed instance, for example because the instance runs an older Canvas release, canvas logs prints the reason and exits, as described in Which instances go through Canvas Platform.
When the log stream doesn’t start, canvas logs exits with status 1, whichever credential it used, so a script can tell a failed stream from one that ran. When Console, the Canvas log stream service, refuses the stream, the error quotes its answer, for example Console refused the log stream for <instance>. Console answered: No instance named '<instance>' was found. When the connection fails before the stream starts, the error gives the connection failure and asks you to run the command again. Stopping a live follow with Ctrl+C exits with status 0.
Usage:
$ canvas logs [OPTIONS]
Options:
--host TEXT: Canvas instance to connect to--help: Show this message and exit.--since TEXT: Lookback window (e.g. ‘24h’, ‘2h30m’). Mutually exclusive with –start/–end.--start TEXT: Start time (ISO/RFC3339) or ‘now’.--end TEXT: End time (ISO/RFC3339) or ‘now’. Defaults to now if start is provided.--no-follow: Historical only; do not stream live logs.--level TEXT: Repeatable. –level ERROR –level WARN--source TEXT: Filter by source/service.--plugin TEXT: Repeatable. –plugin foo –plugin bar. Filters history and the live stream.--handler TEXT: Repeatable. Qualified handler name (e.g. my_plugin.handlers.Foo).--page-size INTEGER: Fetch size per page (historical). [default: 200]--limit INTEGER: Max historical logs to print.--all: Fetch all pages until exhausted (historical).--interactive: After each page, prompt to load more.--cursor TEXT: Resume token from a previous run.--help: Show this message and exit.
canvas config list #
List a plugin’s variables and whether each one is set. Each variable is rendered as [set] or [not set], with a (sensitive) annotation for sensitive variables. Values themselves are never displayed — to read a value, use the Django Admin UI (gated by managing-user permissions).
For a plugin Canvas Platform manages, the CLI reads the variables from Canvas Platform for each --instance. Without --instance, it uses the only instance the plugin is installed on; when the plugin is installed on more than one instance, name one with --instance. For any other plugin, once you’re signed out (see Which plugins go through Canvas Platform), the CLI reads the variables from the instance directly with credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas config list [OPTIONS] PLUGIN_NAME
Example output:
$ canvas config list acme__my_plugin --instance acme-staging
API_TOKEN = [set] (sensitive)
WEBHOOK_URL = [set]
DEBUG_MODE = [not set]
When you pass more than one --instance, the CLI prints each instance’s slug above its variables.
Arguments:
PLUGIN_NAME: Plugin name to list variables for
Options:
--instance TEXT: Instance slug to read the variables from, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--help: Show this message and exit.
canvas config set #
Set (or update) one or more plugin variables. Pass one or more KEY=value pairs as positional arguments.
For a plugin Canvas Platform manages, the values are stored in Canvas Platform and a configure deployment brings them to the running plugin on each --instance. Without --instance, the only instance the plugin is installed on that you can configure is targeted. Values are kept per instance, and a later canvas deploy carries them forward for the keys that revision declares; see Waiting for the outcome.
For a plugin Canvas Platform does not manage, once you’re signed out (see Which plugins go through Canvas Platform), the values are written to the instance directly with credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas config set [OPTIONS] PLUGIN [KEY=VALUE]...
Examples:
Set a single variable:
$ canvas config set acme__my_plugin API_TOKEN=your_api_token_value --instance acme-staging
Set multiple variables in one call:
$ canvas config set acme__my_plugin API_TOKEN=abc123 LOG_LEVEL=info --instance acme-staging
Set a variable whose value is a list with one entry per line — for example a redirect allowlist (see the Redirect effect). The value is newline-delimited (not comma-separated), so use your shell’s newline quoting to preserve the line breaks. In bash/zsh, ANSI-C quoting ($'…') turns \n into a real newline:
$ canvas config set acme__my_plugin $'REDIRECT_ALLOWLIST_INTERNAL=/panel\n/patient' --instance acme-staging
Arguments:
PLUGIN: Plugin name to set variables forKEY=VALUE...: Variables to set, keeping each one’s declared sensitivity
Options:
--instance TEXT: Instance slug to configure, repeatable--secret KEY=VALUE: Set a sensitive value for a key no revision of the manifest declares, repeatable--variable KEY=VALUE: Set a non-sensitive value for a key no revision of the manifest declares, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--help: Show this message and exit.
Whether each value is treated as sensitive is determined by the plugin’s
CANVAS_MANIFEST.json(variables: [{name, sensitive}]) —canvas config setdoes not change the sensitive flag of a declared variable.
canvas config unset #
Clear one or more plugin variables. For a plugin Canvas Platform manages, the values are cleared in Canvas Platform and a configure deployment removes them from the running plugin. For any other plugin, once you’re signed out (see Which plugins go through Canvas Platform), each value is set to empty on the instance directly with credentials.ini (deprecated; see Instance API credentials).
Usage:
$ canvas config unset [OPTIONS] PLUGIN KEY...
Arguments:
PLUGIN: Plugin name to clear variables forKEY...: Variable keys to clear, e.g.API_KEY
Options:
--instance TEXT: Instance slug to configure, repeatable--host TEXT: Canvas instance to connect to, for a plugin Canvas Platform does not manage--help: Show this message and exit.