To clear cookies in Postman, open the Cookies manager by clicking the Cookies link located just below the Send button in the request builder. From there, find the domain you want to clear and click the X or Delete icon next to the specific cookie or the entire domain.
Many users mistakenly try to clear their browser cache or browser cookies to fix Postman issues, but Postman maintains its own independent cookie jar. Clearing your Chrome or Firefox history will not remove the cookies stored within the Postman application.
Using the Cookies Manager
The Cookies manager is the primary tool for managing session data. Because Postman acts as its own HTTP client, it stores cookies returned by servers in a dedicated internal database. This allows you to maintain a session across multiple different requests without manually copying tokens into headers.
- Open the request tab where you are experiencing the issue.
- Look at the area directly below the Send button.
- Click the link labeled Cookies.
- A window opens listing all domains that have stored cookies in your current workspace.
- Scroll through the list to find the domain matching your API endpoint.
- Hover over the cookie name to see a delete icon.
- Click the delete icon to remove a single cookie, or remove the domain entirely to clear all associated session data.
Labels may differ slightly depending on the version of the software you are using. Removing a cookie here ensures that the next time you click Send, Postman will not include that specific cookie in the request header. This is essential when you need to test how your API handles a first-time visitor or an unauthenticated user.
Managing Cookies via the Console
When the visual manager does not seem to be working, the Postman Console provides a way to verify exactly what is being sent. Sometimes a cookie is cleared from the manager but persists due to a cached session or a script that regenerates it immediately. The Console allows you to see the raw network traffic.
To open the console, click the Console icon at the very bottom left of the window. When you send a request, expand the network log to view the Request Headers. Look for the Cookie header. If you see data there after you have cleared the Cookies manager, it means the cookie is being injected from another source, such as a Pre-request Script or an Environment Variable.
If you find that cookies are reappearing, check your Pre-request Scripts tab. Some developers write scripts that manually set cookies using the pm.cookies.jar() API. If a script is adding a cookie every time the request runs, deleting it from the manager will only provide a temporary fix. You must remove or comment out the script logic to stop the cookie from returning.
Handling Interceptor Cookies
Postman Interceptor is a browser extension that syncs cookies from your web browser directly into the Postman app. This is a common source of confusion because you might clear the cookies in the Postman app, only for the Interceptor to immediately sync them back from your open browser tab.
If you have Interceptor enabled, follow these steps to ensure a clean state:
- Click the Capture Requests icon in the top right or bottom status bar.
- Switch to the Cookies tab within the capture window.
- Toggle the Interceptor switch to Off.
- Go back to the Cookies manager and delete the cookies again.
- Clear the cookies in your actual web browser for that specific domain.
Rule of thumb: If cookies keep returning after deletion, check if the Interceptor is active. Interceptor creates a live bridge between your browser session and your API tests. This is useful for capturing complex authentication cookies that are hard to generate manually, but it makes manual cookie clearing ineffective until the sync is paused.
Automating Cookie Removal
For those who run large collections of tests, manually clicking the Cookies manager for every single test run is inefficient. You can use the Postman API or scripts to manage the cookie jar programmatically. This ensures that every test starts from a known, clean state, which is a requirement for reliable automated testing.
You can use the pm.cookies.jar().clear()` method within a Pre-request Script to wipe the cookies for a specific domain before the request is even sent. This is particularly helpful for testing login flows. For example, if you are testing a "Remember Me" feature, you need to ensure no previous session cookies exist before the login request is triggered.
Consider a scenario where you are testing an API that uses a session cookie for authentication. If you want to test the expiration of that session, you can write a script that checks for the existence of the cookie and deletes it if it is too old. This prevents you from having to manually open the manager every time you change a test parameter.
Dealing with HttpOnly Cookies
Some cookies are marked as HttpOnly, meaning they cannot be accessed or modified by client-side scripts. While Postman's internal manager can usually see and delete these, some automated scripts might struggle to interact with them. If a cookie refuses to be deleted via a script, use the manual Cookies manager. The manual manager has higher privileges than the scripting environment and can force the removal of HttpOnly cookies.
Verifying the Result
After clearing cookies, always verify the result by sending the request again and checking the response. If the server returns a 401 Unauthorized or a 302 Redirect to a login page, you have successfully cleared the session. If the request still succeeds, check for a Bearer Token in the Authorization tab. Many modern APIs use both cookies and Authorization headers. Clearing the cookies will not remove a token stored in the Authorization tab or an environment variable. You must clear both to truly reset the identity of the request.
Cookie Domain Specifics
Postman organizes cookies by domain. It is important to understand the difference between clearing a specific cookie and clearing a domain. A domain may have multiple cookies, such as a session ID, a user preference cookie, and a tracking ID. If you only delete the session ID, the server may still recognize you through other identifiers.
When you enter the Cookies manager, you will see a list of domains like api.example.com or localhost. Clicking the X next to the domain name removes every single cookie associated with that host. This is the fastest way to ensure a complete reset. If you are working with subdomains, be aware that cookies set on .example.com (with a leading dot) may be shared across all subdomains. Clearing the cookie on app.example.com might not remove the cookie set at the root domain level.
To handle this, always look for the root domain in the list. If you see both api.example.com and example.com, clear both to be certain that no persistent session data remains. This prevents "ghost sessions" where the API continues to authenticate you despite your efforts to log out.
Related
General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more
Spotted an error? Tell us and we will correct it (corrections policy).