> For the complete documentation index, see [llms.txt](https://docs.millimetric.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.millimetric.ai/api-reference/forget.md).

# POST /v1/forget

POST /v1/forget — GDPR delete for a user.

Permanently delete every event for `(project_id, user_id)`. Intended for GDPR / CCPA Right-to-be-Forgotten requests.

## Auth

|                |                                                                                                   |
| -------------- | ------------------------------------------------------------------------------------------------- |
| Required scope | `ingest` or `admin`                                                                               |
| Key kinds      | **`sk_*` only** — `pk_*` is explicitly rejected to prevent a leaked browser key from wiping data. |

## Request

```http
POST /v1/forget
Authorization: Bearer sk_live_…
Content-Type: application/json
```

```json
{ "user_id": "user_42" }
```

| Field     | Required | Notes                                                            |
| --------- | -------- | ---------------------------------------------------------------- |
| `user_id` | **yes**  | The stable user id you've been tagging events with. 1–256 chars. |

## Response

```json
{ "ok": true, "queued": true }
```

The mutation is queued on ClickHouse (`ALTER TABLE … DELETE`) and typically completes within seconds, occasionally minutes for very large tables.

## What gets deleted

* Every row in `events` where `project_id = <your project>` and `user_id = <user>`.
* Aggregated rows in `daily_rollup` and `sessions` **are not** rewritten — they're aggregates, not personal data. If you need to also strip rollup contributions, run a full re-aggregation from the surviving raw events.

## What does NOT get deleted

* Anonymous events for the same person *before* you called `/v1/identify`. They have no `user_id` and are indistinguishable from any other anonymous traffic.
* Events under other projects (the deletion is scoped to the project owning the key).

If you need to forget by `anonymous_id` instead of `user_id`, run the equivalent SQL directly against ClickHouse:

```sql
ALTER TABLE events DELETE
  WHERE project_id = '{project_id}'
    AND anonymous_id = '{anonymous_id}';
```

## Audit

Issue a `/v1/forget` call from a logged-only context (a script, a request handler with audit logs) — the Worker itself doesn't yet write a structured audit row. That's on the roadmap.

## Errors

* `403 forget_requires_secret_key` — you used a `pk_*` key.
* `500 forget_failed` — ClickHouse rejected the mutation. Check Worker logs.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.millimetric.ai/api-reference/forget.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
