Change File Permissions
POST
/v1/sandbox/{sandbox_id}/files/permissionsPOST
/v1/sandbox/{'{sandbox_id}'}/files/permissionsYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Description
Changes the Unix file permission mode of a file within the sandbox. The mode is specified as an octal string (e.g., "755" for rwxr-xr-x, "644" for rw-r--r--). This is equivalent to running chmod on the file.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sandbox_id | string | Yes | Sandbox ID or name |
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute path of the file whose permissions should be changed |
mode | string | Yes | Unix permission mode as an octal string (e.g., "755", "644", "600") |
Responses
200 Success
| Property | Type | Description |
|---|---|---|
status | string | Always "ok" on success |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X POST "https://your-instance.example.com/v1/sandbox/sb_abc123/files/permissions" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"path": "/repo/script.sh",
"mode": "755"
}'const response = await fetch(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/permissions",
{
method: "POST",
headers: {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
path: "/repo/script.sh",
mode: "755",
}),
}
);
const data = await response.json();
console.log(data); // { status: "ok" }import requests
response = requests.post(
"https://your-instance.example.com/v1/sandbox/sb_abc123/files/permissions",
headers={"Authorization": "Bearer <token>"},
json={
"path": "/repo/script.sh",
"mode": "755",
},
)
print(response.json()) # {"status": "ok"}Response
{"status": "ok"}{"code": 0, "message": "string", "details": [{"@type": "string"}]}
