Skip to content

canvas assignments create

canvas assignments create

Create a new assignment

Synopsis

Create a new assignment in a Canvas course.

You can provide assignment data via flags or JSON file/stdin.

Examples:

# Using flags
canvas assignments create --course-id 123 --name "Quiz 1" --points 100
canvas assignments create --course-id 123 --name "Essay" --points 50 --due-at "2025-02-01T23:59:00Z"

# Using JSON file
canvas assignments create --course-id 123 --json assignment.json

# Using stdin

echo '{"name":"Quiz 1","points_possible":100}' | canvas assignments create --course-id 123 --stdin

canvas assignments create [flags]

Options

      --course-id int              Course ID (required)
      --description string         Assignment description (HTML)
      --due-at string              Due date (ISO8601 format)
      --grading-type string        Grading type (points, pass_fail, percent, letter_grade, gpa_scale, not_graded)
      --group-id int               Assignment group ID
  -h, --help                       help for create
      --json string                JSON file with assignment data
      --lock-at string             Lock date (ISO8601 format)
      --name string                Assignment name
      --points float               Points possible
      --position int               Position in the assignment group
      --published                  Publish the assignment
      --stdin                      Read JSON from stdin
      --submission-types strings   Submission types (online_text_entry, online_url, online_upload, media_recording, none)
      --unlock-at string           Unlock date (ISO8601 format)

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