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

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



## OpenAPI

````yaml post /sandbox/notion/{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/notion/{sandbox_id}/initialize:
    post:
      tags:
        - sandbox
      summary: Initialize notion sandbox with data
      description: >-
        Initialize the sandbox with notion-specific data following the defined
        schema.
      operationId: initialize_sandbox_sandbox_notion__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/NotionData-Input'
                - type: 'null'
              title: Request Body
            examples:
              default:
                summary: Example initialization data
                value:
                  databases:
                    - name: Product Roadmap
                      summary: Track product features and releases
                      display_icon: 🚀
                      sources:
                        - label: Features
                          summary: Feature tracking table
                          fields:
                            Name:
                              type: title
                            Status:
                              type: select
                              options:
                                - Planning
                                - In Progress
                                - Done
                            Priority:
                              type: select
                              options:
                                - High
                                - Medium
                                - Low
                            Assignee:
                              type: people
                          pages:
                            - name: User Authentication
                              attributes:
                                Status: Done
                                Priority: High
                              content_blocks:
                                - block_type: paragraph
                                  content: >-
                                    Implement secure user authentication with
                                    OAuth2 support
                                - block_type: heading_2
                                  content: Requirements
                                - block_type: bulleted_list_item
                                  content: Support email/password login
                                - block_type: bulleted_list_item
                                  content: Implement JWT tokens
                                - block_type: bulleted_list_item
                                  content: Add OAuth2 providers (Google, GitHub)
                              comments:
                                - content: Should we support social login from day one?
                                - content: Yes, let's add Google and GitHub OAuth
                            - name: Real-time Notifications
                              attributes:
                                Status: In Progress
                                Priority: High
                              content_blocks:
                                - block_type: paragraph
                                  content: >-
                                    Build real-time notification system using
                                    WebSockets
                                - block_type: to_do
                                  content: Set up WebSocket server
                                - block_type: to_do
                                  content: Create notification service
                                - block_type: to_do
                                  content: Design notification UI components
                              comments: []
                            - name: Dark Mode Support
                              attributes:
                                Status: Planning
                                Priority: Medium
                              content_blocks:
                                - block_type: paragraph
                                  content: Add dark mode theme toggle
                                - block_type: callout
                                  content: >-
                                    💡 Consider using CSS variables for easy
                                    theme switching
                              comments:
                                - content: >-
                                    Users have been requesting this feature
                                    frequently
                        - label: Releases
                          summary: Release planning and tracking
                          fields:
                            Name:
                              type: title
                            Release Date:
                              type: date
                            Status:
                              type: select
                              options:
                                - Planned
                                - In Development
                                - Released
                          pages:
                            - name: v1.0 - MVP Release
                              attributes:
                                Release Date: '2024-03-15'
                                Status: In Development
                              content_blocks:
                                - block_type: heading_2
                                  content: Release Goals
                                - block_type: paragraph
                                  content: >-
                                    First production-ready version with core
                                    functionality
                                - block_type: numbered_list_item
                                  content: User authentication and authorization
                                - block_type: numbered_list_item
                                  content: Real-time notifications
                                - block_type: numbered_list_item
                                  content: Core API endpoints
                              comments: []
                            - name: v1.1 - Enhanced UX
                              attributes:
                                Release Date: '2024-04-30'
                                Status: Planned
                              content_blocks:
                                - block_type: paragraph
                                  content: Focus on user experience improvements
                              comments: []
                    - name: Team Tasks
                      summary: Daily task management for the team
                      display_icon: ✅
                      sources:
                        - label: Tasks
                          summary: Task tracking
                          fields:
                            Task:
                              type: title
                            Status:
                              type: status
                            Assignee:
                              type: people
                            Due Date:
                              type: date
                            Priority:
                              type: select
                              options:
                                - High
                                - Medium
                                - Low
                          pages:
                            - name: 'Review pull request #123'
                              attributes:
                                Status: In Progress
                                Priority: High
                                Due Date: '2024-02-10'
                              content_blocks:
                                - block_type: paragraph
                                  content: Review authentication implementation PR
                                - block_type: code
                                  content: >-
                                    // Check for proper error handling and
                                    security best practices
                              comments:
                                - content: >-
                                    Found a potential security issue in token
                                    validation
                                - content: Fixed in latest commit
                            - name: Update deployment documentation
                              attributes:
                                Status: Todo
                                Priority: Medium
                                Due Date: '2024-02-15'
                              content_blocks:
                                - block_type: paragraph
                                  content: Add new deployment steps for Docker setup
                              comments: []
                            - name: Fix responsive layout on mobile
                              attributes:
                                Status: Done
                                Priority: High
                                Due Date: '2024-02-08'
                              content_blocks:
                                - block_type: paragraph
                                  content: >-
                                    Navigation menu was broken on screens <
                                    768px
                                - block_type: heading_3
                                  content: Solution
                                - block_type: paragraph
                                  content: >-
                                    Implemented hamburger menu for mobile
                                    devices
                              comments:
                                - content: >-
                                    Tested on iPhone and Android devices, looks
                                    good!
                  pages:
                    - name: Team Meeting Notes - Feb 2024
                      content_blocks:
                        - block_type: heading_1
                          content: Weekly Sync - February 5, 2024
                        - block_type: paragraph
                          content: 'Attendees: Alice, Bob, Charlie, Diana'
                        - block_type: heading_2
                          content: Discussion Points
                        - block_type: bulleted_list_item
                          content: Sprint retrospective review
                        - block_type: bulleted_list_item
                          content: Q1 roadmap planning
                        - block_type: bulleted_list_item
                          content: New hire onboarding process
                        - block_type: heading_2
                          content: Action Items
                        - block_type: to_do
                          content: 'Alice: Schedule 1-on-1s with new team members'
                        - block_type: to_do
                          content: 'Bob: Update API documentation'
                        - block_type: to_do
                          content: 'Charlie: Review security audit findings'
                      comments:
                        - content: >-
                            Great meeting! Let's make sure we follow up on
                            action items by Friday
                        - content: Added calendar invites for the 1-on-1s
                    - name: Engineering Wiki Home
                      content_blocks:
                        - block_type: heading_1
                          content: Welcome to Engineering Wiki
                        - block_type: paragraph
                          content: >-
                            This wiki contains all technical documentation,
                            guides, and best practices for our engineering team.
                        - block_type: heading_2
                          content: Quick Links
                        - block_type: bulleted_list_item
                          content: Getting Started Guide
                        - block_type: bulleted_list_item
                          content: API Documentation
                        - block_type: bulleted_list_item
                          content: Architecture Overview
                        - block_type: bulleted_list_item
                          content: Deployment Procedures
                        - block_type: heading_2
                          content: Code of Conduct
                        - block_type: quote
                          content: >-
                            Write code that is clear, maintainable, and
                            well-tested. When in doubt, prioritize readability
                            over cleverness.
                      comments: []
                    - name: API Design Guidelines
                      content_blocks:
                        - block_type: heading_1
                          content: REST API Design Guidelines
                        - block_type: paragraph
                          content: >-
                            Follow these guidelines when designing new API
                            endpoints
                        - block_type: heading_2
                          content: General Principles
                        - block_type: numbered_list_item
                          content: Use RESTful conventions (GET, POST, PUT, DELETE)
                        - block_type: numbered_list_item
                          content: Use plural nouns for resource names
                        - block_type: numbered_list_item
                          content: Version your APIs (e.g., /v1/users)
                        - block_type: numbered_list_item
                          content: Use HTTP status codes correctly
                        - block_type: heading_2
                          content: Example
                        - block_type: code
                          content: |-
                            GET /v1/users - List all users
                            GET /v1/users/:id - Get specific user
                            POST /v1/users - Create new user
                            PUT /v1/users/:id - Update user
                            DELETE /v1/users/:id - Delete user
                        - block_type: callout
                          content: >-
                            ⚠️ Always validate input data and sanitize
                            user-provided content
                      comments:
                        - content: Should we use GraphQL for more complex queries?
                        - content: Let's discuss in next architecture meeting
      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:
    NotionData-Input:
      properties:
        databases:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionDatabase-Input'
              type: array
            - type: 'null'
          title: Databases
          description: List of databases with their data sources and pages
        pages:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionPage-Input'
              type: array
            - type: 'null'
          title: Pages
          description: List of standalone pages (not in databases)
      type: object
      title: NotionData
      description: |-
        Complete Notion sandbox data structure.

        Hierarchical structure for initialization:
        - Databases contain Data Sources
        - Data Sources contain Pages (with properties matching the schema)
        - Standalone Pages exist at top level (not in databases)
        - Pages contain Blocks (content) and Comments

        Relational structure:
        - Pages refer to Data Sources (via parent_source)
        - Data Sources are nested in Databases
    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
    NotionDatabase-Input:
      properties:
        name:
          type: string
          title: Name
          description: Database title
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          description: Database description
        display_icon:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Icon
          description: Database icon (emoji or external URL)
        sources:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionDataSource-Input'
              type: array
            - type: 'null'
          title: Sources
          description: Data sources within this database
      type: object
      required:
        - name
      title: NotionDatabase
      description: >-
        Notion Database object - container for data sources.


        Databases organize structured data and can contain multiple data
        sources.

        Each data source represents a table with its own schema.
    NotionPage-Input:
      properties:
        name:
          type: string
          title: Name
          description: Page title
        attributes:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Attributes
          description: Page properties (for database pages)
        content_blocks:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionBlock-Input'
              type: array
            - type: 'null'
          title: Content Blocks
          description: Content blocks in this page
        comments:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionComment-Input'
              type: array
            - type: 'null'
          title: Comments
          description: Comments on this page
        parent_source:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Source
          description: Name of the data source this page belongs to (for initialization)
      type: object
      required:
        - name
      title: NotionPage
      description: |-
        Notion Page object.

        Pages can be:
        1. Standalone pages (top-level in workspace)
        2. Items/rows within a database data source

        For pages in databases, properties should match the data source schema.
    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
    NotionDataSource-Input:
      properties:
        label:
          type: string
          title: Label
          description: Data source name
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          description: Data source description
        fields:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Fields
          description: Schema definition (property types and configurations)
        pages:
          anyOf:
            - items:
                $ref: '#/components/schemas/NotionPage-Input'
              type: array
            - type: 'null'
          title: Pages
          description: Pages (items/rows) in this data source
      type: object
      required:
        - label
      title: NotionDataSource
      description: |-
        Notion Data Source object - represents a table within a database.

        New in API version 2025-09-03:
        - A database can contain multiple data sources
        - Each data source has its own schema (properties)
        - Pages within a data source follow that schema
    NotionBlock-Input:
      properties:
        block_type:
          type: string
          title: Block Type
          description: Block type (paragraph, heading_1, heading_2, etc.)
        content:
          type: string
          title: Content
          description: Block text content
      type: object
      required:
        - block_type
        - content
      title: NotionBlock
      description: >-
        Notion Block object - fundamental content unit.


        Blocks can be: paragraph, heading_1, heading_2, heading_3,
        bulleted_list_item,

        numbered_list_item, to_do, toggle, code, quote, callout, etc.
    NotionComment-Input:
      properties:
        content:
          type: string
          title: Content
          description: Comment text content (rich text)
      type: object
      required:
        - content
      title: NotionComment
      description: Notion Comment object - can be attached to pages or blocks
  securitySchemes:
    HTTPBearer:
      type: http
      description: Your Klavis AI API key.
      scheme: bearer
      x-fern-bearer:
        name: api_key

````