REST API not able to authorize login

dshallcross
Giga Contributor

We are looking to extract data via the REST API. When attempting to do we are presented with a 401 error in postman and also other methods of calling the endpoint.  We are definitely using the correct username and password via basic auth. Co-pilot suggests it could be a permissions setup as we are using SSO for other accounts in the business. Could this be possible? How do I stop SSO interfering with the service account calling the API endpoint. This is unlike the other like this in the community forum, we don't wish to extract data from dev.

This is the endpoint being attempted api/now/table/sys_user?sysparm_limit=1

Example error

dshallcross_0-1778161704561.png

 

12 REPLIES 12

Hello @dshallcross 

Below are my three recommendations for you to try:

1. Add "Admin" role temporarily to this user and then try with postman whether it is 200 or 401.
2. If you are able to login with this user into ServiceNow instance, then go to REST API Explorer and click (first option) "Retrieve records from a table (GET), tableName as User (sys_user) and hit Send (scroll down a little).
3. Try to create a same user with same roles in your PDI and validate it with POSTMAN.


Hope that helps!

Linda30
Tera Contributor

Hi @dshallcross , were you able to resolve this? I am also facing the same issue.

yashwanthv0
Tera Contributor

Hey @dshallcross , in my experience a 401 with Basic Auth is almost always the credentials themselves rather than an SSO issue. Double check that the username and password are correct for that specific account, and make sure the account isn't locked out or expired in ServiceNow. SSO wouldn't typically cause a 401 on a direct Basic Auth API call — it would just redirect instead. Try resetting the password on the service account and retry with the new credentials first before looking at SSO config.

 

Screenshot 2026-05-20 114355.pngScreenshot 2026-05-20 114436.pngScreenshot 2026-05-20 114510.png