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

# Create sandbox

> **Preview.** Available to teams with the `sandboxes_api` feature flag. The shape of this
endpoint may change before general availability.

Create a sandbox in a project.




## OpenAPI

````yaml https://spec.speakeasy.com/latitude/latitude/latitude-sh-api-with-code-samples post /sandboxes
openapi: 3.0.1
info:
  title: Latitude.sh API
  version: '2023-06-01'
  description: >-
    The Latitude.sh API is a RESTful API to manage your Latitude.sh account. It
    allows you to perform the same actions as the Latitude.sh dashboard.
servers:
  - url: https://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
  - url: http://api.latitude.sh
    variables:
      latitude_api_key:
        default: <insert your api key here>
security: []
tags:
  - name: API keys
  - name: Baselines (Preview)
    description: >-
      Preview. Available to teams with the `baselines_api` feature flag. The
      shape of these endpoints may change before general availability.
  - name: Billing
  - name: Elastic Ips
  - name: Events
  - name: Firewalls
  - name: Inference
  - name: IP Addresses
  - name: Managed Databases
    description: Managed database instances (PostgreSQL, ClickHouse)
  - name: Kubernetes Clusters
  - name: LKS
  - name: Marketplace apps
  - name: Operating Systems
  - name: Plans
  - name: Sandboxes (Preview)
    description: >-
      Preview. Available to teams with the `sandboxes_api` feature flag. The
      shape of these endpoints may change before general availability.
  - name: Public Networks
  - name: Private Networks
  - name: Projects
  - name: Regions
  - name: Roles
  - name: SSH Keys
  - name: Servers
  - name: Block Storage
  - name: Filesystem Storage
  - name: Object Storage
  - name: Tags
  - name: Teams
  - name: Team members
  - name: Traffic
  - name: User data
  - name: User profile
  - name: VPN Sessions
  - name: Virtual machines
  - name: Virtual machine backups
  - name: Virtual machine restores
paths:
  /sandboxes:
    post:
      tags:
        - Sandboxes (Preview)
      summary: Create sandbox
      description: >
        **Preview.** Available to teams with the `sandboxes_api` feature flag.
        The shape of this

        endpoint may change before general availability.


        Create a sandbox in a project.
      operationId: create-sandbox
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - sandboxes
                    attributes:
                      type: object
                      properties:
                        project_id:
                          type: string
                          description: ID of the project that owns the sandbox
                        name:
                          type: string
                          description: Name of the sandbox. Generated when omitted
                        image:
                          type: string
                          description: >-
                            Container image to run. The runtime default is used
                            when omitted
                        environment:
                          type: object
                          additionalProperties:
                            type: string
                          description: Environment variables set in the sandbox
                      required:
                        - project_id
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: sandboxes
                    attributes:
                      project_id: proj_6059EqYkOQj8p
                      name: sbx-demo
                      image: python:3.12
          application/vnd.api+json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - sandboxes
                    attributes:
                      type: object
                      properties:
                        project_id:
                          type: string
                          description: ID of the project that owns the sandbox
                        name:
                          type: string
                          description: Name of the sandbox. Generated when omitted
                        image:
                          type: string
                          description: >-
                            Container image to run. The runtime default is used
                            when omitted
                        environment:
                          type: object
                          additionalProperties:
                            type: string
                          description: Environment variables set in the sandbox
                      required:
                        - project_id
            examples:
              Created:
                summary: Created
                value:
                  data:
                    type: sandboxes
                    attributes:
                      project_id: proj_6059EqYkOQj8p
                      name: sbx-demo
                      image: python:3.12
        required: true
      responses:
        '201':
          description: Created
          content:
            application/vnd.api+json:
              examples:
                Created:
                  value:
                    data:
                      id: sbx-demo
                      type: sandboxes
                      attributes:
                        name: sbx-demo
                        status: ready
                        image: python:3.12
                        project:
                          id: proj_6059EqYkOQj8p
                          name: Sandbox Project
                          slug: sandbox-project
              schema:
                $ref: '#/components/schemas/sandbox'
      security:
        - Bearer: []
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            import latitudesh_python_sdk
            from latitudesh_python_sdk import Latitudesh
            import os


            with Latitudesh(
                bearer=os.getenv("LATITUDESH_BEARER", ""),
            ) as latitudesh:

                res = latitudesh.sandboxes_preview.create_sandbox(data={
                    "type": latitudesh_python_sdk.CreateSandboxSandboxesPreviewType.SANDBOXES,
                    "attributes": {
                        "project_id": "proj_6059EqYkOQj8p",
                        "name": "sbx-demo",
                        "image": "python:3.12",
                    },
                })

                # Handle response
                print(res)
components:
  schemas:
    sandbox:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/sandbox_data'
    sandbox_data:
      type: object
      properties:
        id:
          type: string
          description: Sandbox name
        type:
          type: string
          enum:
            - sandboxes
        attributes:
          type: object
          properties:
            name:
              type: string
              description: Name of the sandbox
            status:
              type: string
              description: >-
                Lifecycle phase reported by the sandbox runtime (e.g.
                provisioning, ready, error, deleting, unknown)
            image:
              type: string
              description: >-
                Container image the sandbox runs. Omitted when the runtime
                default is used
            created_at:
              type: string
              description: >-
                Date the sandbox was created. Omitted while the runtime has not
                reported it
            project:
              type: object
              properties:
                id:
                  type: string
                name:
                  type: string
                slug:
                  type: string
  securitySchemes:
    Bearer:
      type: apiKey
      name: Authorization
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.