Docs
Secrets ›

Set sandbox file

PUT/v1/sandboxes/{id}/secrets/files

Sets one of the sandbox's secret files, which is written into it, relative to its working folder, before every command. It is used from the sandbox's next command, without a restart. Where the sandbox's template names the same one, the sandbox's own is used.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. await sandbox.secrets.writeFile(".npmrc", npmrc);
Answer200 OK · SecretFile
  1. {
  2. "path": string,
  3. "text": string,
  4. }

The file as it is kept, with its path written one way.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"

Headers

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

Body

pathrequired
string
textrequired
string

Returns

200 The file as it is kept, with its path written one way.

SecretFile2 fields
path
string
text
string

Errors and other answers

400invalid_request the name, path or value is not one that can be kept.
400invalid_path the path leads out of the working folder.
404 Not found.

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