Skip to content

POST /api/browser/close

Terminal window
curl -X POST https://browser.rayobyte.com/api/browser/close \
-H "x-api-key: rb_live_YOUR_KEY" \
-H "content-type: application/json" \
-d '{"browserId": "br_3f8a1c9d2e4b5a60"}'
{ "browserId": "br_3f8a1c9d2e4b5a60", "status": "CLOSED" }

Auth: x-api-key header.

Field Type Required
browserId string Yes

The field is browserId. Its value is either the x-session-id header from the create or the br_ id at the end of the CDP URL; both close the same session, and the response names it by its x-session-id value. Sending the field as sessionId is rejected with 400 browserId is required.

Closing a session that has already ended returns 200 with its final status, CLOSED, DEAD or EXPIRED, so calling twice is safe. A browser the backend has already lost answers 200 CLOSED.

The session’s concurrency slot is freed the moment it reaches CLOSED, and its full duration is added to your browser hours.

Status Message Meaning
400 browserId is required Field missing from the body
401 Missing API key No x-api-key header
401 Invalid API key The key is not a live key
404 Session not found No session with that id, or it belongs to another account
502 Backend DELETE failed: ... The backend refused. The session stays ACTIVE; call again
500 varies The close failed in the gateway. Call again

A 502 is the one to retry. The browser is still running and still spending your hours until a close succeeds or its lifetime ends.

Was this page helpful?