# Cookie consent

> Visitors' answers to the shop's cookie banner, kept as the marketplace's proof of consent. See [Analytics and cookie consent](/guides/tracking/).

Visitors' answers to the shop's cookie banner, kept as the marketplace's proof of consent. See [Analytics and cookie consent](https://dev.mongrl.com/guides/tracking.md). Generated from the [OpenAPI spec](https://dev.mongrl.com/openapi.json). Each endpoint says which key it needs; see [Authentication](https://dev.mongrl.com/guides/authentication.md).

| Method | Path | What it does |
|---|---|---|
| POST | [`/v1/consents`](#record-a-visitors-cookie-choice) | Record a visitor's cookie choice |

## Record a visitor's cookie choice

`POST /v1/consents` · operation `recordConsent`

Call from the shop's server each time a visitor answers the cookie banner or changes their choice, with the random visitor ID kept in their consent cookie and, when they're signed in, their session. The records are the marketplace's proof of consent.

**Auth:** a secret or publishable key (`Authorization: Bearer sk_…` or `pk_…`)

**Body** (`application/json`): [RecordConsentRequest](#recordconsentrequest)

**Responses:** `204` No Content · `default` [a problem](https://dev.mongrl.com/reference/conventions.md#errors)

## Schemas

Fields marked * are always present in responses and required in requests.

### RecordConsentRequest

| Field | Type | Notes |
|---|---|---|
| `locale` | string | max 35 chars |
| `marketing` * | boolean |  |
| `source` * | string | banner for their first answer, settings when they change it. one of `banner`, `settings` |
| `statistics` * | boolean |  |
| `version` * | integer | The consent version they answered (the marketplace's tracking.consent.version). ≥ 1 |
| `visitor_id` * | string | A random ID the shop keeps in the visitor's consent cookie |
