# Create ingest

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

> Reads a source and records what it states, through the same admission as assert.

`POST /v1/graph/ingest`

> [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/ingest` |
| **Method**    | `POST`                                 |
| **Operation** | `graphIngest`                          |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Reads a source and records what it states, through the same
admission as assert.

Each assertion's evidence is the section that stated it, `<source>#<section>`,
so the same source at the same at records one set of rows however often it is
delivered. What extract reports refused is not recorded; it is counted as
refused, with its reason, in the order the document states it. A source
stating no relation is refused whole.

Time: at is the valid time of every assertion recorded, which an as\_of read is
bounded by; each becomes knowable at the write, so a read with an earlier
as\_known does not see it.

## Request

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

| Field     | In   | Type   | Required | Description                                                                 |
| --------- | ---- | ------ | -------- | --------------------------------------------------------------------------- |
| `at`      | body | string | —        | At is when what the source says was so, RFC 3339.                           |
| `source`  | body | string | yes      | Source names where the text came from — a URL, a document id, a page title. |
| `subject` | body | string | —        | Subject is the entity the text is about before any heading names one.       |
| `text`    | body | string | yes      | Text is the document.                                                       |

## Response

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

`200` body — 4 fields.

| Field       | In   | Type            | Always | Description                                                                                                                                                                                                                                                                        |
| ----------- | ---- | --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `duplicate` | body | integer (int64) | —      | Duplicate is how many members this plane already held.                                                                                                                                                                                                                             |
| `reasons`   | body | string\[]       | —      | Reasons names why each refused member was refused, in the order sent.                                                                                                                                                                                                              |
| `recorded`  | body | integer (int64) | —      | Recorded is how many members became new rows.                                                                                                                                                                                                                                      |
| `refused`   | body | integer (int64) | —      | Refused is how many members were turned away — a missing entity, a timestamp that is not RFC 3339, a confidence outside \[0,1], a relation whose declared domain or range the entity's type does not meet, or a declaration from a caller who is not an admin of the organization. |

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

## Examples

**CLI**

```bash
hanzo graph ingest
```

**SDK**

**.ts**

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

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

**.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_ingest(source="<source>", text="<text>")
```

**.go**

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

resp, _, err := client.GraphAPI.GraphIngest(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_ingest(&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).graphIngest();
```

**HTTP**

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

**MCP**

Tool `graph`, op `graphIngest` — 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": "graphIngest",
           "input": {
             "source": "<source>",
             "text": "<text>"
           }
         }
       }
     }'
```

---

[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)
