# Search document summaries with a raw Cypher query

Operation ID: `graph.searchDocumentSummariesCypher`

Run a raw Cypher query against the Document Summaries graph. When rag=true in the request body, runs retrieval-augmented generation over the query results instead of returning them directly.

## Public method

`searchDocumentSummariesCypher`

Signature: `graph.searchDocumentSummariesCypher(request)`

Return type: `Promise<CypherQueryResponse | GraphRagResponse<CypherRagCitation>>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /graph/document-summaries/cypher`

## Path parameters

None.

## Query parameters

None.

## Body parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `body` | [`SearchDocumentSummariesCypherRequest`](../models/SearchDocumentSummariesCypherRequest.md) | Yes |  |  |  | No |  |

Request model: [`SearchDocumentSummariesCypherRequest`](../models/SearchDocumentSummariesCypherRequest.md)

## Request example

```json
{
  "limit": 1,
  "params": {},
  "query": "MATCH (n:DocumentSummary) RETURN count(n) AS count",
  "rag": false
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`SearchDocumentSummariesCypherResponse`](../models/SearchDocumentSummariesCypherResponse.md) | application/json | Document Cypher results or grounded RAG answer |

## Success response examples

### 200

```json
{
  "execution_time_ms": 12.5,
  "results": [],
  "total": 0
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | The Cypher query was invalid |
| `401` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`graph.ErrorResponse`](../models/graph.ErrorResponse.md) | application/json | Internal server error |

## Error examples

### 400 — The Cypher query failed to parse or execute (sanitized example)

```json
{
  "error": "Invalid query"
}
```

### 401 — Missing or invalid access token

```json
{
  "error": "Authorization required"
}
```

### 500 — Unexpected service failure (sanitized example)

```json
{
  "error": "Internal server error"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
import type { CypherQueryRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "limit": 1,
  "params": {},
  "query": "MATCH (n:DocumentSummary) RETURN count(n) AS count",
  "rag": false
};

const result = await graph.searchDocumentSummariesCypher(request);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"limit":1,"params":{},"query":"MATCH (n:DocumentSummary) RETURN count(n) AS count","rag":false}' \
  'https://dev-api-graph.health.cloud/graph/document-summaries/cypher'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
