> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.islo.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.islo.dev/_mcp/server.

# Upload file

POST https://ca.compute.islo.dev/sandboxes/{sandbox_name}/files
Content-Type: multipart/form-data

Upload a file to a path inside a sandbox.

Reference: https://docs.islo.dev/api-reference/sandboxes/upload-file

## Request

### Path parameters

- `sandbox_name` (string, required) — Sandbox name

### Query parameters

- `path` (string, required) — Destination path inside the sandbox

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required)

## Response

### 200

File uploaded

- `status` (string, required)

## Errors

### 401 Unauthorized Error

Unauthorized

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

### 404 Not Found Error

Sandbox not found

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

## Examples

**Request**

```json
{
  "file": "<file: SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu>"
}
```

**Response**

```json
{
  "status": "File uploaded successfully"
}
```

**SDK Code**

```python
import requests

url = "https://ca.compute.islo.dev/sandboxes/sandbox_name/files"

querystring = {"path":"path"}

files = { "file": "open('SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu', 'rb')" }

response = requests.post(url, files=files, params=querystring)

print(response.json())
```

```javascript
const url = 'https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path';
const form = new FormData();
form.append('file', 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu');

const options = {method: 'POST'};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu',
        'contents' => null
    ]
  ]
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path");
var request = new RestRequest(Method.POST);
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation
let parameters = [
  [
    "name": "file",
    "fileName": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IGZpbGUu"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://ca.compute.islo.dev/sandboxes/sandbox_name/files?path=path")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```