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).
PATCH
/
browsers
/
{session_id}
Update Browser Session
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/v4/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/v4/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/v4/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>"
}Body
application/json
Response
Successful Response
View model for representing a browser session.
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.
Was this page helpful?
⌘I
Update Browser Session
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/v4/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/v4/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/v4/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>"
}