OAuth (Open Authorization) is a secure way to allow applications to access resources on behalf of a user without exposing their credentials. This guide will walk you through setting up OAuth for ServiceNow Table API and configuring Postman to use OAuth tokens for making API requests. As a mockup feel free to use use our project in Postman
Prerequisites
- A ServiceNow instance with administrator access - you need it to create the OAuth application registry.
- Postman, installed locally or in the cloud. Which one depends on whether your instance is reachable from the internet or only internally.
Step 1: Create an OAuth application registry in ServiceNow
- Log into your ServiceNow instance as an admin.
- Navigate to System OAuth > Application Registry.
- Click New to create a new OAuth application.
- Select Create an OAuth API endpoint for external clients.
Configure the OAuth application
- Name - Give your application a meaningful name, for example Postman OAuth.
- Client ID - A unique identifier for your application. Leave it blank to auto-generate.
- Client Secret - A secret known only to the application and the authorization server. Click the lock icon to generate one.
- Redirect URL - The callback URL the authorization code is sent to. For Postman this is
https://oauth.pstmn.io/v1/callback.
Save the record and note down the Client ID and Client Secret.
Step 2: Assign roles to the OAuth application
- Navigate to System OAuth > Application Registry and open the application you created.
- Scroll down to the Application Roles related list and click New.
- Add the roles your application needs to reach ServiceNow resources -
rest_api_explorer,snc_internal, or whatever the target tables require.
Step 3: Get an OAuth token in Postman
- Open Postman and create a new request.
- Go to the Authorization tab.
- Select OAuth 2.0 as the type.
- Click Get New Access Token.
Token settings
Replace your-instance with your own instance name throughout - the host is your-instance.service-now.com.
- Token Name - A name for the token, for example ServiceNow Token.
- Grant Type - Authorization Code.
- Callback URL -
https://oauth.pstmn.io/v1/callback - Auth URL -
https://your-instance.service-now.com/oauth_auth.do - Access Token URL -
https://your-instance.service-now.com/oauth_token.do - Client ID - The Client ID from your ServiceNow OAuth application.
- Client Secret - The Client Secret from your ServiceNow OAuth application.
- Scope - Leave blank, or specify the scopes your application requires.
- State - A unique identifier that maintains state between the request and the callback.
Click on Request Token. You will be redirected to the ServiceNow login page. Log in with your ServiceNow credentials and authorize the application. Postman will automatically handle the callback and fetch the access token.
Step 4: Use the token in Postman requests
- In the Authorization tab of your request, select OAuth 2.0 as the type.
- Pick the token you obtained in the previous step from the Available Tokens dropdown.
Step 5: Make an API request
Now, you can make API requests to the ServiceNow Table API using the OAuth token.
Example: get records
- Create a new request in Postman and set the type to GET.
- Use this URL format:
https://your-instance.service-now.com/api/now/table/<table_name>?sysparm_query=<encoded_query>
- In the Authorization tab select OAuth 2.0 and confirm your token is selected.
- Send the request.
Summary
That is the whole flow: register the OAuth endpoint, give it roles, exchange credentials for a token in Postman, and send authenticated requests to the Table API. The token refreshes on its own, so once this is set up you can stop thinking about it.
We also keep a Table API collection in Postman that we are happy to share, so you do not have to build one from scratch. If you run into trouble with the setup, tell us where it breaks.
