# Running your first Sandbox (/docs/quickstart)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 966 · updated: 2026-07-30 -->
Related: [API key](/docs/api-key.md), [Billing & limits](/docs/billing.md), [E2B CLI](/docs/cli.md), [Running commands in sandbox](/docs/commands.md), [Cookbook](/docs/cookbook.md), [Filesystem](/docs/filesystem.md)

<Steps>
  <Step title="Create E2B account">
    Every new E2B account get $100 in credits. You can sign up [here](https://e2b.dev/auth/sign-up).
  </Step>

  <Step title="Set your environment variables">
    1. Navigate to the E2B Dashboard.
    2. Copy your [API key](https://e2b.dev/dashboard?tab=keys).
    3. Paste your E2B API key into your .env file.

    ```bash title=".env"
    E2B_API_KEY=e2b_***
    ```
  </Step>

  <Step title="Install E2B SDK">
    Install the E2B SDK to your project by running the following command in your terminal.

    <CodeGroup>
      <CodeBlockTabs defaultValue="JavaScript & TypeScript" groupId="javascript-typescript+python">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="JavaScript & TypeScript">
            JavaScript & TypeScript
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Python">
            Python
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="JavaScript & TypeScript">
          ```javascript  
          npm i @e2b/code-interpreter dotenv
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Python">
          ```python  
          pip install e2b-code-interpreter python-dotenv
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </CodeGroup>
  </Step>

  <Step title="Write code for starting sandbox">
    We'll write the minimal code for starting Sandbox, executing Python inside it and listing all files inside the root directory.

    <CodeGroup>
      <CodeBlockTabs defaultValue="JavaScript & TypeScript" groupId="javascript-typescript+python">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="JavaScript & TypeScript">
            JavaScript & TypeScript
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Python">
            Python
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="JavaScript & TypeScript">
          ```javascript  
          // index.ts
          import 'dotenv/config'
          import { Sandbox } from '@e2b/code-interpreter'

          const sbx = await Sandbox.create() // Creates a persistent sandbox session
          const execution = await sbx.runCode('print("hello world")') // Execute Python inside the sandbox
          console.log(execution.logs)

          const files = await sbx.files.list('/')
          console.log(files)
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Python">
          ```python  
          # main.py
          from dotenv import load_dotenv
          load_dotenv()
          from e2b_code_interpreter import Sandbox

          sbx = Sandbox.create() # Creates a persistent sandbox session
          execution = sbx.run_code("print('hello world')") # Execute Python inside the sandbox
          print(execution.logs)

          files = sbx.files.list("/")
          print(files)
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </CodeGroup>
  </Step>

  <Step title="Start your first E2B sandbox">
    Run the code with the following command:

    <CodeGroup>
      <CodeBlockTabs defaultValue="JavaScript & TypeScript" groupId="javascript-typescript+python">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="JavaScript & TypeScript">
            JavaScript & TypeScript
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Python">
            Python
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="JavaScript & TypeScript">
          ```bash  
          npx tsx ./index.ts
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Python">
          ```bash  
          python main.py
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </CodeGroup>
  </Step>
</Steps>
