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

# Activate Tab

> Make the given tab the active one for subsequent session-scoped operations.

## Overview

The `/browser/sessions/{id}/pages/{pageId}/activate` endpoint switches the session's active tab to the one identified by `pageId`. The tab is brought to the foreground and becomes the target for all subsequent session-scoped operations (mouse, keyboard, navigate, content, screenshot, PDF).

This avoids having to pass `pageId` on every request — set the active tab once, then use the compact session-scoped endpoints.

## Path Parameters

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID). Create via `POST /browser/sessions`.
</ParamField>

<ParamField path="pageId" type="string" required={true}>
  CDP target identifier of the tab to activate. 32-character uppercase hex. Obtain via `POST /pages` or `GET /pages`.
</ParamField>

## Body

No request body. Send an empty request.

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/pages/EA5E9AA71C7A91C467F8CDBB266EE5E0/activate" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/pages/EA5E9AA71C7A91C467F8CDBB266EE5E0/activate",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
      },
    },
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.scrapengine.io/api/v1/browser/sessions/0f2b1f6a-88ac-4d25-bc58-67a6f4b4a001/pages/EA5E9AA71C7A91C467F8CDBB266EE5E0/activate"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
  }

  response = requests.post(url, headers=headers)
  data = response.json()
  ```
</CodeGroup>

## Response

### Success Response (200)

<ResponseField name="success" type="boolean">
  `true` when the tab was activated.
</ResponseField>

<ResponseField name="pageId" type="string">
  CDP target identifier of the now-active tab (echoed back for correlation).
</ResponseField>

**Example Response:**

```json theme={null}
{
  "success": true,
  "pageId": "EA5E9AA71C7A91C467F8CDBB266EE5E0"
}
```

### Error Responses

| Status | Description                                                                                          |
| ------ | ---------------------------------------------------------------------------------------------------- |
| `401`  | Unauthorized — invalid or missing API key.                                                           |
| `404`  | Session not found, not owned by the caller, or no tab with the given `pageId` exists in the session. |
| `408`  | Navigation timeout — rarely occurs, set if the underlying bring-to-front command stalls.             |
| `503`  | The browser session is temporarily unreachable.                                                      |

## Notes

* Subsequent session-scoped operations (mouse, keyboard, navigate, content, screenshot) target whichever tab is currently active. Use this to swap context between tabs without needing per-request `pageId` plumbing.
* The active tab also reflects in noVNC live-view — activating a tab brings it to the foreground for anyone watching.
