# Create graphql

URL: https://docs.hanzo.ai/docs/openapi/graph/post-graph-graphql

> Runs a GraphQL query against this organization's assertions.

`POST /v1/graph/graphql`

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

Runs a GraphQL query against this organization's assertions.

It is the one endpoint here a caller can TRAVERSE: the REST ops each answer a single question, so composing them — the entities this one points at, and what each of those resolves to — costs a request per hop with the intermediate keys held by the caller. Here that is one query and the nesting is the answer's shape.

It adds no way to ask anything new. Every field runs the SAME operation the matching REST route runs, so the tenancy, the as-of bound, the traversal bounds and the conflict rule are the ones already in force; the schema is served by introspection.

A query that cannot run answers 200 with an `errors` list, which is the wire every GraphQL client parses.

## Request

3 fields, body `application/json`.

| Field           | In   | Type   | Required | Description |
| --------------- | ---- | ------ | -------- | ----------- |
| `operationName` | body | string | —        |             |
| `query`         | body | string | —        |             |
| `variables`     | body | any    | —        |             |

## Response

| Status | Body       | Meaning |
| ------ | ---------- | ------- |
| `2XX`  | graphQLOut | Success |

`2XX` body — 4 fields.

| Field              | In   | Type            | Always | Description |
| ------------------ | ---- | --------------- | ------ | ----------- |
| `data`             | body | any             | —      |             |
| `errors`           | body | graphQLError\[] | —      |             |
| `errors[].message` | body | string          | —      |             |
| `errors[].path`    | body | string\[]       | —      |             |

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

## Examples

**CLI**

```bash
hanzo graph graphql
```

**SDK**

**.ts**

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

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

**.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).post_graph_graphql(operation_name="<operationName>", query="<query>")
```

**.go**

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

resp, _, err := client.GraphAPI.PostGraphGraphql(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::post_graph_graphql(&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).postGraphGraphql();
```

**HTTP**

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

**MCP**

MCP declares no tool for **graph** — `tools/list` on `https://api.hanzo.ai/v1/mcp` names the products it does reach. Use HTTP or an SDK.

---

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