Change Permissions
curl --request PUT \
--url https://api.example.com/browser/sessions/{id}/fs/permissions \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"mode": 123,
"uid": 123,
"gid": 123
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/fs/permissions"
payload = {
"path": "<string>",
"mode": 123,
"uid": 123,
"gid": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', mode: 123, uid: 123, gid: 123})
};
fetch('https://api.example.com/browser/sessions/{id}/fs/permissions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/fs/permissions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'mode' => 123,
'uid' => 123,
'gid' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/fs/permissions"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/browser/sessions/{id}/fs/permissions")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/fs/permissions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>"
}Filesystem
Change Permissions
Change mode and/or owner of a workspace path.
PUT
/
browser
/
sessions
/
{id}
/
fs
/
permissions
Change Permissions
curl --request PUT \
--url https://api.example.com/browser/sessions/{id}/fs/permissions \
--header 'Content-Type: application/json' \
--data '
{
"path": "<string>",
"mode": 123,
"uid": 123,
"gid": 123
}
'import requests
url = "https://api.example.com/browser/sessions/{id}/fs/permissions"
payload = {
"path": "<string>",
"mode": 123,
"uid": 123,
"gid": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({path: '<string>', mode: 123, uid: 123, gid: 123})
};
fetch('https://api.example.com/browser/sessions/{id}/fs/permissions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/browser/sessions/{id}/fs/permissions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'path' => '<string>',
'mode' => 123,
'uid' => 123,
'gid' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/browser/sessions/{id}/fs/permissions"
payload := strings.NewReader("{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/browser/sessions/{id}/fs/permissions")
.header("Content-Type", "application/json")
.body("{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/browser/sessions/{id}/fs/permissions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"path\": \"<string>\",\n \"mode\": 123,\n \"uid\": 123,\n \"gid\": 123\n}"
response = http.request(request)
puts response.read_body{
"path": "<string>"
}Overview
Applieschmod and/or chown to a workspace path. Changing uid/gid requires CAP_CHOWN in the sandbox — most production sandboxes drop this capability, so only mode will succeed. At least one of mode, uid, or gid should be set.
Path Parameters
string
required
Browser session ID (UUID).
Body
string
required
Workspace-relative path to modify.
integer
New Unix mode (octal).
integer
New owner UID. Requires
CAP_CHOWN in the sandbox.integer
New owner GID. Requires
CAP_CHOWN in the sandbox.Example Request
curl -X PUT "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/fs/permissions" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"path": "scripts/run.sh",
"mode": 493
}'
Response
Success Response (200)
string
The modified workspace-relative path.
{
"path": "scripts/run.sh"
}
Error Responses
| Status | Description |
|---|---|
400 | Invalid path, mode, uid, or gid. |
401 | Unauthorized — invalid or missing API key. |
404 | Session or path not found. |
Was this page helpful?
⌘I