Skip to content

canvas context

canvas context

Manage working context (course, assignment, user IDs)

Synopsis

Manage the current working context for Canvas CLI.

Context allows you to store default values for course_id, assignment_id, user_id, and account_id. Commands that support context use the stored value when the corresponding flag is not provided.

Currently 'canvas assignments list' and 'canvas assignments get' use the course context; other commands still require explicit flags.

Examples:

# Set the current course
canvas context set course 123

# Commands that support context pick it up automatically
canvas assignments list      # uses course_id 123
canvas assignments get 456   # uses course_id 123

# Show current context
canvas context show

# Clear all context
canvas context clear

# Clear specific context value
canvas context clear course

Options

  -h, --help   help for context

Options inherited from parent commands

      --as-user int       Masquerade as another user (admin feature, requires permission)
      --columns strings   Select specific columns to display (comma-separated)
      --config string     config file (default is $HOME/.canvas-cli/config.yaml)
      --dry-run           Print curl commands instead of executing requests
      --filter string     Filter results by text (case-insensitive substring match)
      --instance string   Canvas instance URL (overrides config)
      --limit int         Limit number of results for list operations (0 = unlimited)
      --no-cache          Disable caching of API responses
  -o, --output string     Output format: table, json, yaml, csv (default "table")
      --quiet             Suppress informational messages, only output data and errors
      --show-token        Show actual token in dry-run output (default: redacted)
      --sort string       Sort results by field (prefix with - for descending, e.g., -name)
  -v, --verbose           Enable verbose output

SEE ALSO

Auto generated by spf13/cobra on 14-Jul-2026