---
title: "Execute a Cypher query"
method: POST
path: "/api/query"
---

# Execute a Cypher query

`POST /api/query`

Execute an OpenCypher query against the graph database.
Supports both read (MATCH) and write (CREATE, SET, DELETE, MERGE) queries.

## Request body

- QueryRequest
  - `query` string, required — An OpenCypher query string
  - `graph` string — Target graph/tenant name (default: 'default')

## Response `200`

Query executed successfully

- QueryResponse
  - `nodes` GraphNode[] — Graph nodes referenced in the result (for visualization)
    - `id` string — Node ID
    - `labels` string[] — Node labels
    - `properties` object — Node properties
  - `edges` GraphEdge[] — Graph edges referenced in the result (for visualization)
    - `id` string — Edge ID
    - `source` string — Source node ID
    - `target` string — Target node ID
    - `type` string — Relationship type
    - `properties` object — Edge properties
  - `columns` string[] — Column names for the tabular result
  - `records` array[] — Tabular result rows, one array per record
    - unknown[]
      - unknown

## Other responses

- `400` — Query error (parse error, execution error)

---

[API](https://skmtc.net/samyama-ai/apis/samyama-graph-database-api.md) · [All operations](https://skmtc.net/samyama-ai/apis/samyama-graph-database-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/samyama-ai/samyama-graph-database-api/versions/047a40292bc8/schema)
