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

# forest roles:export

> Export the permissions of every role on an environment to a CSV file

# forest roles:export

Export all roles and their permissions on one environment to a wide CSV file: one row per role, one column per permission. Edit the file in a spreadsheet, then apply it with [`forest roles:apply`](https://docs.forest.app/reference/cli/roles-apply).

## Usage

```bash theme={null}
forest roles:export --env <ENVIRONMENT> [options]
```

## Options

| Option | Description |
| - | - |
| `-e, --env` | Name of the environment to export permissions for (required) |
| `-o, --output` | Output file path. Without it, the CSV goes to standard output |
| `-p, --projectId` | The ID of the project to work on |

## CSV format

Every cell holds `true` or `false`.

| Column | Permission |
| - | - |
| `role` | Name of the role |
| `enabled` | Whether the role has access to the environment |
| `<collection>:browse` | Browse the collection |
| `<collection>:read` | Read a record |
| `<collection>:add` | Create a record |
| `<collection>:edit` | Edit a record |
| `<collection>:delete` | Delete a record |
| `<collection>:export` | Export records |
| `<collection>:<action>:trigger` | Trigger the action |
| `<collection>:<action>:approvalRequired` | The action requires an approval |
| `<collection>:<action>:userApproval` | The role approves the action when others trigger it |
| `<collection>:<action>:selfApproval` | The role approves its own requests |
| `<collection>:<action>:hasConditions` | The action permission has conditions. Read-only: [`roles:apply`](https://docs.forest.app/reference/cli/roles-apply) ignores it |

The export lists the collections the roles have permissions on in this environment, sorted by name, and the actions of each collection.

```csv theme={null}
role,enabled,orders:browse,orders:read,orders:add,orders:edit,orders:delete,orders:export,orders:Refund:trigger,orders:Refund:approvalRequired,orders:Refund:userApproval,orders:Refund:selfApproval,orders:Refund:hasConditions
Admin,true,true,true,true,true,true,true,true,false,true,true,false
Support,true,true,true,false,true,false,false,true,true,false,false,false
```

## Examples

```bash theme={null}
# Export production permissions to a file
forest roles:export --env Production --output roles.csv

# Print them to the terminal
forest roles:export -e staging
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.