CodeSandbox Define API

The Define API allows programmatic creation of browser sandboxes from code files, useful for documentation sites and code examples that need to generate a sandbox on the fly. Supports both GET and POST requests to https://codesandbox.io/api/v1/sandboxes/define, accepting a files parameter containing the sandbox file structure and returning either a rendered sandbox or JSON with sandbox_id when using the ?json=1 query parameter.

API entry from apis.yml

apis.yml Raw ↑
aid: codesandbox:define-api
name: CodeSandbox Define API
description: The Define API allows programmatic creation of browser sandboxes from code files, useful
  for documentation sites and code examples that need to generate a sandbox on the fly. Supports both
  GET and POST requests to https://codesandbox.io/api/v1/sandboxes/define, accepting a files parameter
  containing the sandbox file structure and returning either a rendered sandbox or JSON with sandbox_id
  when using the ?json=1 query parameter.
humanURL: https://codesandbox.io/docs/learn/browser-sandboxes/cli-api
baseURL: https://codesandbox.io/api/v1
tags:
- Browser Sandboxes
- REST API
- Code Examples
properties:
- type: Documentation
  url: https://codesandbox.io/docs/learn/browser-sandboxes/cli-api