This KB explains how to run an API call to find out the users that are logged in at that time. No history of the past (logged out) users will be seen.
To know the status of users logged in using User-level authentication and/or VPN on the GUI is found under Device | User | Status page after you log in.

Â
User logged in status from CLI is explained here:Â
Step 1: Enable SonicOS API and Log in:
SonicOS API is disabled by default in SonicOS. Any attempt to access SonicOS API while it is disabled results in an HTTP 403 Forbidden error. To use the SonicOS API, you must enable it, either through the SonicOS Management Interface or from the CLI. Please enable the SonicOS API module in the SonicWall UI.
Gen 7:Â Enable SonicOS API Gen7
Gen 6:Â Enable SonicOS API Gen6
The above KB also has the steps on how to log in using API Applications
 CAUTION: My SonicWall interface IP address is 192.168.168.168 with login credentials as admin/password. This has to be kept in mind while running the commands from the below screenshots. Â
Â
Step 2: Calling on postman using GET method

There are 2 users:
cURL commands for the same example would be:
curl --location --request GET 'https://10.61.42.65/api/sonicos/user/status/logged-in/all' \--header 'Content-Type: application/json' \--header 'Accept: application/json' \--header 'Content-Type: application/xml' \--header 'Authorization: Basic YWRtaW46c29uaWN3YWxs' \--data '{"override" : true}'
Â
Step 3: Log out the SonicWall with API
It is recommended to log out from the SonicWall via API once the desired configuration is committed.
curl -k -i -u "admin:password" -X DELETE https://192.168.188.200/api/sonicos/auth