Skip to content
Hayonix

API reference · Sandboxes

Upload a file into the sandbox’s workspace (replaces it; parents are created)

PUT/v1/sandboxes/{sandbox_id}/files/content
API keysandbox:updateProject
TypeScript
client.sandboxes.uploadFile()
Python
client.sandboxes.upload_file()
CLI
hayonix sandboxes files upload

Writes the body to path, replacing any file there; the file appears only once it is complete. At most 67108864 bytes (413 file_too_large beyond). Works only while the sandbox is running.

Project API key (Authorization: Bearer sk_…), or a console session. Requires the sandbox:update permission (a key's scope, or a role that includes it).

Examples

The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.

curl -sS -X PUT "$API_BASE_URL/sandboxes/sbx_01jc5zq4m8k3v6x9t2w7r0b1e4/files/content" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@data.jsonl"

Request

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Path parameters

  • sandbox_idstringrequired

    ID of the sandbox

    ID with prefix sbx_

Query parameters

  • pathstring

    Relative to the workspace (/workspace); "" or "." is the workspace itself

    up to 1024 characters

Body

A multipart form (multipart/form-data).

  • filefilerequired

    The file’s content

Response

200 SandboxUploadedFile — Stored

  • objectstringrequired

    Always `sandbox_file`: the type of this object

    One ofsandbox_file

  • pathstringrequired

    Where it was stored, relative to the workspace

  • sizeintegerrequired

    Bytes stored

Example response
Example response
{
  "object": "sandbox_file",
  "path": "string",
  "size": 1
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
409conflict_errorThe resource's current state does not allow this.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.