Docs
Commands and files ›

Write file

PUT/v1/sandboxes/{id}/files

Write a file.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. await sandbox.files.write("app/main.py", source);
Answer200 OK · FileWritten
  1. {
  2. "path": string,
  3. "bytes": integer,
  4. }

File written into the sandbox directory.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Headers

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

Body

pathrequired
string
text
string
base64
string

Returns

200 File written into the sandbox directory.

FileWritten2 fields
path
string
bytes
integer

Errors and other answers

400 Send exactly one of text or base64.
404 Not found.

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