Back to HTTP Headers
Response

HTTP Set-Cookie Header

Sends cookies from the server to the client. The client stores them and sends them back with subsequent requests via the Cookie header.

Purpose

Enables session management, personalization, and tracking by setting cookies that the browser will include in future requests.

Set-Cookie: <name>=<value> Set-Cookie: <name>=<value>; Expires=<date>; Path=/; Domain=.example.com; Secure; HttpOnly; SameSite=Lax

Code Examples

See how to use the Set-Cookie header in different tools and languages.

curl -I -X POST https://api.example.com/login -d 'user=test&pass=123'
# Set-Cookie: sessionId=abc123; Path=/; HttpOnly; SameSite=Lax
# Subsequent requests with cookie:
curl --cookie "sessionId=abc123" https://api.example.com/profile

Related Headers

Test Your APIs

set-cookie headerhttp set-cookiehttp headers guide