# Write a registry entry by hand

> Declare a purpose, a processor and each kind of artefact in privacy.registry.yaml yourself, and fix the validation errors you are most likely to meet.

Declare a purpose, a processor and each kind of artefact in `privacy.registry.yaml` yourself, and fix the validation errors you are most likely to meet.

Use this when no [preset](/docs/manual/guides/add-a-vendor-with-a-preset/) covers the tool, or when the thing you are declaring is your own. The examples come from `examples/static-site/privacy.registry.yaml` (the fictional vendor Acme Video) and from the fixture registry.

## Before you write anything: find out what the tool does

Facts about a vendor come from the vendor's own documentation and from observing it, not from memory.

1. Read the vendor's documentation for the script URL, the cookies it sets with their lifetimes, the storage keys, and the endpoints it sends to.
2. Read its imprint and data processing agreement for the legal entity, the country and the transfer mechanism.
3. Run `consent-kit audit` against a page that loads the tool. Whatever you missed is reported under "Undeclared drift" with an entry to paste.

## 1. Declare the purpose

Start from why, not from the tool. If an existing purpose covers it, use that one and skip this step.

```yaml
purposes:
  - id: media
    version: 1
    basis: consent
    default: denied
    title:
      en: Embedded video
    description:
      en: Loads the video player from Acme Video, which then receives your IP address.
    dataCategories: [ip_address]
    retention: session
    automatedDecisionMaking: false
    dataSubjects: [visitors]
```

Decide, with whoever is responsible for privacy:

| Question | Field |
| --- | --- |
| On which lawful basis? | `basis`. `consent` gives the purpose a toggle and holds its artefacts back. Any other basis runs without asking, so you must be able to defend it. |
| What would a visitor need to read to understand it? | `title`, `description`, in every locale of `locales`. |
| Which kinds of data? | `dataCategories`, as ids. Name them under the top-level `dataCategories`. |
| For how long? | `retention`: `session`, `until-withdrawn`, `<n>d` or `<n>d-after-<event>`. |
| Whose data? | `dataSubjects`, at least one id. |
| Does an automated decision follow from it? | `automatedDecisionMaking: false`, or `{ logic, consequences }`. |
| Legitimate interest? | Then `legitimateInterest` is required: say which interest. |
| Does anyone receive the data whom no artefact shows? | `processors`. Write `[]` to state that nobody does. |

A new purpose starts at `version: 1`.

## 2. Declare the processor

One entry per recipient.

```yaml
processors:
  - id: acme-video
    name: Acme Video
    legalEntity: Acme Video GmbH
    country: DE
```

For a recipient outside the EU/EEA, add the transfer mechanism. The fixture's Cloudflare entry:

```yaml
  - id: cloudflare
    name: Cloudflare
    legalEntity: Cloudflare, Inc.
    country: US
    transferMechanism: dpf
    dpaUrl: https://www.cloudflare.com/cloudflare-customer-dpa/
    privacyUrl: https://www.cloudflare.com/privacypolicy/
```

Set `role` if the recipient is not a processor acting on your instructions: `independent_controller` or `joint_controller`. Add `dpaUrl` and `privacyUrl` when you have them; the documents link to them.

## 3. Declare the artefacts

One entry for each thing the tool sets, loads or sends to. Every artefact needs an `id`, a `kind`, at least one purpose and, if it is third-party, the `processor`.

### A script

```yaml
artefacts:
  - id: plausible_script
    kind: script
    src: https://plausible.io/js/script.js
    processor: plausible
    purposes: [analytics]
```

Write the full URL of the file. Then put it on the page with `consent-kit script-tag plausible_script`, never as a plain `<script src>`. A script can be bound to one consent purpose at most.

Your own scripts are not declared.

### A cookie

```yaml
  - id: cc_cookie
    kind: cookie
    name: cc_cookie
    duration: 182d
    sameSite: Lax
    purposes: [essential]
    description:
      en: Stores your privacy choices.
```

Use `name` for an exact name, or `pattern` for a family: `pattern: "^_ga_"`. Exactly one of the two. `duration` is `session` or a number of days. Add `domain`, `secure` and `httpOnly` when they apply.

Declare `cc_cookie`, as both example registries do. It is the cookie CookieConsent stores the choice in. The guard allows it without a declaration, but the generated documents list only what the registry declares.

### A storage key

```yaml
  - id: theme
    kind: storage
    area: local
    key: theme
    duration: persistent
    purposes: [essential]
    description:
      en: Remembers whether you chose the light or the dark theme.
```

`area` is `local`, `session` or `indexeddb` (then `key` is the database name). `duration` is optional and is a declaration for the cookie tables: `persistent` or a number of days. Your own code has to honour it.

### An iframe

```yaml
  - id: acme_video_embed
    kind: iframe
    src: http://127.0.0.1:4174/embed
    processor: acme-video
    purposes: [media]
```

`src` is an origin or a URL prefix. A prefix covers whole path segments: `/embed` covers `/embed` and `/embed/42`, not `/embedded`. Render it with `consentEmbed`; see [embed an iframe behind consent](/docs/manual/guides/embed-an-iframe/).

### An endpoint or a pixel

```yaml
  - id: plausible_events
    kind: endpoint
    url: https://plausible.io/api/event
    processor: plausible
    purposes: [analytics]
```

An `endpoint` is where code sends data with `fetch`, `XMLHttpRequest` or `sendBeacon`. A `pixel` is an image request that carries data, declared the same way with `kind: pixel`. Without the declaration, the policy refuses the connection.

Nothing generated holds a request back until consent. If the code that sends is your own, check consent before it sends.

### A stylesheet, font or media file from a third party

```yaml
  - id: brand_font
    kind: font
    src: https://fonts.example/brand/   # an origin, a URL prefix or one file
    processor: example-fonts
    purposes: [essential]               # must not be a consent purpose
```

These three kinds cannot be bound to a consent purpose, because nothing can hold them back. Bind them to a purpose with another lawful basis that you can defend, or host the file yourself, which needs no declaration at all.

## 4. Check

```sh
npx consent-kit check
```

A validation error names the file position, the rule and the fix:

```
privacy.registry.yaml:95:5  artefact/third-party-without-processor  Artefact "acme_video_embed" loads from or sends to http://127.0.0.1:4174/embed, a third party, but has no processor. Declare the vendor under processors and set processor to its id.
```

The errors you are most likely to meet:

| Rule | What happened | Fix |
| --- | --- | --- |
| `artefact/third-party-without-processor` | An artefact with an absolute URL has no `processor`. | Declare the vendor and reference it. |
| `artefact/unknown-purpose`, `artefact/unknown-processor` | A misspelt or missing id. The message lists the declared ones. | Fix the id or add the entry. |
| `processor/unreferenced` | A processor that nothing uses. Often the other half of a misspelt id. | Reference it or remove it. |
| `processor/missing-transfer-mechanism` | A processor outside the EU/EEA without `transferMechanism`. | Add `adequacy`, `scc`, `dpf` or `bcr`. |
| `purpose/vague-text` | A consent purpose described by a stock phrase such as "Marketing purposes." | Say what is done, with which data, and why. |
| `locale/missing-text` | A text lacks one of your `locales`. | Add the translation. |
| `artefact/consent-not-enforceable` | A stylesheet, font or media file bound to a consent purpose. | See above. |
| `script/multiple-consent-purposes` | A script bound to two consent purposes. | Bind it to one. |
| `purpose/unknown-data-category` | A data category id that the `dataCategories` map does not have. | Add it to the map. |

Every rule is in [validation rules](/docs/manual/reference/validation-rules/).

## 5. If the registry was already released

Adding a purpose, a processor or an artefact is a material change. `check` then asks for a version bump on every purpose the new entries affect:

```
error  version/missing_bump  Purpose "analytics" changed materially but is still at version 1; bump it to 2.
```

Raise `version` by one on each purpose it names. A new purpose itself starts at 1 and needs no bump. Then follow [release a policy change](/docs/manual/guides/release-a-policy-change/).

## 6. Build, wire, audit

```sh
npx consent-kit build
```

The policy now admits the new origins. Put the script tag or the embed placeholder on the page, deploy to a preview, and run the audit. It tells you what the tool does that you did not declare, and what you declared that it never did.

## Related

- [The registry model](/docs/manual/concepts/registry-model/)
- [Registry reference](/docs/manual/reference/registry/)
