Agent Session Upload File Presigned Url
Generate a secure presigned URL for uploading files to an agent session.
POST
/
files
/
sessions
/
{session_id}
/
presigned-url
Agent Session Upload File Presigned Url
const options = {
method: 'POST',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>', sizeBytes: 5242880})
};
fetch('https://api.browser-use.com/api/v2/files/sessions/{session_id}/presigned-url', 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/files/sessions/{session_id}/presigned-url \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"fileName": "<string>",
"sizeBytes": 5242880
}
'import requests
url = "https://api.browser-use.com/api/v2/files/sessions/{session_id}/presigned-url"
payload = {
"fileName": "<string>",
"sizeBytes": 5242880
}
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"url": "<string>",
"method": "POST",
"fields": {},
"fileName": "<string>",
"expiresIn": 123
}{
"detail": "Unsupported content type"
}{
"detail": "Session not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "An internal server error occurred"
}Body
application/json
Request model for uploading a file to the user's files bucket.
The content type of the file to upload
Available options:
image/jpg, image/jpeg, image/png, image/gif, image/webp, image/svg+xml, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, text/plain, text/csv, text/markdown Response
Successful Response
Response model for a presigned upload URL.
Was this page helpful?
⌘I
Agent Session Upload File Presigned Url
const options = {
method: 'POST',
headers: {'X-Browser-Use-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>', sizeBytes: 5242880})
};
fetch('https://api.browser-use.com/api/v2/files/sessions/{session_id}/presigned-url', 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/files/sessions/{session_id}/presigned-url \
--header 'Content-Type: application/json' \
--header 'X-Browser-Use-API-Key: <api-key>' \
--data '
{
"fileName": "<string>",
"sizeBytes": 5242880
}
'import requests
url = "https://api.browser-use.com/api/v2/files/sessions/{session_id}/presigned-url"
payload = {
"fileName": "<string>",
"sizeBytes": 5242880
}
headers = {
"X-Browser-Use-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"url": "<string>",
"method": "POST",
"fields": {},
"fileName": "<string>",
"expiresIn": 123
}{
"detail": "Unsupported content type"
}{
"detail": "Session not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "An internal server error occurred"
}