How to get list of logged in users using REST API

Sachit Tiwari
Kilo Explorer

How can we get a list of logged in users using REST API or check if a user is online or not using REST API.

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi Sachit,

You can query the v_user_session table to find active sessions. Use the REST API Explorer to change the returned results. See below example

find_real_file.png

GET https://yourinstanceID.service-now.com/api/now/table/v_user_session?sysparm_query=user!%3Dguest&sysparm_limit=1

View solution in original post

2 REPLIES 2

Kieran Anson
Kilo Patron

Hi Sachit,

You can query the v_user_session table to find active sessions. Use the REST API Explorer to change the returned results. See below example

find_real_file.png

GET https://yourinstanceID.service-now.com/api/now/table/v_user_session?sysparm_query=user!%3Dguest&sysparm_limit=1

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sachit,

this table stores the logged in users "v_user_session"; It stores User and whether the session is Active or not.

once user logs out the entry for that user is removed from this table.

So you can use this table with below query in REST API

Http Method: GET

Endpoint: https://instanceName.service-now.com/api/now/table/v_user_session?sysparm_query=active%3Dtrue

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader