Close Tab
Browser Sessions
Close Tab
Close a tab by pageId.
DELETE
Close Tab
Overview
TheDELETE /browser/sessions/{id}/pages/{pageId} endpoint closes a single tab in the session. The tab is identified by its CDP target identifier, which you can obtain from POST /browser/sessions/{id}/pages or GET /browser/sessions/{id}/pages.
Closing the currently active tab promotes another tab to active. You cannot close the last remaining tab in a session — doing so returns 409 Conflict.
Path Parameters
Browser session ID (UUID). Create via
POST /browser/sessions.CDP target identifier of the tab to close. 32-character uppercase hex. Obtain via
POST /pages or GET /pages.Body
No request body. Send an empty request.Example Request
Response
Success Response (200)
true when the tab was closed.CDP target identifier of the closed tab (echoed back for correlation).
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 while processing the close (rare — occurs when beforeunload handlers block). |
409 | Cannot close the last remaining tab in the session. Close the session instead. |
503 | The browser session is temporarily unreachable. |
Notes
- If the closed tab was active, another tab is promoted to active. Call
GET /browser/sessions/{id}/pagesto inspect the new active tab. - To end a session entirely, call
DELETE /browser/sessions/{id}rather than closing the last tab.