Skip to main content
POST
/
browser
/
sessions
/
{id}
/
pages
/
{pageId}
/
activate
Activate Tab
curl --request POST \
  --url https://api.example.com/browser/sessions/{id}/pages/{pageId}/activate
{
  "success": true,
  "pageId": "<string>"
}

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

id
string
required
Browser session ID (UUID). Create via POST /browser/sessions.
pageId
string
required
CDP target identifier of the tab to activate. 32-character uppercase hex. Obtain via POST /pages or GET /pages.

Body

No request body. Send an empty request.

Example Request

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"

Response

Success Response (200)

success
boolean
true when the tab was activated.
pageId
string
CDP target identifier of the now-active tab (echoed back for correlation).
Example Response:
{
  "success": true,
  "pageId": "EA5E9AA71C7A91C467F8CDBB266EE5E0"
}

Error Responses

StatusDescription
401Unauthorized — invalid or missing API key.
404Session not found, not owned by the caller, or no tab with the given pageId exists in the session.
408Navigation timeout — rarely occurs, set if the underlying bring-to-front command stalls.
503The 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.