# Direct neighbours of notes: what they link to (`out`) and what links to them (`in`,

`POST /datanotes/operations/graph_neighbors/` (operation `graph_neighbors`)

Direct neighbours of notes: what they link to (`out`) and what links to them (`in`,
backlinks), with counts per edge label. `direction`: out, in or both (default).

`from_nodes` selects the notes: `{"paths": [...]}` and/or `{"table": ..., "where": {...}}`.
Edges are labelled with their link column (`people`, `event`, …) or `link` for other links.

## Request body

`application/json`, required

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `from_nodes` | `object` | yes |  |  |
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` |  |
| `edges` | `string[] \| null` | no | `null` |  |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Done. | `object` (application/json) |
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
| 500 | Unexpected error. | `Error` (application/json) |

The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
