# \_setPermissions

Sets the CRM permissions of the specified User, controlling what they can do on the CRM.

### Parameters

#### id

The ID of the User.

#### val

The permission value as a bit field. Possible values are defined below. Multiple permissions are set by adding together their respective permission values.

Admin: Set to 1 to allow the User full access to all areas. Customer Admin: Set to 2 to allow the User full access to customer information instead of limited access. Web Access: Set to 4 to allow the User to log into the web application. Salaries: Set to 8 to allow the User to view and edit user salaries.

### Example

This example allows the User full access to customer information and allows them to view and edit user salaries. FM\_api('User\_setPermissions', \['id' => '123', 'val' => '10']);

### Results

#### On Success

```
{'ok':1}
```

#### On Failure

If the User is not logged in: {'error':'not logged in'}

If the User is not an Administrator: {'error':'only admins can edit user permissions'}

If the User tries to edit their own permissions: {'error':'you cannot edit your own permissions'}

If the main FieldMotion account User is not an Administrator: {'error':'the main FieldMotion account user must have admin access'}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fieldmotion.com/fieldmotion-api-docs/user/_setpermissions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
