Share feedback
Answers are generated based on the documentation.

Experimental

Upload streams one or more files.

POST/v1/files/upload
Upload streams one or more files. The first frame must be FileHeader. Writing through a symlink that leaves the jail, or onto an existing non-regular object, refuses with FAILED_PRECONDITION and a error reason.

Connection and access

API connection and authentication guidance

{endpoint}

endpoint: The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control.

Use one of these alternatives. Requirements within an alternative apply together.

  • sandboxBearer

Parameters

No parameters are declared.

Request and responses

Request

Send ordered metadata/content pairs. Each metadata part is application/json; the following content part is application/octet-stream containing raw bytes, including an empty file. Content-Disposition is form-data with the corresponding part name. Content-Transfer-Encoding is refused. A clean closing multipart delimiter is required; truncated content never completes the current item. Malformed occurrences report invalidArgument with a BadRequest detail identifying the occurrence index and path.

multipart/form-data

Stream item

Exactly one alternative must match

Type: object

metadata · required

Schema: FileHeader

All schema constraints and annotations
{
  "additionalProperties": false,
  "properties": {
    "metadata": {
      "$ref": "#/components/schemas/FileHeader"
    }
  },
  "required": [
    "metadata"
  ],
  "type": "object"
}

Type: object

content · required
All schema constraints and annotations
{
  "contentMediaType": "application/octet-stream"
}
All schema constraints and annotations
{
  "additionalProperties": false,
  "properties": {
    "content": {
      "contentMediaType": "application/octet-stream"
    }
  },
  "required": [
    "content"
  ],
  "type": "object"
}
All schema constraints and annotations
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "metadata": {
          "$ref": "#/components/schemas/FileHeader"
        }
      },
      "required": [
        "metadata"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "content": {
          "contentMediaType": "application/octet-stream"
        }
      },
      "required": [
        "content"
      ],
      "type": "object"
    }
  ]
}
itemEncoding: content types and part headers
{
  "contentType": "application/json, application/octet-stream"
}

Response 200

Success

application/json

Schema: FilesUploadResponse

Response 409

The path resolves through a symlink that does not resolve to a target inside the sandbox jail.

The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.

application/json

Schema: Error

path_authority_nonregular_object

{
  "code": "failedPrecondition",
  "message": "path_authority_nonregular_object: The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required."
}

path_authority_symlink_escape

{
  "code": "failedPrecondition",
  "message": "path_authority_symlink_escape: The path resolves through a symlink that does not resolve to a target inside the sandbox jail."
}

Response default

The structured Error body identifies the failure with a stable code and optional typed details.

application/json

Schema: Error

Schema example

{
  "code": "notFound",
  "details": [],
  "message": "sandbox not found"
}

Referenced schemas

#/components/schemas/Error

#/components/schemas/FileHeader

#/components/schemas/FilesUploadRequest

#/components/schemas/FilesUploadResponse

Complete operation contract
{
  "description": "Upload streams one or more files. The first frame must be FileHeader.\nWriting through a symlink that leaves the jail, or onto an existing\nnon-regular object, refuses with FAILED_PRECONDITION and a error reason.",
  "operationId": "upload",
  "requestBody": {
    "content": {
      "multipart/form-data": {
        "itemEncoding": {
          "contentType": "application/json, application/octet-stream"
        },
        "itemSchema": {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "metadata": {
                  "$ref": "#/components/schemas/FileHeader"
                }
              },
              "required": [
                "metadata"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "content": {
                  "contentMediaType": "application/octet-stream"
                }
              },
              "required": [
                "content"
              ],
              "type": "object"
            }
          ]
        },
        "x-sbx-framing": {
          "description": "Send ordered metadata/content pairs. Each metadata part is application/json; the following content part is application/octet-stream containing raw bytes, including an empty file. Content-Disposition is form-data with the corresponding part name. Content-Transfer-Encoding is refused. A clean closing multipart delimiter is required; truncated content never completes the current item. Malformed occurrences report invalidArgument with a BadRequest detail identifying the occurrence index and path.",
          "partOrder": [
            "metadata",
            "content"
          ],
          "repeatedItems": true,
          "requiresClosingDelimiter": true
        }
      }
    },
    "description": "Send ordered metadata/content pairs. Each metadata part is application/json; the following content part is application/octet-stream containing raw bytes, including an empty file. Content-Disposition is form-data with the corresponding part name. Content-Transfer-Encoding is refused. A clean closing multipart delimiter is required; truncated content never completes the current item. Malformed occurrences report invalidArgument with a BadRequest detail identifying the occurrence index and path.",
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/FilesUploadResponse"
          }
        }
      },
      "description": "Success"
    },
    "409": {
      "content": {
        "application/json": {
          "examples": {
            "path_authority_nonregular_object": {
              "summary": "The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.",
              "value": {
                "code": "failedPrecondition",
                "message": "path_authority_nonregular_object: The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required."
              }
            },
            "path_authority_symlink_escape": {
              "summary": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.",
              "value": {
                "code": "failedPrecondition",
                "message": "path_authority_symlink_escape: The path resolves through a symlink that does not resolve to a target inside the sandbox jail."
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.\n\nThe path names an existing socket, FIFO, device, or other non-regular object where a regular file is required."
    },
    "default": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "description": "The structured Error body identifies the failure with a stable code and optional typed details."
    }
  },
  "security": [
    {
      "sandboxBearer": []
    }
  ],
  "servers": [
    {
      "url": "{endpoint}",
      "variables": {
        "endpoint": {
          "default": "https://sandbox.invalid",
          "description": "The sandbox API base URL from Sandbox.core.endpoint.uri; preserve its path prefix when appending /v1 routes. HTTP endpoints require a scoped endpoint bearer; direct Unix sockets use socket access control."
        }
      }
    }
  ],
  "summary": "Upload streams one or more files.",
  "tags": [
    "Files"
  ],
  "x-sbx-authenticated-only": false,
  "x-sbx-conditional-permissions": [],
  "x-sbx-error-responses": [
    {
      "code": "FAILED_PRECONDITION",
      "description": "The path resolves through a symlink that does not resolve to a target inside the sandbox jail.",
      "reason": "path_authority_symlink_escape"
    },
    {
      "code": "FAILED_PRECONDITION",
      "description": "The path names an existing socket, FIFO, device, or other non-regular object where a regular file is required.",
      "reason": "path_authority_nonregular_object"
    }
  ],
  "x-sbx-http-transfer": {
    "request": {
      "bytesField": "data",
      "itemPathField": "header.path",
      "mediaType": "multipart/form-data",
      "metadataField": "header",
      "repeatedItems": true
    }
  },
  "x-sbx-plane": "data",
  "x-sbx-request-schema": {
    "$ref": "#/components/schemas/FilesUploadRequest"
  },
  "x-sbx-required-permissions": [
    "sandboxesFilesWrite"
  ],
  "x-sbx-response-schema": {
    "$ref": "#/components/schemas/FilesUploadResponse"
  },
  "x-sbx-serving-surface": "sandboxEndpoint"
}