sample.pdf becomes sample-1719265797164.pdf).
View or run the example template here
Triggering downloads
First, trigger a download in your browser automation:- Create a browser session and get the session ID
- Connect to the session using your preferred framework
- Configure your library’s downloads location
- Perform the download action in your automation script
- Node.js
- Python
Retrieving downloaded files
After triggering downloads, retrieve them using the Downloads API. The API provides granular access to individual downloaded files. You can list, filter, retrieve, and delete downloads. Filenames don’t include the timestamp suffix Browserbase adds during storage.Files sync in real time, but large downloads may not be immediately available
through the
/downloads endpoint. The code below includes retry logic to
handle this.List downloads
List all downloads for a session with optional filtering by filename, MIME type, file size, and creation time.- Node.js
- Python
Node
Filtering options
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Required. The session ID to list downloads for. |
filename | string | Filter by exact filename match. |
mimeType | string | Filter by MIME type (e.g., application/pdf). |
minSize | number | Minimum file size in bytes. |
maxSize | number | Maximum file size in bytes. |
createdAfter | string | Filter downloads created after this timestamp (ISO 8601). |
createdBefore | string | Filter downloads created before this timestamp (ISO 8601). |
limit | number | Maximum results to return (1-100, default: 20). |
offset | number | Number of results to skip for pagination. |
- Node.js
- Python
Node
Get a download
Retrieve metadata or file content for a specific download. UseAccept: application/json for metadata, or Accept: application/octet-stream to download the file (default if no Accept header is provided).
- Node.js
- Python
Node
Delete a download
Remove a download from storage. Returns204 No Content on success.
- Node.js
- Python
Node
Download object
Each download contains the following fields:| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the download. |
sessionId | string | The session ID this download belongs to. |
filename | string | The filename of the downloaded file. |
mimeType | string | The MIME type of the file. |
size | number | File size in bytes. |
checksum | string | SHA256 checksum of the file. |
createdAt | string | Timestamp when the file was downloaded (ISO 8601). |
List downloads
List and filter downloads
Get download
Get metadata or file content
Delete download
Remove a download