---
title: "Cookie"
sidebar_label: "Cookie"
description: "Kotlin binding reference: Cookie."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Cookie](index.md)

# Cookie

[common]\
data class [Cookie](index.md)(val name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), val value: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), val path: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;/&quot;, val domain: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;, val maxAge: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = -1, val httpOnly: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = true, val secure: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false, val sameSite: [SameSite](../SameSite/index.md) = SameSite.LAX)

A cookie to set on a response: [maxAge](maxAge.md) below 0 means a session cookie, an empty [domain](domain.md) omits the attribute, [httpOnly](httpOnly.md) hides it from script, [secure](secure.md) limits it to HTTPS.

## Constructors

| | |
|---|---|
| [Cookie](Cookie.md) | [common]<br>constructor(name: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), value: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), path: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;/&quot;, domain: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) = &quot;&quot;, maxAge: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = -1, httpOnly: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = true, secure: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false, sameSite: [SameSite](../SameSite/index.md) = SameSite.LAX) |

## Properties

| Name | Summary |
|---|---|
| [domain](domain.md) | [common]<br>val [domain](domain.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |
| [httpOnly](httpOnly.md) | [common]<br>val [httpOnly](httpOnly.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = true |
| [maxAge](maxAge.md) | [common]<br>val [maxAge](maxAge.md): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) |
| [name](name.md) | [common]<br>val [name](name.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |
| [path](path.md) | [common]<br>val [path](path.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |
| [sameSite](sameSite.md) | [common]<br>val [sameSite](sameSite.md): [SameSite](../SameSite/index.md) |
| [secure](secure.md) | [common]<br>val [secure](secure.md): [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false |
| [value](value.md) | [common]<br>val [value](value.md): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) |