GlossaryWeb ScrapingBeginner

Session Cookie

A session cookie is a temporary cookie a website uses to remember you during a single visit, such as keeping you logged in. It is deleted when you close the browser or the session ends.

Last updated June 8, 2026

Definition

A session cookie is a small, temporary piece of data a website stores in your browser to track a single active session - for example, keeping you logged in or remembering items in your cart. Unlike persistent cookies, it has no long expiry date and is typically erased when you close the browser or after a period of inactivity.

How it works

After you log in, the server sends a Set-Cookie header containing a unique session ID. Your browser returns this ID with every request via the Cookie header, letting the server recognize you as the same authenticated user without asking for credentials again.

Why it matters for scraping

  • Authenticated access - a scraper must capture and reuse the session cookie to access logged-in pages.
  • Sticky sessions - the session ID should be paired with the same proxy IP to stay valid and avoid suspicion.
  • Expiry handling - scrapers must detect expired sessions and re-authenticate gracefully.

Understanding session cookies is fundamental for any automation that interacts with accounts, carts, or other state that must persist throughout a browsing session.

Examples

1

A login session ID cookie that keeps a user authenticated until they close the browser

2

An e-commerce cart that remembers items via a temporary session cookie

3

A scraper reusing a captured session cookie to fetch account-only pages

Common Use Cases

Accessing login-protected pages by reusing a captured session cookie
Pairing a session cookie with a sticky proxy IP to keep it valid
Detecting expired sessions and re-authenticating automatically
Maintaining cart or checkout state during automated browsing

Frequently Asked Questions

It is a temporary cookie that identifies you during a single browsing session, such as keeping you logged in, and is usually deleted when you close the browser.
A session cookie expires when the session ends or the browser closes, while a persistent cookie has a set expiry date and survives across multiple visits.
To access logged-in content, a scraper must capture and reuse the session cookie, ideally paired with a sticky proxy IP so the session stays valid and unsuspicious.