> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/users/_getdepartments.md).

# \_getDepartments

Fetch all the Departments that all Users belong to.

### Parameters

None.

### Example

```
FM_api('Users_getDepartments');
```

### Result

#### On Success

An array of arrays of all Departments and all the Users that are in them. For example: {\['id':'1','name':'Department One','users':\[1,2,3],'id':'2','name':'Department Two','users':\[4,5,6]]}

#### On Failure

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