---
title: "Initialize canvas sandbox with data"
method: POST
path: "/local-sandbox/canvas/{sandbox_id}/initialize"
tags: ["local-sandbox"]
---

# Initialize canvas sandbox with data

`POST /local-sandbox/canvas/{sandbox_id}/initialize`

## Request

- Base URL: `https://api.klavis.ai`
- URL: `https://api.klavis.ai/local-sandbox/canvas/{sandbox_id}/initialize`
- Auth: HTTP bearer

Initialize the sandbox with canvas-specific data following the defined schema.

## Path parameters

- `sandbox_id` string, required: The unique sandbox identifier

## Query parameters

- `init_default_data` boolean: If true, use default test data for initialization

## Request body

- CanvasDataInput: Complete Canvas sandbox data structure for initialize/dump operations. Canvas sandboxes come pre-baked with ~500 users and 3 admin accounts. This schema allows loading additional course data on top of the pre-baked state. Example: { "courses": [ { "name": "Introduction to CS", "course_code": "CS101", "published": true, "assignments": [...], "quizzes": [...], "enrollments": [ {"user_email": "rkelly27@mcp.com", "role": "StudentEnrollment"} ] } ] }
  - `courses` CanvasCourseInput[]: Courses to create/load into the Canvas instance
    - `name` string, required: Course name
    - `course_code` string, required: Course code (e.g. CS101)
    - `published` boolean: Whether the course is published
    - `assignments` CanvasAssignmentInput[]: Course assignments
      - `name` string, required: Assignment name
      - `description` string, nullable: Assignment description (HTML)
      - `points_possible` number, nullable: Maximum points
      - `due_at` string, nullable: Due date in ISO 8601 format
      - `submission_types` string[]: Allowed submission types: online_text_entry, online_upload, online_url, etc.
      - `published` boolean: Whether the assignment is published
    - `quizzes` CanvasQuizInput[]: Course quizzes
      - `title` string, required: Quiz title
      - `description` string, nullable: Quiz description (HTML)
      - `quiz_type` string: Quiz type: practice_quiz, assignment, graded_survey, survey
      - `time_limit` integer, nullable: Time limit in minutes
      - `published` boolean: Whether the quiz is published
      - `due_at` string, nullable: Due date in ISO 8601 format
      - `questions` CanvasQuizQuestionInput[]: Quiz questions
        - `question_name` string, nullable: Short name/label for the question
        - `question_text` string, required: The question text (supports HTML)
        - `question_type` string: Question type: multiple_choice_question, true_false_question, short_answer_question, essay_question, etc.
        - `points_possible` number: Points for this question
        - `answers` object[], nullable: Answer options. Each dict has 'answer_text' and 'answer_weight' (100 = correct, 0 = wrong)
    - `enrollments` CanvasEnrollmentInput[]: Course enrollments
      - `user_email` string, required: Email of the user to enroll (must exist in Canvas)
      - `role` string: Enrollment role: StudentEnrollment, TeacherEnrollment, TaEnrollment
    - `announcements` object[], nullable: Course announcements. Each dict has 'title' and 'message' (HTML)

## Response `200`

Successful Response

- InitializeSandboxResponse: Response model for sandbox initialization
  - `sandbox_id` string, required: Sandbox identifier
  - `status` 'idle' | 'occupied' | 'error', required: Status of a sandbox instance - matches database enum
  - `message` string, required: Initialization result message

## Other responses

- `422`: Validation Error

## Changes

- **2026-03-04** `f000cc1bf64f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/changes/local-sandbox/canvas/:sandbox_id/initialize/post.md)

---

[API](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai.md) - [All operations](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/llms.txt) - [OpenAPI document](https://skmtc.dev/klavis-ai/apis/klavis-ai-https-www-klavis-ai/revisions/1f05ced7280f?raw)
