> ## 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 gmail sandbox with data

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



## OpenAPI

````yaml post /sandbox/gmail/{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/gmail/{sandbox_id}/initialize:
    post:
      tags:
        - sandbox
      summary: Initialize gmail sandbox with data
      description: >-
        Initialize the sandbox with gmail-specific data following the defined
        schema.
      operationId: initialize_sandbox_sandbox_gmail__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/GmailData'
                - type: 'null'
              title: Request Body
            examples:
              default:
                summary: Example initialization data
                value:
                  messages:
                    - subject: Weekly Team Update
                      to: johndoe@klavis.ai
                      cc: johndoe@klavis.ai
                      body: |-
                        Hi Team,

                        Here's our weekly update:

                        1. Project A is on track
                        2. Sprint planning next week
                        3. New hire starting Monday

                        Best regards
                      labels:
                        - INBOX
                        - IMPORTANT
                    - subject: Project Status Report
                      to: johndoe@klavis.ai
                      body: >-
                        Dear Client,


                        I'm writing to update you on the project status. All
                        milestones are being met on schedule.


                        Key accomplishments this week:

                        - Completed Phase 1

                        - Initiated Phase 2

                        - Stakeholder review meeting scheduled


                        Looking forward to our next meeting.


                        Best regards
                      labels:
                        - INBOX
                    - subject: 'Follow-up on Support Ticket #12345'
                      to: johndoe@klavis.ai
                      body: >-
                        Hello Support Team,


                        I wanted to follow up on ticket #12345. Has there been
                        any progress on this issue?


                        Thank you for your assistance.


                        Best regards
                      labels:
                        - INBOX
                    - subject: Meeting Notes - Q4 Planning
                      to: johndoe@klavis.ai
                      cc: johndoe@klavis.ai
                      body: |-
                        Hi everyone,

                        Attached are the notes from our Q4 planning session:

                        - Budget allocation approved
                        - New initiatives prioritized
                        - Timeline established

                        Please review and provide feedback by EOW.

                        Thanks
                      labels:
                        - INBOX
                        - CATEGORY_UPDATES
                    - subject: Quarterly Review Reminder
                      to: johndoe@klavis.ai
                      body: >-
                        Team,


                        Friendly reminder that quarterly reviews are due next
                        Friday.


                        Please complete your self-assessment and submit to your
                        manager.


                        Thank you!
                      labels:
                        - INBOX
                  drafts:
                    - subject: 'Re: Partnership Proposal'
                      to: partner@example.com
                      body: >-
                        Hi there,


                        Thank you for reaching out regarding the partnership
                        opportunity. I'm very interested in learning more.


                        Could we schedule a call next week to discuss further?


                        Best regards
                    - subject: Vacation Request - December
                      to: hr@example.com
                      cc: manager@example.com
                      body: >-
                        Dear HR,


                        I would like to request vacation time from December
                        20-30, 2024.


                        Please let me know if you need any additional
                        information.


                        Thank you
                    - subject: Product Feedback
                      to: product@example.com
                      body: |-
                        Hi Product Team,

                        I wanted to share some feedback on the recent update:

                        1. The new dashboard is much more intuitive
                        2. Performance has improved significantly
                        3. One suggestion: add keyboard shortcuts

                        Overall, great work!

                        Best
      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:
    GmailData:
      properties:
        messages:
          anyOf:
            - items:
                $ref: '#/components/schemas/GmailMessage'
              type: array
            - type: 'null'
          title: Messages
          description: List of Gmail messages to send
        drafts:
          anyOf:
            - items:
                $ref: '#/components/schemas/GmailDraft'
              type: array
            - type: 'null'
          title: Drafts
          description: List of Gmail drafts to create
      type: object
      title: GmailData
      description: Complete Gmail sandbox data structure with all supported objects
    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
    GmailMessage:
      properties:
        subject:
          type: string
          maxLength: 255
          title: Subject
          description: Email subject (required)
        to:
          type: string
          title: To
          description: Recipient email address (required)
        cc:
          anyOf:
            - type: string
            - type: 'null'
          title: Cc
          description: CC email addresses (comma-separated)
        bcc:
          anyOf:
            - type: string
            - type: 'null'
          title: Bcc
          description: BCC email addresses (comma-separated)
        body:
          type: string
          title: Body
          description: Email body content (required)
        from:
          anyOf:
            - type: string
            - type: 'null'
          title: From
          description: Sender email address (optional, defaults to authenticated user)
        reply_to:
          anyOf:
            - type: string
            - type: 'null'
          title: Reply To
          description: Reply-to email address
        labels:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Labels
          description: Gmail labels (e.g., INBOX, SENT, IMPORTANT)
      type: object
      required:
        - subject
        - to
        - body
      title: GmailMessage
      description: Gmail Message object with essential fields
    GmailDraft:
      properties:
        subject:
          type: string
          maxLength: 255
          title: Subject
          description: Draft subject (required)
        to:
          type: string
          title: To
          description: Recipient email address (required)
        cc:
          anyOf:
            - type: string
            - type: 'null'
          title: Cc
          description: CC email addresses (comma-separated)
        bcc:
          anyOf:
            - type: string
            - type: 'null'
          title: Bcc
          description: BCC email addresses (comma-separated)
        body:
          type: string
          title: Body
          description: Draft body content (required)
        from:
          anyOf:
            - type: string
            - type: 'null'
          title: From
          description: Sender email address (optional, defaults to authenticated user)
        reply_to:
          anyOf:
            - type: string
            - type: 'null'
          title: Reply To
          description: Reply-to email address
      type: object
      required:
        - subject
        - to
        - body
      title: GmailDraft
      description: Gmail Draft object with essential fields
    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
  securitySchemes:
    HTTPBearer:
      type: http
      description: Your Klavis AI API key.
      scheme: bearer
      x-fern-bearer:
        name: api_key

````