Skip to content

canvas auth token set

canvas auth token set

Set API token for an instance

Synopsis

Set an API access token for a Canvas instance.

This is an alternative to OAuth authentication. Generate a token in Canvas under Account > Settings > New Access Token.

If the instance doesn't exist, it will be created (requires --url). If the instance exists, the token will be updated.

Examples:

# Set token for an existing instance
canvas auth token set myschool --token 7~abc123...

# Create a new instance with token auth
canvas auth token set sandbox --url https://sandbox.instructure.com --token 7~xyz789...

# Interactive mode (prompts for token)
canvas auth token set myschool
canvas auth token set <instance-name> [flags]

Options

  -h, --help           help for set
      --token string   API access token
      --url string     Canvas instance URL (required for new instances)

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")
      --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 25-Jan-2026