Overview
Creates or overwrites a file in the session’s workspace with base64-encoded content. Parent directories are created automatically. Paths must be relative to the workspace root (no leading /, no .., no NUL byte, up to 4096 bytes).
Path Parameters
Browser session ID (UUID).
Body
Workspace-relative path, e.g. a/b/c.txt.
Base64-encoded file content.
Unix mode (octal). Applied after write.
Example Request
curl -X PUT "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/file" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"path": "notes/todo.txt",
"content": "SGVsbG8gV29ybGQ=",
"mode": 420
}'
Response
Success Response (201)
The written workspace-relative path.
Decoded byte length of the written content.
Example Response:
{
"path": "notes/todo.txt",
"bytes": 11
}
Error Responses
| Status | Description |
|---|
400 | Invalid body — bad path, non-base64 content, or unknown fields. |
401 | Unauthorized — invalid or missing API key. |
404 | Session not found. |
413 | Decoded content exceeds the maximum write size. |