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

# Fork sandbox

> Forks a sandbox into a new sandbox or application. When forking to a sandbox, the target must not already exist (409 if it does). When forking to an application, a new revision is added if the app already exists, or a new application is created. This is a WIP endpoint — the full implementation depends on the execution plane.



## OpenAPI

````yaml /api-reference/controlplane.yml post /sandboxes/{sandboxName}/fork
openapi: 3.0.3
info:
  title: Blaxel Control Plane
  version: 0.0.1
servers:
  - description: Blaxel Control Plane
    url: https://api.blaxel.ai/v0
  - description: Blaxel Inference
    url: https://run.blaxel.ai
security:
  - OAuth2:
      - admin
  - ApiKeyAuth: []
paths:
  /sandboxes/{sandboxName}/fork:
    post:
      tags:
        - compute
      summary: Fork sandbox
      description: >-
        Forks a sandbox into a new sandbox or application. When forking to a
        sandbox, the target must not already exist (409 if it does). When
        forking to an application, a new revision is added if the app already
        exists, or a new application is created. This is a WIP endpoint — the
        full implementation depends on the execution plane.
      operationId: ForkSandbox
      parameters:
        - description: Name of the sandbox to fork
          in: path
          name: sandboxName
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxForkRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxForkResponse'
          description: Fork created successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Bad request - Invalid fork parameters
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not found - Source sandbox does not exist
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Conflict - Target sandbox already exists (only for type sandbox)
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
      security:
        - OAuth2:
            - sandboxes:create
        - ApiKeyAuth: []
components:
  schemas:
    SandboxForkRequest:
      type: object
      description: >-
        Request body for forking a sandbox into an application. Creates a new
        application or adds a canary revision to an existing one.
      properties:
        customDomain:
          type: string
          description: Custom domain for the application
        port:
          type: integer
          description: Port to expose from the sandbox
          example: 8080
        prefix:
          type: string
          description: URL prefix for the application
        snapshotId:
          type: string
          description: >-
            Snapshot ID to fork from. When set, the application revision
            references this snapshot.
        targetName:
          type: string
          description: Name of the target application to create or update
          example: my-app
        targetType:
          type: string
          description: Target resource type to fork into
          example: application
        traffic:
          type: integer
          description: >-
            Traffic percentage for canary deployment (0-100). When set on an
            existing target, creates a new revision with this traffic
            percentage.
          example: 10
      required:
        - targetType
        - targetName
    SandboxForkResponse:
      type: object
      description: >-
        Response returned after forking a sandbox. Contains either the new
        sandbox or application depending on the fork type.
      properties:
        name:
          type: string
          description: Name of the created or updated resource
        snapshotId:
          type: string
          description: The snapshot ID the fork was created from
        type:
          type: string
          description: Type of resource that was created (sandbox or application)
          enum:
            - sandbox
            - application
    Error:
      type: object
      description: Standard error response returned by the API when a request fails
      properties:
        code:
          type: integer
          description: HTTP status code of the error
          example: 409
        error:
          type: string
          description: Error type or code identifying the kind of error
          example: Resource already exists
        message:
          type: string
          description: Human-readable error message describing what went wrong
          example: Invalid request body
      required:
        - error
  securitySchemes:
    OAuth2:
      description: OAuth2 authentication with JWT tokens
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          scopes:
            admin: Administrative access
            agents:create: Create agents
            agents:delete: Delete agents
            agents:get: Get agent details
            agents:list: List agents
            agents:update: Update agents
            apiKey:list: List API keys
            apiKey:write: Create and delete API keys
            applications:create: Create applications
            applications:delete: Delete applications
            applications:get: Get application details
            applications:list: List applications
            applications:update: Update applications
            configurations:list: List configurations
            customdomains:create: Create custom domains
            customdomains:delete: Delete custom domains
            customdomains:get: Get custom domain details
            customdomains:list: List custom domains
            customdomains:update: Update custom domains
            functions:create: Create functions
            functions:delete: Delete functions
            functions:get: Get function details
            functions:list: List functions
            functions:update: Update functions
            integrations:create: Create integrations
            integrations:list: List integrations
            invitations:list: List invitations
            jobs:create: Create jobs
            jobs:delete: Delete jobs
            jobs:get: Get job details
            jobs:list: List jobs
            jobs:update: Update jobs
            locations:list: List locations
            mcphub:list: List MCP hub resources
            models:create: Create models
            models:delete: Delete models
            models:get: Get model details
            models:list: List models
            models:update: Update models
            policies:create: Create policies
            policies:delete: Delete policies
            policies:get: Get policy details
            policies:list: List policies
            policies:update: Update policies
            sandboxes:control: Control sandbox operations
            sandboxes:create: Create sandboxes
            sandboxes:delete: Delete sandboxes
            sandboxes:get: Get sandbox details
            sandboxes:list: List sandboxes
            sandboxes:update: Update sandboxes
            sandboxhub:list: List sandbox hub resources
            templates:get: Get template details
            templates:list: List templates
            volumeTemplates:create: Create volume templates
            volumeTemplates:delete: Delete volume templates
            volumeTemplates:get: Get volume template details
            volumeTemplates:list: List volume templates
            volumeTemplates:upsert: Create or update volume templates
            volumes:create: Create volumes
            volumes:delete: Delete volumes
            volumes:get: Get volume details
            volumes:list: List volumes
            workspaces:accept: Accept workspace invitation
            workspaces:create: Create workspaces
            workspaces:decline: Decline workspace invitation
            workspaces:delete: Delete workspaces
            workspaces:get: Get workspace details
            workspaces:invite: Invite users to workspace
            workspaces:leave: Leave workspace
            workspaces:list: List workspaces
            workspaces:remove: Remove users from workspace
            workspaces:update: Update workspaces
          tokenUrl: /oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access
            agents:create: Create agents
            agents:delete: Delete agents
            agents:get: Get agent details
            agents:list: List agents
            agents:update: Update agents
            apiKey:list: List API keys
            apiKey:write: Create and delete API keys
            applications:create: Create applications
            applications:delete: Delete applications
            applications:get: Get application details
            applications:list: List applications
            applications:update: Update applications
            configurations:list: List configurations
            customdomains:create: Create custom domains
            customdomains:delete: Delete custom domains
            customdomains:get: Get custom domain details
            customdomains:list: List custom domains
            customdomains:update: Update custom domains
            functions:create: Create functions
            functions:delete: Delete functions
            functions:get: Get function details
            functions:list: List functions
            functions:update: Update functions
            integrations:create: Create integrations
            integrations:list: List integrations
            invitations:list: List invitations
            jobs:create: Create jobs
            jobs:delete: Delete jobs
            jobs:get: Get job details
            jobs:list: List jobs
            jobs:update: Update jobs
            locations:list: List locations
            mcphub:list: List MCP hub resources
            models:create: Create models
            models:delete: Delete models
            models:get: Get model details
            models:list: List models
            models:update: Update models
            policies:create: Create policies
            policies:delete: Delete policies
            policies:get: Get policy details
            policies:list: List policies
            policies:update: Update policies
            sandboxes:control: Control sandbox operations
            sandboxes:create: Create sandboxes
            sandboxes:delete: Delete sandboxes
            sandboxes:get: Get sandbox details
            sandboxes:list: List sandboxes
            sandboxes:update: Update sandboxes
            sandboxhub:list: List sandbox hub resources
            templates:get: Get template details
            templates:list: List templates
            volumeTemplates:create: Create volume templates
            volumeTemplates:delete: Delete volume templates
            volumeTemplates:get: Get volume template details
            volumeTemplates:list: List volume templates
            volumeTemplates:upsert: Create or update volume templates
            volumes:create: Create volumes
            volumes:delete: Delete volumes
            volumes:get: Get volume details
            volumes:list: List volumes
            workspaces:accept: Accept workspace invitation
            workspaces:create: Create workspaces
            workspaces:decline: Decline workspace invitation
            workspaces:delete: Delete workspaces
            workspaces:get: Get workspace details
            workspaces:invite: Invite users to workspace
            workspaces:leave: Leave workspace
            workspaces:list: List workspaces
            workspaces:remove: Remove users from workspace
            workspaces:update: Update workspaces
          tokenUrl: /oauth/token
      type: oauth2
    ApiKeyAuth:
      bearerFormat: API Key
      description: Long-lived API key for programmatic access
      scheme: bearer
      type: http

````