For AI agents: a documentation index is available at /llms.txt
Skip to main content

Close a Browser Session

Fully terminate a remote browser session and release all resources by calling browser.close() or sending a DELETE request to the session stop endpoint.

Disconnect without closing

Want to detach from a browser without terminating it so you can reconnect later? See Disconnect and Reconnect to a Browser for the graceful disconnect pattern.

Prerequisites

Steps

Closing a session shuts down the browser process and frees compute resources. Use browser.close() in framework code, or DELETE /session/{id} for REST-managed sessions.

Use the Session API to create a session, then explicitly terminate it with a DELETE request when finished.

View Full Code on GitHub

1. Create a session

curl -X POST "https://production-sfo.browserless.io/session?token=YOUR_API_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"ttl": 60000,
"stealth": true
}'

The response includes a stop field with the DELETE URL.

2. Close the session

curl -X DELETE "STOP_URL_FROM_STEP_1&force=true"

The force=true parameter ensures the session is terminated immediately, even if a browser is still connected.