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
Browser session ID (UUID).
Query Parameters
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)
The requested workspace-relative path.
Base64-encoded file content.
Decoded byte length of the file.
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
| Status | Description |
|---|
400 | Invalid path — leading /, contains .., NUL byte, or exceeds 4096 bytes. |
401 | Unauthorized — invalid or missing API key. |
404 | Session or file not found. |
413 | File exceeds the maximum read size. |