Commands and files ›
Read file
GET
/v1/sandboxes/{id}/filesRead a file.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const text = await sandbox.files.read("app/main.py");
Answer200 OK · FileContents
- {
- "path": string,
- "encoding": "text" | "base64",
- "text": string,
- "base64": string,
- }
File contents as text or base64.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
Query
pathrequiredstring | |
encoding"text" | "base64" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 File contents as text or base64.
FileContents4 fields
pathstring
encodingtextbase64
textstring
base64string
Errors and other answers
| 400 | Invalid path or the file is not UTF-8. |
| 404 | Not found. |
| 503 | sandbox_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.