Purge Session
Immediately purge all data for a session (ZDR projects only).
Redacts PII from database records and deletes all S3 objects (screenshots, output files, uploaded files, logs, history, downloads, agent state) for the given session. This is the same cleanup the ZDR cron performs, but on-demand and scoped to a single session with no grace period.
POST
/
sessions
/
{session_id}
/
purge
Purge Session
const options = {method: 'POST', headers: {'X-Browser-Use-API-Key': '<api-key>'}};
fetch('https://api.browser-use.com/api/v2/sessions/{session_id}/purge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.browser-use.com/api/v2/sessions/{session_id}/purge \
--header 'X-Browser-Use-API-Key: <api-key>'import requests
url = "https://api.browser-use.com/api/v2/sessions/{session_id}/purge"
headers = {"X-Browser-Use-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text){
"detail": "Session not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Was this page helpful?
⌘I
Purge Session
const options = {method: 'POST', headers: {'X-Browser-Use-API-Key': '<api-key>'}};
fetch('https://api.browser-use.com/api/v2/sessions/{session_id}/purge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.browser-use.com/api/v2/sessions/{session_id}/purge \
--header 'X-Browser-Use-API-Key: <api-key>'import requests
url = "https://api.browser-use.com/api/v2/sessions/{session_id}/purge"
headers = {"X-Browser-Use-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text){
"detail": "Session not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}