# The API

Source: https://cookiemark.com/docs/api

The API lets your own tools do what you would otherwise do in the dashboard: read choices, answer a visitor who asks what they agreed to, and publish a domain. It comes with every paid domain.

> Want an AI assistant such as Claude or ChatGPT to answer questions about your domains? Connect it through [our MCP server](https://cookiemark.com/docs/mcp), which works with every paid domain.

## Keys

An owner or admin makes keys under **Settings**, **API keys**. A key starts with `cmk_` and belongs to one organisation. We show it once and store only a fingerprint, so copy it straight away. Revoke a key there as well; tools that use it stop working at once.

Send the key with every request:

```
curl https://cookiemark.com/api/v1/sites \
  -H "Authorization: Bearer cmk_..."
```

A key may make 120 requests a minute. Above that you get status 429; wait a minute and carry on.

A key works for 30, 90, 180 or 365 days, or never runs out, as chosen when it is made. Owners and admins get an email a week before a key runs out and once it has. Then make a new key and put it in place of the old one.

## List your domains

`GET /api/v1/sites` returns every domain of the organisation with its ID, address, script key, status and live version.

## Read the consent log

`GET /api/v1/sites/{id}/consents` returns choices, newest first. It takes these parameters:

| Parameter | What it does |
| --- | --- |
| `since`, `until` | Only choices in this period, as ISO dates such as `2026-10-01`. |
| `limit` | How many choices, up to 1,000. The default is 100. |
| `before` | For the next page: the value of `next_before` from the previous answer, as it came. It is empty on the last page. |

Each choice has the consent ID, the action, the three categories, the country, the language, the page, the banner version and the time. Shortened IP addresses and browser details stay in the dashboard.

## Look up a consent ID

`GET /api/v1/consents/{consent_id}` returns every choice made under one consent ID, on any domain of the organisation. Use it when a visitor quotes the ID from their preferences window and asks what they agreed to.

## See the latest scan

`GET /api/v1/sites/{id}/scan` returns the findings, the checks, the cookies and the tracking IDs (such as Tag Manager and Google tag IDs) of the last finished scan.

## Publish a domain

`POST /api/v1/sites/{id}/publish` makes the current draft live, the same as the Publish button. You may send a note, which shows in the domain's list of versions:

```
curl -X POST https://cookiemark.com/api/v1/sites/{id}/publish \
  -H "Authorization: Bearer cmk_..." \
  -H "Content-Type: application/json" \
  -d '{"note": "New cookie list after the October scan"}'
```

The answer holds the new version number.

## Errors

Every error comes as JSON with an `error` field in plain English.

- **400**: a date, cursor or consent ID is not in the right form.
- **401**: the key is missing, wrong, revoked or expired.
- **403**: the organisation does not have the API; it comes with every paid domain.
- **404**: the domain is not in this organisation.
- **409**: the domain cannot be published, because it is archived or all paid domains are live already.
- **429**: more than 120 requests in a minute.
- **500**: something went wrong on our side; try again in a minute.

> The API never changes texts, design or the cookie list. Do that in the dashboard, then publish here if you want to do it from a script.
