{"id":19411,"library":"codesandbox-api","title":"codesandbox-api","description":"Library for creating custom integrations and protocols with CodeSandbox, version 0.0.32 (stable, low release cadence). Provides APIs to communicate between sandbox frames and the editor, including protocol definitions, event handling, and utilities for building sandbox-level features. Differentiates from direct postMessage by offering typed abstractions and conventions. Ships TypeScript type definitions. Active development within the CodeSandbox monorepo.","status":"active","version":"0.0.32","language":"javascript","source_language":"en","source_url":"https://github.com/codesandbox/codesandbox-client","tags":["javascript","typescript"],"install":[{"cmd":"npm install codesandbox-api","lang":"bash","label":"npm"},{"cmd":"yarn add codesandbox-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add codesandbox-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Main export for constructing sandbox URLs; ESM-only as no CJS bundle is provided in the package.","symbol":"sandboxUrl","correct":"import { sandboxUrl } from 'codesandbox-api'"},{"note":"Exports the internal 'constructor' function (unclear usage, likely a helper).","wrong":"const { constructor } = require('codesandbox-api')","symbol":"constructor","correct":"import { constructor } from 'codesandbox-api'"},{"note":"Default export is the main module; named 'default' is not exported separately.","wrong":"import { default } from 'codesandbox-api'","symbol":"default","correct":"import codesandbox from 'codesandbox-api'"},{"note":"Some utilities are in subpath exports; check the dist folder for available actions.","symbol":"listen","correct":"import { listen } from 'codesandbox-api/dist/actions'"}],"quickstart":{"code":"import { sandboxUrl } from 'codesandbox-api';\n\n// Generate a sandbox URL from a GitHub repo\nconst url = sandboxUrl({\n  github: { repo: 'facebook/react', branch: 'main' },\n  file: '/src/App.js'\n});\nconsole.log(url); // https://codesandbox.io/s/github/facebook/react/tree/main?file=/src/App.js","lang":"typescript","description":"Shows how to use the sandboxUrl function to create a CodeSandbox link from a GitHub repository."},"warnings":[{"fix":"Pin to exact version and test upgrades; prefer latest 0.x patch.","message":"Version 0.x is pre-1.0; APIs may break without major version bump.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Refer to source code or CodeSandbox client for usage examples; consider using source map.","message":"Package contains minimal documentation; many exports are undocumented.","severity":"gotcha","affected_versions":"<=0.0.32"},{"fix":"Use dynamic import() in Node or configure bundler for ESM.","message":"ESM-only: No CommonJS build; using require() will not work.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Import from specific subpath like 'codesandbox-api/dist/actions'.","message":"Subpath exports: Some utilities are in dist/ subdirectories (e.g., actions).","severity":"gotcha","affected_versions":"<=0.0.32"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install codesandbox-api","cause":"Package is not installed or is missing from node_modules.","error":"Cannot find module 'codesandbox-api'"},{"fix":"Add \"type\": \"module\" to package.json, or use a bundler like webpack/rollup.","cause":"Using ESM import in a CommonJS environment without transpilation.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}