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

# Quickstart

> Get started with BrowserTest SDK in minutes

## 🚀 Get Started in 3 Steps

Get up and running with BrowserTest SDK in just a few minutes.

### Step 1: Install the SDK

<AccordionGroup>
  <Accordion icon="package" title="Install via npm">
    ```bash theme={null}
    npm install browsertest-sdk
    ```
  </Accordion>

  <Accordion icon="package" title="Install via yarn">
    ```bash theme={null}
    yarn add browsertest-sdk
    ```
  </Accordion>

  <Accordion icon="package" title="Install via pnpm">
    ```bash theme={null}
    pnpm add browsertest-sdk
    ```
  </Accordion>
</AccordionGroup>

### Step 2: Get Your API Key

1. Visit [BrowserTest Dashboard](https://browsertest.in)
2. Sign up for an account
3. Navigate to API Keys section
4. Create a new API key

<Callout type="warning">
  Keep your API key secure and never commit it to version control. Use environment variables instead.
</Callout>

### Step 3: Write Your First Code

```javascript theme={null}
import { BrowserTest } from 'browsertest-sdk';

// Initialize the SDK
const bt = new BrowserTest({
  apiKey: process.env.BROWSERTEST_API_KEY // Use environment variable
});

// Take your first screenshot
async function main() {
  try {
    const screenshot = await bt.screenshot.take({
      url: 'https://example.com',
      fullPage: true,
      format: 'png'
    });

    console.log('Screenshot captured!');
    console.log('Size:', screenshot.data.screenshot.length, 'bytes');
    console.log('Dimensions:', `${screenshot.data.width}x${screenshot.data.height}`);

  } catch (error) {
    console.error('Error:', error.message);
  }
}

main();
```

## 🧪 Test Your Setup

Run this test script to verify everything works:

```javascript theme={null}
import { BrowserTest } from 'browsertest-sdk';

const bt = new BrowserTest({
  apiKey: process.env.BROWSERTEST_API_KEY
});

async function testConnection() {
  try {
    // Test connection
    const isConnected = await bt.testConnection();
    console.log('API Connection:', isConnected ? '✅ OK' : '❌ Failed');

    // Check usage
    const usage = await bt.getUsage();
    console.log('Plan:', usage.plan);
    console.log('Screenshots remaining:', usage.usage.screenshot.remaining);
    console.log('Tests remaining:', usage.usage.agentic.remaining);

  } catch (error) {
    console.error('Setup test failed:', error.message);
  }
}

testConnection();
```

## 📁 Project Structure

For a typical project, organize your code like this:

```
your-project/
├── src/
│   ├── services/
│   │   └── browserTest.js     # SDK wrapper/service
│   ├── tests/
│   │   ├── visual-regression.js
│   │   └── e2e-tests.js
│   └── utils/
│       └── screenshot-helpers.js
├── .env                       # API key (don't commit!)
└── package.json
```

## 🔧 Configuration

Create a service wrapper for easy usage throughout your app:

```javascript theme={null}
// src/services/browserTest.js
import { BrowserTest } from 'browsertest-sdk';

const bt = new BrowserTest({
  apiKey: process.env.BROWSERTEST_API_KEY,
  timeout: 30000,
  retries: 3
});

export default bt;
```

## 🎯 What Next?

<CardGroup cols={2}>
  <Card title="Take Screenshots" icon="camera" href="/guides/screenshots">
    Learn about different screenshot types and options.
  </Card>

  <Card title="Agentic Testing" icon="robot" href="/guides/agentic-testing">
    Run tests with natural language instructions.
  </Card>

  <Card title="Batch Operations" icon="batch" href="/guides/batch-operations">
    Process multiple operations efficiently.
  </Card>

  <Card title="Error Handling" icon="shield" href="/guides/error-handling">
    Handle errors and edge cases properly.
  </Card>
</CardGroup>

## 🆘 Need Help?

<Card title="Join our Community" icon="users" href="https://github.com/hematejaaluru/browsertest-sdk/discussions">
  Ask questions and get help from the community.
</Card>
