Skip to main content
GET
/
browser
/
sessions
/
{id}
/
fs
/
file
Read File
curl --request GET \
  --url https://api.example.com/browser/sessions/{id}/fs/file
{
  "path": "<string>",
  "content": "<string>",
  "bytes": 123,
  "truncated": true
}

Overview

Returns the base64-encoded content of a file in the session’s workspace. The workspace is a per-session scratch directory inside the sandbox; paths must be relative (no leading /, no .., no NUL byte, up to 4096 bytes). Large files are truncated at the sandbox-enforced read limit — check truncated in the response.

Path Parameters

id
string
required
Browser session ID (UUID).

Query Parameters

path
string
required
Workspace-relative file path, e.g. notes/todo.txt.

Example Request

curl -G "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/file" \
  -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
  --data-urlencode "path=notes/todo.txt"

Response

Success Response (200)

path
string
The requested workspace-relative path.
content
string
Base64-encoded file content.
bytes
integer
Decoded byte length of the file.
truncated
boolean
True when the content was truncated to the maximum read size.
Example Response:
{
  "path": "notes/todo.txt",
  "content": "SGVsbG8gV29ybGQ=",
  "bytes": 11,
  "truncated": false
}

Error Responses

StatusDescription
400Invalid path — leading /, contains .., NUL byte, or exceeds 4096 bytes.
401Unauthorized — invalid or missing API key.
404Session or file not found.
413File exceeds the maximum read size.