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

# Manage Browser Sessions

> List, fetch, update, and stop Driver browser sessions.

Use session management endpoints to inspect active sessions, update notes, and stop browsers when automation completes.

## Get a Session

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.driver.dev/v1/browser/session?sessionId=$SESSION_ID" \
    -H "Authorization: Bearer $DRIVER_API_KEY"
  ```

  ```python Python theme={null}
  resp = requests.get(
      "https://api.driver.dev/v1/browser/session",
      headers={"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}"},
      params={"sessionId": os.getenv("SESSION_ID")},
  )
  print(resp.json())
  ```

  ```typescript TypeScript theme={null}
  const session = await client.browser.session.get({
    sessionId: process.env.SESSION_ID!,
  });
  ```
</CodeGroup>

## List Sessions

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.driver.dev/v1/browser/sessions?page=1&pageSize=20&status=active" \
    -H "Authorization: Bearer $DRIVER_API_KEY"
  ```

  ```python Python theme={null}
  resp = requests.get(
      "https://api.driver.dev/v1/browser/sessions",
      headers={"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}"},
      params={"page": 1, "pageSize": 20, "status": "active"},
  )
  print(resp.json())
  ```

  ```typescript TypeScript theme={null}
  const sessions = await client.browser.session.list({
    page: 1,
    pageSize: 20,
    status: "active",
  });
  ```
</CodeGroup>

## Update a Session Note

Notes are updated after session creation.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.driver.dev/v1/browser/session?sessionId=$SESSION_ID" \
    -H "Authorization: Bearer $DRIVER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"note":"Scraping product pages"}'
  ```

  ```python Python theme={null}
  resp = requests.patch(
      "https://api.driver.dev/v1/browser/session",
      headers={
          "Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}",
          "Content-Type": "application/json",
      },
      params={"sessionId": os.getenv("SESSION_ID")},
      json={"note": "Scraping product pages"},
  )
  print(resp.json())
  ```
</CodeGroup>

## Stop a Session

Always stop sessions when your automation completes.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.driver.dev/v1/browser/session?sessionId=$SESSION_ID" \
    -H "Authorization: Bearer $DRIVER_API_KEY"
  ```

  ```python Python theme={null}
  resp = requests.delete(
      "https://api.driver.dev/v1/browser/session",
      headers={"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}"},
      params={"sessionId": os.getenv("SESSION_ID")},
  )
  print(resp.json())
  ```

  ```typescript TypeScript theme={null}
  const result = await client.browser.session.stop({
    sessionId: process.env.SESSION_ID!,
  });
  ```
</CodeGroup>

## Session Statuses

| Status      | Meaning                                            |
| ----------- | -------------------------------------------------- |
| `starting`  | Session is being created.                          |
| `active`    | Session is running and can accept CDP connections. |
| `completed` | Session has stopped successfully.                  |
| `error`     | Session failed or ended with an error.             |
