# Using Cookies

### Formatting cookies for Token API.

You may optionally provide cookies for the Token API to use for solving the challenge.

The [!badge variant="primary" text="cookie"] parameter should be provided as a [!badge variant="warning" text="Array of Dict"].

This guide shows you how to format this value.

---

Parameter                                           | Type                                          | Required                                              | Description { class="compact" }
:---                                                | :---:                                         | :---:                                                 | :---
[!badge variant="primary" text="name"]              | [!badge variant="success" text="String"]      | [!badge variant="success" text="Required"]            | The name of the cookie.
[!badge variant="primary" text="value"]             | [!badge variant="success" text="String"]      | [!badge variant="success" text="Required"]            | The value of the cookie.
[!badge variant="primary" text="domain"]            | [!badge variant="success" text="String"]      | [!badge variant="success" text="Required"]            | The domain of the cookie (e.g. "www.google.com", "example.com").
[!badge variant="primary" text="path"]              | [!badge variant="success" text="String"]      | [!badge variant="success" text="Required"]            | The path of the cookie.
[!badge variant="primary" text="hostOnly"]          | [!badge variant="secondary" text="Boolean"]   | [!badge variant="success" text="Required"]            | True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie).
[!badge variant="primary" text="httpOnly"]          | [!badge variant="secondary" text="Boolean"]   | [!badge variant="success" text="Required"]            | True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts).
[!badge variant="primary" text="secure"]            | [!badge variant="secondary" text="Boolean"]   | [!badge variant="success" text="Required"]            | True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS).
[!badge variant="primary" text="session"]           | [!badge variant="secondary" text="Boolean"]   | [!badge variant="success" text="Required"]            | True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date.
[!badge variant="primary" text="expirationDate"]    | [!badge variant="primary" text="Number"]      | [!badge variant="secondary" text="Optional"]          | The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.

==- Request with Cookies Example
```js POST https://api.nopecha.com/token/
{
    'key': 'MY_NOPECHA_KEY',
    'type': 'hcaptcha',
    'sitekey': 'b4c45857-0e23-48e6-9017-e28fff99ffb2',
    'url': 'https://nopecha.com/demo/hcaptcha#easy',
    'cookie': [
        {
            'name': 'nopechacookie0',
            'value': 'hello world!',
            'domain': 'nopecha.com',
            'path': '/demo/hcaptcha',
            'hostOnly': true,
            'httpOnly': true,
            'secure': true,
            'session': false,
            'expirationDate': 1670023021
        },
        {
            'name': 'foo',
            'value': 'bar',
            'domain': 'www.nopecha.com',
            'path': '/',
            'hostOnly': false,
            'httpOnly': false,
            'secure': false,
            'session': true
        }
    ]
}
```
|||
===
