CodeSandbox preview_host API

Trusted preview host management

Operations 3

GET /workspace/preview_hosts List Preview Hosts #
POST /workspace/preview_hosts Create Preview Hosts #
PUT /workspace/preview_hosts Update Preview Hosts #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/codesandbox-preview-host-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

codesandbox-preview-host-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: CodeSandbox meta Preview Host API
  version: '2023-07-01'
  description: The CodeSandbox API provides programmatic access to create, manage, and control sandboxes and virtual machines (devboxes) backed by Firecracker microVMs. Authenticated via Bearer token obtained from codesandbox.io/t/api.
  contact:
    url: https://codesandbox.io/docs/sdk
  x-source: https://raw.githubusercontent.com/codesandbox/codesandbox-sdk/main/openapi.json
servers:
- url: https://api.codesandbox.io
security: []
tags:
- name: preview_host
  description: Trusted preview host management
paths:
  /workspace/preview_hosts:
    get:
      operationId: preview_host/list
      summary: List Preview Hosts
      description: 'List all trusted preview hosts for the current team

        '
      tags:
      - preview_host
      parameters: []
      responses:
        '201':
          description: Preview Host List Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewHostListResponse'
      security:
      - authorization:
        - vm:manage
    post:
      operationId: preview_host/create
      summary: Create Preview Hosts
      description: 'Add one or more trusted domains that are allowed to access sandbox previews for this workspace.

        '
      tags:
      - preview_host
      parameters: []
      requestBody:
        description: Preview Host Create Request
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewHostRequest'
      responses:
        '201':
          description: Preview Host List Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewHostListResponse'
      security:
      - authorization:
        - vm:manage
    put:
      operationId: preview_host/update
      summary: Update Preview Hosts
      description: 'Replace the list of trusted domains that are allowed to access sandbox previews for this workspace.

        '
      tags:
      - preview_host
      parameters: []
      requestBody:
        description: Preview Host Update Request
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewHostRequest'
      responses:
        '201':
          description: Preview Host List Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewHostListResponse'
      security:
      - authorization:
        - vm:manage
components:
  schemas:
    Response:
      title: Response
      type: object
      properties:
        success:
          type: boolean
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    PreviewHostListResponse:
      title: PreviewHostListResponse
      type: object
      allOf:
      - $ref: '#/components/schemas/Response'
      - type: object
        properties:
          data:
            type: object
            required:
            - preview_hosts
            properties:
              preview_hosts:
                type: array
                items:
                  type: object
                  required:
                  - host
                  - inserted_at
                  properties:
                    host:
                      type: string
                    inserted_at:
                      type: string
                      format: date-time
    PreviewHostRequest:
      title: PreviewHostRequest
      type: object
      required:
      - hosts
      properties:
        hosts:
          type: array
          items:
            type: string
            description: Trusted domains that are allowed to access sandbox previews.
            example: https://example.com
    Error:
      title: Error
      oneOf:
      - type: string
      - type: object
        additionalProperties: true
  securitySchemes:
    authorization:
      type: http
      scheme: bearer