Docs
Commands and files ›

Read file

GET/v1/sandboxes/{id}/files

Read a file.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. const text = await sandbox.files.read("app/main.py");
Answer200 OK · FileContents
  1. {
  2. "path": string,
  3. "encoding": "text" | "base64",
  4. "text": string,
  5. "base64": string,
  6. }

File contents as text or base64.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Query

pathrequired
string
encoding
"text" | "base64"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 File contents as text or base64.

FileContents4 fields
path
string
encoding
textbase64
text
string
base64
string

Errors and other answers

400 Invalid path or the file is not UTF-8.
404 Not found.
503sandbox_moved the sandbox was moved to another server while this was being done, and it was cut off. Send it again.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.