> 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

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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
