> ## Documentation Index
> Fetch the complete documentation index at: https://www.klavis.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Initialize github sandbox with data

> Initialize the sandbox with github-specific data following the defined schema.



## OpenAPI

````yaml post /sandbox/github/{sandbox_id}/initialize
openapi: 3.1.0
info:
  title: Klavis AI (https://www.klavis.ai)
  description: Klavis AI - Open Source MCP Integrations for AI Applications
  version: 0.1.0
servers:
  - url: https://api.klavis.ai
    description: US Production server
  - url: https://api.eu.klavis.ai
    description: EU Production server
security: []
paths:
  /sandbox/github/{sandbox_id}/initialize:
    post:
      tags:
        - sandbox
      summary: Initialize github sandbox with data
      description: >-
        Initialize the sandbox with github-specific data following the defined
        schema.
      operationId: initialize_sandbox_sandbox_github__sandbox_id__initialize_post
      parameters:
        - name: sandbox_id
          in: path
          required: true
          schema:
            type: string
            description: The unique sandbox identifier
            title: Sandbox Id
          description: The unique sandbox identifier
        - name: init_default_data
          in: query
          required: false
          schema:
            type: boolean
            description: If true, use default test data for initialization
            default: false
            title: Init Default Data
          description: If true, use default test data for initialization
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/GitHubData-Input'
                - type: 'null'
              title: Request Body
            examples:
              default:
                summary: Example initialization data
                value:
                  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


                                  This is a test repository for the GitHub
                                  sandbox.


                                  ## Features

                                  - Test files

                                  - Test folders

                                  - Sample issues and PRs
                            folders:
                              - name: src
                                path: src
                                files:
                                  - name: main.py
                                    path: src/main.py
                                    content: |-
                                      def main():
                                          print('Hello, GitHub Sandbox!')

                                      if __name__ == '__main__':
                                          main()
                                folders: []
                        - name: feature-branch
                          folders:
                            name: root
                            path: ''
                            files:
                              - name: README.md
                                path: README.md
                                content: >-
                                  # Test Repository


                                  This is a test repository for the GitHub
                                  sandbox.


                                  ## Features

                                  - Test files

                                  - Test folders

                                  - Sample issues and PRs

                                  - New feature in development
                            folders:
                              - name: src
                                path: src
                                files:
                                  - name: main.py
                                    path: src/main.py
                                    content: |-
                                      def main():
                                          print('Hello, GitHub Sandbox!')
                                          print('New feature added!')

                                      if __name__ == '__main__':
                                          main()
                                  - name: feature.py
                                    path: src/feature.py
                                    content: |
                                      def new_feature():
                                          return 'This is a new feature'
                                folders: []
                      issues:
                        - issue_title: Sample issue for testing
                          description: >-
                            This is a test issue created for GitHub sandbox
                            testing.


                            ## Description

                            We should implement feature X.


                            ## Steps

                            1. Plan the feature

                            2. Implement the code

                            3. Write tests
                          status: open
                          labels:
                            - bug
                            - enhancement
                      prs:
                        - pr_title: Add new feature
                          description: |-
                            This PR adds a new feature to the repository.

                            ## Changes
                            - Added new functionality
                            - Updated documentation
                            - Added tests
                          status: open
                          source_branch: feature-branch
                          target_branch: main
                          labels:
                            - enhancement
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitializeSandboxResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    GitHubData-Input:
      properties:
        repos:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubRepo-Input'
              type: array
            - type: 'null'
          title: Repos
          description: List of repositories
      type: object
      title: GitHubData
      description: Complete GitHub sandbox data structure
    InitializeSandboxResponse:
      properties:
        sandbox_id:
          type: string
          title: Sandbox Id
          description: Sandbox identifier
        status:
          $ref: '#/components/schemas/SandboxStatus'
          description: Current status
        message:
          type: string
          title: Message
          description: Initialization result message
      type: object
      required:
        - sandbox_id
        - status
        - message
      title: InitializeSandboxResponse
      description: Response model for sandbox initialization
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GitHubRepo-Input:
      properties:
        name:
          type: string
          title: Name
          description: Repository name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Repository description
        branches:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubBranch-Input'
              type: array
            - type: 'null'
          title: Branches
          description: List of branches with their folder structures
        prs:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubPullRequest'
              type: array
            - type: 'null'
          title: Prs
          description: List of pull requests
        issues:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubIssue'
              type: array
            - type: 'null'
          title: Issues
          description: List of issues
      type: object
      required:
        - name
      title: GitHubRepo
      description: GitHub Repository object
    SandboxStatus:
      type: string
      enum:
        - idle
        - occupied
        - error
      title: SandboxStatus
      description: Status of a sandbox instance - matches database enum
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    GitHubBranch-Input:
      properties:
        name:
          type: string
          title: Name
          description: Branch name
        folders:
          anyOf:
            - $ref: '#/components/schemas/GitHubFolder-Input'
            - type: 'null'
          description: Root folder structure for this branch
      type: object
      required:
        - name
      title: GitHubBranch
      description: GitHub Branch object
    GitHubPullRequest:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: PR ID (read-only, set by GitHub)
        pr_title:
          type: string
          title: Pr Title
          description: Pull request title
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Pull request description/body
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: 'PR state: open, closed, or merged'
          default: open
        source_branch:
          type: string
          title: Source Branch
          description: Head branch name
        target_branch:
          type: string
          title: Target Branch
          description: Base branch name
          default: main
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Labels
          description: List of label names
      type: object
      required:
        - pr_title
        - source_branch
      title: GitHubPullRequest
      description: GitHub Pull Request object
    GitHubIssue:
      properties:
        id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Id
          description: Issue ID (read-only, set by GitHub)
        issue_title:
          type: string
          title: Issue Title
          description: Issue title
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Issue description/body
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          description: 'Issue state: open or closed'
          default: open
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Labels
          description: List of label names
      type: object
      required:
        - issue_title
      title: GitHubIssue
      description: GitHub Issue object
    GitHubFolder-Input:
      properties:
        name:
          type: string
          title: Name
          description: Folder name
        path:
          type: string
          title: Path
          description: Folder path within the repository
        files:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubFile'
              type: array
            - type: 'null'
          title: Files
          description: Files within this folder
        folders:
          anyOf:
            - items:
                $ref: '#/components/schemas/GitHubFolder-Input'
              type: array
            - type: 'null'
          title: Folders
          description: Subfolders within this folder
      type: object
      required:
        - name
        - path
      title: GitHubFolder
      description: GitHub Folder object
    GitHubFile:
      properties:
        name:
          type: string
          title: Name
          description: File name
        path:
          type: string
          title: Path
          description: File path within the repository
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: File content
      type: object
      required:
        - name
        - path
      title: GitHubFile
      description: GitHub File object
  securitySchemes:
    HTTPBearer:
      type: http
      description: Your Klavis AI API key.
      scheme: bearer
      x-fern-bearer:
        name: api_key

````