> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapengine.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Permissions

> Change mode and/or owner of a workspace path.

## Overview

Applies `chmod` 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

<ParamField path="id" type="string" required={true}>
  Browser session ID (UUID).
</ParamField>

## Body

<ParamField body="path" type="string" required={true}>
  Workspace-relative path to modify.
</ParamField>

<ParamField body="mode" type="integer">
  New Unix mode (octal).
</ParamField>

<ParamField body="uid" type="integer">
  New owner UID. Requires `CAP_CHOWN` in the sandbox.
</ParamField>

<ParamField body="gid" type="integer">
  New owner GID. Requires `CAP_CHOWN` in the sandbox.
</ParamField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  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
    }'
  ```
</CodeGroup>

## Response

### Success Response (200)

<ResponseField name="path" type="string">
  The modified workspace-relative path.
</ResponseField>

**Example Response:**

```json theme={null}
{
  "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.                 |
