Postman's default user agent string can sometimes be identified as bot-like, potentially leading to blocks if not overridden.
In this tutorial, you'll learn to set a custom user agent in Postman and avoid getting blocked. We'll also take this from the request to the collection level, including user agent rotation. Let's get started!
Understanding the User Agent in Postman
Every browser (client) presents an HTTP header to the server during each request. This header serves as a scannable entry point containing information about the client, including the UA string.Â
A user agent string tells the server where a request comes from and usually conveys request source information, including the **browser version, operating system, and render engine version. This is how a server tells a bot apart from a legitimate browser.
For an in-depth look at HTTP headers in web scraping, including user agents, see ZenRows's guide on common HTTP headers for web scraping.
The built-in Postman runtime UA usually looks like this:PostmanRuntime/7.35.0
. When used to make frequent requests, such as those from scrapers, a server can flag it as a bot.Â
Fortunately, you can customize the default Postman user agent to scrape a website without getting blocked.
Setting a Custom User Agent in Postman
So, how can you change the default Postman user agent and set a custom one? You'll learn the step-by-step process in this section.Â
We'll use the Postman desktop app in this article. So download and install a compatible version from the Postman download page if you've not already done so.
Step 1: Prepare Your Workspace
Since we'll approach the process from the request level to the collection level, you want to start by creating a collection in Postman.Â
A Postman collection is a group of requests you can run individually or simultaneously. For instance, you can execute posts and get requests together as a collection.Â
Even if you're only sending one request at the moment, prefer to put it in a collection so you can add more requests as you scale.
To begin, open the Postman desktop app and click the Workspaces dropdown at the top-left. Then, select Create Workspace.

You'll see a few template options in the left sidebar. Ignore those since you don't need them for now. Click “Next” to customize your workspace.Â
Type a descriptive name (ZenRows Postman UA Test
in this case) in the “Name” field in the left sidebar. The “Summary” field is optional, but you can still include a description depending on your choice.Â
Select an appropriate accessibility option under “Who can access your workspace?”
Click “Create” once satisfied.

After creating the workspace, you can immediately start making requests. But don't jump right on that yet.Â
Postman will prompt you to create a collection. Click “Create Collection” in the left sidebar.
Alternatively, you can go to the cross (+) icon at the top-left and select “Blank collection” to create a Postman collection. Either method works.

Name your Postman collection by placing your cursor on the collection name field (Testing Custom UA
in this case). Then, type a description in the optional summary box below this field.Â

You're all set and ready to start creating requests in your collection! But you need to customize the UA in the request header first.Â
So, where's the request header user agent in Postman?Â
Let's dig further in the following section!
Step 2: Access the Request Header Settings
You need to access the request header settings before setting a Postman user agent. To achieve this at the request level, you must create a request.Â
Right-click the collection name and select “Add request”.

To rename the new request, right-click it and select “Rename”.Â

Then, type a descriptive name in the field provided (UA-Get-Test
in this case).

Click the request to select it. Look to the top of the “GET” field, and you'll see the request name appended to your collection name with a trailing forward slash (Testing Custom UA/UA-Get-Test
).Â
You can also change the request type by clicking the “GET” dropdown and selecting the appropriate request from the options. But we'll stick to the GET request in this tutorial.
Go to “Headers” below the query box to access the request header settings. Once in the “Headers” section, you'll see a Key/Value pair table where you can input strings, including a user agent, for your request header.
Step 3: Set Up a Custom User Agent for a Single Request
Setting a UA at the request level is handy when you want individual requests to use separate user agents.
After you've accessed the “Headers” settings, type “User-Agent” in an empty “Key” box inside the table. Click the “User-Agent” option when it pops.Â
The second request (Second-UA-Get-Test
) here is only another request in the collection and doesn't impact the result in this article. We've demonstrated our request using UA-Get-Test
.

User agents vary, depending on the use case. But prefer to choose from the best user agents for web scraping. Feel free to analyze what your chosen user agent means from UserAgentString.Â
We'll use the following user agent in this case.Â
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Next, paste the user agent string in the “Value” box.

You've now changed the Postman default user agent to a custom one.Â
How can you verify this?Â
Step 4: Verify and Test the Custom User Agent
The first step to verifying that the added user agent works is to check the default UA.Â
To do this, untick the “User-Agent” checkbox in the “Headers” section. This removes the custom user agent and defaults to Postman's UA.
Go to the “GET” box and type your target URL. Ensure you append “user-agent” to the URL using a forward slash like this: targetURL/user-agent
(https://httpbin.io/user-agent
in this case)
Click “Send” at the right, and you should see the default Postman runtime user agent in the response body:

Now that you've confirmed the default user agent, it's time to verify if your custom user agent overrides it. Check the “User-Agent” checkbox in the “Headers” section to activate your custom UA. Then, click “Send” again to confirm.
The request should return your custom Postman user agent as shown:

It's that easy! You've successfully added a custom user agent to a single request in Postman. What if you want to apply this to a collection such that all the requests in that collection share the same user agent?
Step 5: Apply a Custom User Agent to a Collection
When you add a custom user agent to a collection, all the requests in that group will share it, making your user agent configuration more consistent.
It means you can run the entire collection at once or execute individual requests without worrying about adding a custom Postman UA at the request level.
To apply a custom user agent to a collection, click the collection in the left sidebar.Â
Then, go to “Pre-request Script” at the top of the Postman scripting section. Type the following Postman script in the empty code field and press “CTRL + S” (“Command + S” for Mac) to save the changes:
pm.request.headers.add({
key: 'User-Agent',
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
});
The script placement should look like this in Postman:

That's not all. You want to verify if the collection uses your custom Postman user agent. Uncheck the “User-Agent” box in the request Headers or delete this field from each request under your collection and run them individually using the same URL format.Â
Each should return the custom user agent added to that collection without explicitly adding it at the request level.
Your custom user agent script works if each request returns the sample response below.

All requests now share a similar user agent. Pat yourself on the back for this achievement. But it's still only a matter of time before the server detects and flags the frequent requests from this user agent.Â
How can you prevent this? Rotate your user agents! Â
How to Rotate User Agents in Postman
Rotating your user agents is a potent way to avoid getting blocked. This way, you can split the traffic between different clients at intervals. The logic is to get a list of user agents, catch their index, and feed them to the previous script for rotation.
Modify the previous Postman script (click your collection and go to “Pre-Request Script”):
const userAgents = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
// Add more user agents as needed
];
// Initialize a global scope counter to keep track of the current user agent
if (!pm.globals.has('userAgentCounter')) {
pm.globals.set('userAgentCounter', 0);
}
// Get the current user agent index from global variables
let currentIndex = pm.globals.get('userAgentCounter');
// Set the "User-Agent" header for the current request
pm.request.headers.add({
key: 'User-Agent',
value: userAgents[currentIndex % userAgents.length],
});
// Update the index for the next request
pm.globals.set('userAgentCounter', (currentIndex + 1) % userAgents.length);
Test the user agent rotation script by running each request in your collection without specifying individual user agents. The UA string will now rotate per request.Â
For a diverse range of user agents, we've utilized selections from this list of the best user agents for web scraping.
You're now ready to scrape or test on the go without getting blocked due to a faulty or bot-like user agent. Congratulations!
Troubleshooting Common Issues
Setting a Postman user agent comes with its challenges. Let's see how you can troubleshoot these common issues.Â
Invalid New Line Character
An invalid new line character or an unsupported character error are the most common issues you might encounter while setting a Postman user agent at the request level. Advanced WAFs like DataDome and PerimeterX use these validation errors to detect bot traffic. Check out our guides on bypassing DataDome and bypassing PerimeterX for more insights.Â
This is usually due to extra spaces, line breaks, or characters you've picked while copying and pasting the user agent in the “Value” box. If this happens, clear the “User-Agent” value and type it manually instead.
Syntax Errors
Syntax errors in the user agent script at the collection level can also frustrate your effort. Ensure you thoroughly debug the user agent script by checking for missing or unwanted quotes, commas, slashes, and parentheses. Generally, ensure your user agent string doesn't have any formatting issues.Â
Access Restrictions
Permission restrictions can happen if you share a collection with a team and don't yet have the required access to modify it. Ensure you have modification permission before adding a user agent in Postman. You might want to reach out to your teammates to grant you access.
How To Rotate Infinite User Agents at Scale
Managing a User Agent rotation system is more complex than it seems. You need to regularly update your list with new browser versions, make sure they match operating systems correctly and remove outdated combinations.
More importantly, websites look for more than just User Agents when checking for bots. They analyze your request patterns, network behavior, and many other details. Even with perfect User Agent rotation in Postman, your requests might still get flagged.
A better approach is using ZenRows' Universal Scraper API, It provides auto-rotating up-to-date User Agents, premium proxy, JavaScript rendering, CAPTCHA auto-bypass, and everything you need to avoid getting blocked.
Let's see how ZenRows performs against a protected page like the Antibot Challenge page.
First, sign up for a ZenRows account to get to the Request Builder.

Paste the target URL, enable JS Rendering, and activate Premium Proxies.
Next, select cURL and click on the API connection mode. Then, copy the generated code and paste it into your script.
curl
"https://api.zenrows.com/v1/?apikey=<YOUR_ZENROWS_API_KEY>&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true"
When you run this code, you'll successfully access the page:
<html lang="en">
<head>
<!-- ... -->
<title>Antibot Challenge - ScrapingCourse.com</title>
<!-- ... -->
</head>
<body>
<!-- ... -->
<h2>
You bypassed the Antibot challenge! :D
</h2>
<!-- other content omitted for brevity -->
</body>
</html>
Congratulations! 🎉 You've accessed a protected page without any complex Postman configuration.
Conclusion
This guide has shown you the important aspects of User Agents in Postman:
- How User Agents work in HTTP requests.
- Ways to set custom User Agents at request and collection levels.
- How to rotate between different User Agents.
- Why User Agent management alone isn't enough.
Remember that websites use many techniques to detect bots. Integrate ZenRows to make sure you extract all the data you need without getting blocked. Try ZenRows for free!