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

# BatchSessions

> SDK reference for the BatchSessions resource (TypeScript & Python)

## List Batch Sessions

`GET /v1/batch-sessions` — listBatchSessions

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.listBatchSessions();
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.list_batch_sessions()
  print(result)
  ```
</CodeGroup>

## Create Batch Sessions

`POST /v1/batch-sessions` — createBatchSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.createBatchSession({
    body: {
      count: 1
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.create_batch_session(
      count=1,
  )
  print(result)
  ```
</CodeGroup>

## Get Batch Session Status

`GET /v1/batch-sessions/{batch_id}` — getBatchSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.getBatchSession({
    path: {
      batch_id: 'your-batch-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.get_batch_session(
      "your-batch-id",
  )
  print(result)
  ```
</CodeGroup>

## Update Batch Session

`PATCH /v1/batch-sessions/{batch_id}` — updateBatchSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.updateBatchSession({
    path: {
      batch_id: 'your-batch-id'
    },
    body: {
      status: 'cancelled'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.update_batch_session(
      "your-batch-id",
      status="cancelled",
  )
  print(result)
  ```
</CodeGroup>

## Delete Batch Sessions

`DELETE /v1/batch-sessions/{batch_id}` — deleteBatchSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.deleteBatchSession({
    path: {
      batch_id: 'your-batch-id'
    }
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.delete_batch_session(
      "your-batch-id",
  )
  print(result)
  ```
</CodeGroup>

## Retry Failed Batch Sessions

`POST /v1/batch-sessions/{batch_id}/retry` — retryBatchSession

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { client, BatchSessions } from 'anchorbrowser';

  // ANCHORBROWSER_API_KEY is read from the environment by default;
  // set it explicitly like this:
  client.setConfig({ auth: () => 'your-api-key' });

  const result = await BatchSessions.retryBatchSession({
    path: {
      batch_id: 'your-batch-id'
    },
    body: {}
  });
  console.log(result);
  ```

  ```python Python theme={null}
  from anchorbrowser import Anchorbrowser

  # ANCHORBROWSER_API_KEY is read from the environment by default;
  # set it explicitly with Anchorbrowser(api_key="your-api-key")
  client = Anchorbrowser()

  result = client.batch_sessions.retry_batch_session(
      "your-batch-id",
  )
  print(result)
  ```
</CodeGroup>
