# Create erase

URL: https://docs.hanzo.ai/docs/openapi/graph/grapherase

> Removes every assertion that names an entity and returns a receipt.

`POST /v1/graph/erase`

> [Graph →](https://docs.hanzo.ai/docs/openapi/graph) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/graph/erase`  |
| **Method**    | `POST`                                 |
| **Operation** | `graphErase`                           |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Removes every assertion that names an entity and returns a receipt.

It requires an admin of the organization it acts in; platform sudo is not
enough, so erasure is never cross-tenant. Nothing is removed while a matching
assertion is under litigation hold (409) or where the erasure cannot be
recorded (503). The audit trail keeps who, when, why, how many and the
receipt's digest, never the entity, and holds it before the erasure commits.

Time: erasure is the one act outside the two times. The rows go at every
as\_of and as\_known, so no past read recovers them.

## Request

2 fields, body `application/json` (required).

| Field    | In   | Type   | Required | Description                                                                       |
| -------- | ---- | ------ | -------- | --------------------------------------------------------------------------------- |
| `entity` | body | string | yes      | Entity is the key to erase.                                                       |
| `reason` | body | string | yes      | Reason is why, as the audit trail will keep it — a request number, a legal basis. |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | graph.graphEraseOut | ok      |
| `default` | problem-details     | refused |

`200` body — 13 fields.

| Field              | In   | Type                | Always | Description                                                                                                                                                                                                          |
| ------------------ | ---- | ------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `at`               | body | string              | —      | At is the instant of the erasure, RFC 3339, and the time on its audit record.                                                                                                                                        |
| `by`               | body | string              | —      | By is the identity that erased — `owner` or `owner/user` — from the validated principal.                                                                                                                             |
| `complete`         | body | boolean             | —      | Complete is true only when no store may still hold the subject: every store erased or absent and nothing Remaining.                                                                                                  |
| `digest`           | body | string              | —      | Digest is SHA-256, hex, over IDs in their ascending order, each written `&lt;length&gt;:&lt;id&gt;` — the same content address an assertion's own ID is.                                                             |
| `entity`           | body | string              | —      | Entity is the key that was erased, folded as every key here is (NFC, no control characters) and echoed so a stored receipt says what it is for.                                                                      |
| `ids`              | body | string\[]           | —      | IDs are the content addresses of the assertions removed, ascending.                                                                                                                                                  |
| `remaining`        | body | integer (int64)     | —      | Remaining is how many assertions still name the entity because one call removes at most ten thousand.                                                                                                                |
| `sources`          | body | string\[]           | —      | Sources are the documents the removed assertions were filed from.                                                                                                                                                    |
| `stores`           | body | graph.graphStore\[] | —      | Stores is every store in this deployment that may hold what the org says about the subject, and what happened in each: this graph first, then the stores this op cannot reach.                                       |
| `stores[].detail`  | body | string              | —      | Detail says what an unsupported store is missing before an erasure could reach it.                                                                                                                                   |
| `stores[].removed` | body | integer (int64)     | —      | Removed is how many of its rows were removed.                                                                                                                                                                        |
| `stores[].status`  | body | string              | —      | Status is erased (rows naming the entity were removed), absent (it held none) or unsupported (this op cannot reach it, so it may still hold the subject).                                                            |
| `stores[].store`   | body | string              | —      | Store names it: `graph` is the caller's own (org, project) assertion file, its full-text index included; `knowledge` is the org's wiki pages, memories and sources with their vectors; `ai.memory` is /v1/ai/memory. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo graph erase
```

**SDK**

**.ts**

```ts
import { Configuration, GraphApi } from 'hanzoai';

const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphErase({ entity: "<entity>", reason: "<reason>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GraphApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GraphApi(client).graph_erase(entity="<entity>", reason="<reason>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.GraphAPI.GraphErase(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, graph_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = graph_api::graph_erase(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GraphApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new GraphApi(client).graphErase();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/graph/erase \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "entity": "<entity>",
       "reason": "<reason>"
     }'
```

**MCP**

Tool `graph`, op `graphErase` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "graph",
         "arguments": {
           "op": "graphErase",
           "input": {
             "entity": "<entity>",
             "reason": "<reason>"
           }
         }
       }
     }'
```

---

[Graph API](https://docs.hanzo.ai/docs/openapi/graph) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
