Skip to main content
POST
/
sandbox
/
github
/
{sandbox_id}
/
initialize
Initialize github sandbox with data
curl --request POST \
  --url https://api.klavis.ai/sandbox/github/{sandbox_id}/initialize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "repos": [
    {
      "name": "test-repo",
      "description": "A test repository for GitHub sandbox",
      "branches": [
        {
          "name": "main",
          "folders": {
            "name": "root",
            "path": "",
            "files": [
              {
                "name": "README.md",
                "path": "README.md",
                "content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs"
              }
            ],
            "folders": [
              {
                "name": "src",
                "path": "src",
                "files": [
                  {
                    "name": "main.py",
                    "path": "src/main.py",
                    "content": "def main():\n    print('Hello, GitHub Sandbox!')\n\nif __name__ == '__main__':\n    main()"
                  }
                ],
                "folders": []
              }
            ]
          }
        },
        {
          "name": "feature-branch",
          "folders": {
            "name": "root",
            "path": "",
            "files": [
              {
                "name": "README.md",
                "path": "README.md",
                "content": "# Test Repository\n\nThis is a test repository for the GitHub sandbox.\n\n## Features\n- Test files\n- Test folders\n- Sample issues and PRs\n- New feature in development"
              }
            ],
            "folders": [
              {
                "name": "src",
                "path": "src",
                "files": [
                  {
                    "name": "main.py",
                    "path": "src/main.py",
                    "content": "def main():\n    print('Hello, GitHub Sandbox!')\n    print('New feature added!')\n\nif __name__ == '__main__':\n    main()"
                  },
                  {
                    "name": "feature.py",
                    "path": "src/feature.py",
                    "content": "def new_feature():\n    return 'This is a new feature'\n"
                  }
                ],
                "folders": []
              }
            ]
          }
        }
      ],
      "issues": [
        {
          "issue_title": "Sample issue for testing",
          "description": "This is a test issue created for GitHub sandbox testing.\n\n## Description\nWe should implement feature X.\n\n## Steps\n1. Plan the feature\n2. Implement the code\n3. Write tests",
          "status": "open",
          "labels": [
            "bug",
            "enhancement"
          ]
        }
      ],
      "prs": [
        {
          "pr_title": "Add new feature",
          "description": "This PR adds a new feature to the repository.\n\n## Changes\n- Added new functionality\n- Updated documentation\n- Added tests",
          "status": "open",
          "source_branch": "feature-branch",
          "target_branch": "main",
          "labels": [
            "enhancement"
          ]
        }
      ]
    }
  ]
}
EOF
{
  "sandbox_id": "<string>",
  "status": "idle",
  "message": "<string>",
  "records_created": {}
}

Authorizations

Authorization
string
header
required

Your Klavis AI API key.

Path Parameters

sandbox_id
string
required

The unique sandbox identifier

Query Parameters

init_default_data
boolean
default:false

If true, use default test data for initialization

Body

application/json

Complete GitHub sandbox data structure

repos
GitHubRepo · object[] | null

List of repositories

Response

Successful Response

Response model for sandbox initialization

sandbox_id
string
required

Sandbox identifier

status
enum<string>
required

Current status

Available options:
idle,
occupied,
error
message
string
required

Initialization result message

records_created
Records Created · object

Count of records created per object type