Back to docs

Tool Manage Cookies

Category: Browser State Β· Tier: Free

Read, set, or clear browser cookies for the current page. set writes a session cookie unless you give expires, the same as the CLI's cookie set. delete with a domain removes the cookie on that domain only.

Parameters

Parameter Type Required Description
action string Yes get (read all), set (add/update), clear (delete all), delete (remove specific)
name string For set/delete Cookie name
value string For set Cookie value
domain string No set: the cookie's domain (default: the current page's host). delete: only the cookie on this domain is removed, and a leading dot is ignored; without it the name is removed on every domain
path string No Cookie path for set (default: /)
expires number No For set: expiry as Unix time in seconds. Omitted or -1 writes a session cookie
_browserToken string No Browser session token

Examples

Read all cookies on this page
β†’ manage_cookies action="get"

Set a language preference cookie
β†’ manage_cookies action="set"
    name="lang" value="de"

Keep it until 1 January 2027 (UTC)
β†’ manage_cookies action="set"
    name="lang" value="de"
    expires=1798761600

Remove "lang" on one domain only
β†’ manage_cookies action="delete"
    name="lang" domain="example.com"

Clear all cookies
β†’ manage_cookies action="clear"

Responses

  • set returns the cookie it wrote, with expires (-1 for a session cookie).
  • delete returns deleted and domain: the domain you named, or "all" when you named none.

Before 20.0, set wrote a cookie that expired after 24 hours, and delete ignored domain and removed the name everywhere.

From the Blog