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

## Changes

- **2026-03-13** `af3b694476b3` — 1 info
  - added the new optional request property `graph`
- **2026-02-21** `5b9d1ed71ed1` — 1 warning
  - removed the request property `graph`

[Change history](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api/changes/api/query/post.md)

---

[API](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api.md) · [All operations](https://skmtc.dev/samyama-ai/apis/samyama-graph-database-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/samyama-ai/samyama-graph-database-api/revisions/7f3d37bbc2cd/schema)
