@od-canvas/cli
v1.0.0
Published
Canvas CLI for managing content and projects
Downloads
6
Readme
Canvas CLI
A command-line interface for managing Canvas CMS content and projects.
Installation
npm install -g @canvas/cliOr use with npx:
npx @canvas/cli projects listConfiguration
Set the following environment variables in your .env file or shell:
CANVAS_API_URL=http://localhost:8080/api
CANVAS_API_KEY=your_api_key_hereYou can also create a .env file in your project directory and the CLI will automatically load it.
Commands
Projects
Manage Canvas projects.
List all projects
canvas projects listShows all projects you own with document counts and creation dates.
Create a new project
canvas projects create "My Blog"Creates a new project and returns the project ID.
Get project details
canvas projects get 1Shows detailed information about a specific project.
Documents
Manage documents within a project.
List documents in a project
canvas docs list 1Lists all documents in project ID 1, showing:
- Document ID and title
- Published/Draft status
- Last update date
API Keys
Manage API keys for external integrations.
List API keys for a project
canvas keys list 1Shows all API keys for project ID 1, including:
- Key name
- Partial key value (first 16 characters)
- Creation date
Configuration
View current configuration.
canvas configShows:
- Canvas API URL
- Whether API key is set
Examples
Setting up for Astro blog
# Set your Canvas credentials
export CANVAS_API_URL=http://localhost:8080/api
export CANVAS_API_KEY=your_key_from_project_settings
# List your projects
canvas projects list
# List documents in project 1
canvas docs list 1
# View API keys for project 1
canvas keys list 1Creating a new project for a blog
# Create project
canvas projects create "My Blog"
# Get the project ID from the output (e.g., 2)
# Use this ID in your Astro blog .env.local:
# CANVAS_PROJECT_ID=2Help
canvas --help # Show all commands
canvas projects --help # Show projects subcommands
canvas docs --help # Show docs subcommands
canvas keys --help # Show keys subcommandsAuthentication
The CLI uses API keys for authentication. Generate API keys in the Canvas Admin Panel:
- Go to your Project → Settings
- Find the "API Keys" section
- Click "Generate New Key"
- Copy the key and set it as
CANVAS_API_KEYenvironment variable
Version
canvas --versionShows the CLI version.
