API Reference

Files

Upload files to browser sessions (for form submissions) and download files that the browser has downloaded during the session. Files are stored temporarily and removed when the session is released.

Upload File

POST/v1/sessions/:id/files

Upload a file to a session. The file is stored in the session's upload directory and can be used with file input elements. Send as multipart/form-data.

Parameters

NameTypeRequiredDefaultDescription
fileFileYesThe file to upload (multipart form field).

Response

{
  "uploaded": "document.pdf",
  "size": 102400
}
curl -X POST "https://api.browsefleet.com/v1/sessions/sess_abc123/files" \
  -H "x-api-key: bf_your_api_key" \
  -F "file=@document.pdf"

List Files

GET/v1/sessions/:id/files

List all files associated with a session, including both uploaded files and files downloaded by the browser.

Response

{
  "files": [
    "uploads/document.pdf",
    "downloads/report.csv"
  ]
}
curl "https://api.browsefleet.com/v1/sessions/sess_abc123/files" \
  -H "x-api-key: bf_your_api_key"

Download File

GET/v1/sessions/:id/files/:name

Download a file from a session. Checks both the upload and download directories. Returns the file as binary data with Content-Disposition header.

curl "https://api.browsefleet.com/v1/sessions/sess_abc123/files/report.csv" \
  -H "x-api-key: bf_your_api_key" \
  --output report.csv

Use Cases

Form file uploads

Upload a file to the session, then use Puppeteer to set the file on an input element.

Downloading exports

Trigger a download in the browser, then retrieve the file via the files API.

Data extraction pipelines

Navigate to a site, trigger CSV/Excel export, download the file, and process it programmatically.