Skip to main content
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>', contentType: 'image/jpg', 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));
{
  "url": "<string>",
  "method": "<string>",
  "fields": {},
  "fileName": "<string>",
  "expiresIn": 123
}

Authorizations

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

Path Parameters

session_id
string<uuid>
required

Body

application/json

Request model for uploading a file to the user's files bucket.

fileName
string
required

The name of the file to upload

Required string length: 1 - 255
contentType
enum<string>
required

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
sizeBytes
integer
required
Required range: 1 <= x <= 10485760

Response

Successful Response

Response model for a presigned upload URL.

url
string
required

The URL to upload the file to.

method
string
required

The HTTP method to use for the upload.

Allowed value: "POST"
fields
Fields · object
required

The form fields to include in the upload request.

fileName
string
required

The name of the file to upload (should be referenced when user wants to use the file in a task).

expiresIn
integer
required

The number of seconds until the presigned URL expires.