Update Browser Session
Stop a browser session.
Refund: When you stop a session, unused time is automatically refunded. If the session ran for less than 1 hour, you’ll receive a proportional refund. Billing is ceil to the nearest minute (minimum 1 minute).
const options = {
method: 'PATCH',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: 'stop'})
};
fetch('https://api.browser-use.com/api/v2/browsers/{session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.browser-use.com/api/v2/browsers/{session_id} \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"action": "stop"
}
'import requests
url = "https://api.browser-use.com/api/v2/browsers/{session_id}"
payload = { "action": "stop" }
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"timeoutAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"liveUrl": "<string>",
"cdpUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"proxyUsedMb": "0",
"proxyCost": "0",
"browserCost": "0",
"agentSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recordingUrl": "<string>",
"recordingAvailable": true,
"metadata": {},
"extensions": []
}{
"detail": "Session not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}Authorizations
Path Parameters
Body
Request model for updating browser session state.
The action to perform on the session
stop Response
Successful Response
View model for representing a browser session.
Unique identifier for the session
Current status of the session (active/stopped)
active, stopped Timestamp when the session will timeout
Timestamp when the session was created and started
URL where the browser can be viewed live in real-time
Chrome DevTools Protocol URL for browser automation
Timestamp when the session was stopped (None if still active)
Amount of proxy data used in MB
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Cost of proxy usage in USD
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Cost of browser session hosting in USD
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$ID of the agent session that created this browser (None for standalone BaaS sessions)
Presigned URL to download the session recording, if recording was enabled. Only populated on GET /api/v2/browsers/{session_id}: the upload starts when the browser stops, so it is never ready in the stop response.
False when a recording can never appear for this session: recording was disabled, or the browser stopped long enough ago that the upload is not coming. Only ever false from proof, so a failed recording lookup leaves it true. Clients polling for recordingUrl must stop when this is false.
Caller-supplied labels set when the browser was created.
Show child attributes
Show child attributes
Extensions installed in the browser, in the order of extensionIds.
Show child attributes
Show child attributes
Was this page helpful?
const options = {
method: 'PATCH',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: 'stop'})
};
fetch('https://api.browser-use.com/api/v2/browsers/{session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.browser-use.com/api/v2/browsers/{session_id} \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"action": "stop"
}
'import requests
url = "https://api.browser-use.com/api/v2/browsers/{session_id}"
payload = { "action": "stop" }
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"timeoutAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"liveUrl": "<string>",
"cdpUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"proxyUsedMb": "0",
"proxyCost": "0",
"browserCost": "0",
"agentSessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"recordingUrl": "<string>",
"recordingAvailable": true,
"metadata": {},
"extensions": []
}{
"detail": "Session not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}