Update Session
Stop a session and all its running tasks.
PATCH
/
sessions
/
{session_id}
Update 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/v2/sessions/{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/sessions/{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/sessions/{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",
"startedAt": "2023-11-07T05:31:56Z",
"tasks": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"llm": "<string>",
"task": "<string>",
"status": "created",
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"output": "<string>",
"browserUseVersion": "<string>",
"isSuccess": true,
"judgement": "<string>",
"judgeVerdict": true,
"cost": "<string>",
"suggestions": [
{}
]
}
],
"liveUrl": "<string>",
"recordingUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"publicShareUrl": "<string>",
"persistMemory": true,
"keepAlive": true,
"proxyUsedMb": "0",
"proxyCost": "0"
}{
"detail": "Session not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}Body
application/json
Response
Successful Response
View model for representing a (browser) session with its associated tasks.
Was this page helpful?
⌘I
Update 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/v2/sessions/{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/sessions/{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/sessions/{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",
"startedAt": "2023-11-07T05:31:56Z",
"tasks": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"llm": "<string>",
"task": "<string>",
"status": "created",
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"finishedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"output": "<string>",
"browserUseVersion": "<string>",
"isSuccess": true,
"judgement": "<string>",
"judgeVerdict": true,
"cost": "<string>",
"suggestions": [
{}
]
}
],
"liveUrl": "<string>",
"recordingUrl": "<string>",
"finishedAt": "2023-11-07T05:31:56Z",
"publicShareUrl": "<string>",
"persistMemory": true,
"keepAlive": true,
"proxyUsedMb": "0",
"proxyCost": "0"
}{
"detail": "Session not found"
}{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}