Delete Session
Delete a session: it disappears from the session lists and can no longer be opened or continued.
Soft delete (mirrors V2’s is_archived): the runs, events and usage records
stay in place so billing and analytics keep reconciling, and ZDR purge is the
only thing that ever destroys V4 content. Idempotent — deleting twice is a
no-op 204.
An in-flight run is cancelled first, and pending queued messages are
cancelled too; otherwise the drain would dispatch a follow-up run whose
session_archived_at is NULL and resurrect the session. Cancel is forwarded
to CP before anything is written (and outside the queue lock, per the
enqueue path’s ordering), so a CP failure (502) leaves the session visible
rather than hiding a run that is still burning credits.
const options = {method: 'DELETE', headers: {'X-Browser-Use-API-Key': '<api-key>'}};
fetch('https://api.browser-use.com/api/v4/sessions/{session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request DELETE \
--url https://api.browser-use.com/api/v4/sessions/{session_id} \
--header 'X-Browser-Use-API-Key: <api-key>'import requests
url = "https://api.browser-use.com/api/v4/sessions/{session_id}"
headers = {"X-Browser-Use-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text){
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Was this page helpful?
const options = {method: 'DELETE', headers: {'X-Browser-Use-API-Key': '<api-key>'}};
fetch('https://api.browser-use.com/api/v4/sessions/{session_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request DELETE \
--url https://api.browser-use.com/api/v4/sessions/{session_id} \
--header 'X-Browser-Use-API-Key: <api-key>'import requests
url = "https://api.browser-use.com/api/v4/sessions/{session_id}"
headers = {"X-Browser-Use-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text){
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}