Skip to main content
POST
/
sessions
/
{session_id}
/
queue
Queue Session Message
const options = {
  method: 'POST',
  headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    text: '<string>',
    interrupt: false,
    attachedFileIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
  })
};

fetch('https://api.browser-use.com/api/v4/sessions/{session_id}/queue', 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/v4/sessions/{session_id}/queue \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"text": "<string>",
"interrupt": false,
"attachedFileIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'
import requests

url = "https://api.browser-use.com/api/v4/sessions/{session_id}/queue"

payload = {
"text": "<string>",
"interrupt": False,
"attachedFileIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
}
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "id": 123,
  "sessionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "runId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "text": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "attachedFileIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

X-Browser-Use-API-Key
string
header
required

Path Parameters

session_id
string<uuid>
required

Body

application/json

Send a message to a session. If the session is busy the message waits on the queue and runs as the next turn; if idle it runs immediately.

Set interrupt to make it take effect now: the session's active run is cancelled and this message drains straight after. Interrupt is a no-op when the session is already idle, and BEST-EFFORT when busy — if the cancel can't be delivered, the message stays queued and runs after the current turn.

text
string
required
Minimum string length: 1
interrupt
boolean
default:false
attachedFileIds
string<uuid>[] | null
Maximum array length: 20

Response

Successful Response

One message on a session's queue (a v4_session_input row).

id
integer
required
sessionId
string<uuid>
required
runId
string<uuid> | null
required
status
enum<string>
required
Available options:
pending,
dispatching,
consumed,
cancelled,
superseded,
failed
text
string
required
createdAt
string<date-time>
required
attachedFileIds
string<uuid>[] | null