Skip to content

Relations & Graph

Relations connect ideas to each other, forming a navigable graph. Each relation has a source, a target, a type, and an optional note.

GET /api/v1/ideas/:id/relations

Returns all relations involving the specified idea, grouped by direction (outgoing and incoming).

Terminal window
curl https://neuralrepo.com/api/v1/ideas/42/relations \
-H "X-API-Key: nrp_YOUR_KEY"

Response 200 OK

{
"outgoing": [
{
"id": 1,
"source_idea_id": 42,
"target_idea_id": 18,
"relation_type": "related",
"note": "Both deal with theming",
"created_at": "2026-03-20T10:00:00Z"
}
],
"incoming": [
{
"id": 2,
"source_idea_id": 7,
"target_idea_id": 42,
"relation_type": "blocks",
"note": null,
"created_at": "2026-03-19T08:00:00Z"
}
]
}

POST /api/v1/map/relations

FieldTypeRequiredDescription
source_idea_idnumberYesID of the source idea
target_idea_idnumberYesID of the target idea
relation_typestringNoType of relation (default: related)
notestringNoDescription, max 500 characters
Terminal window
curl -X POST https://neuralrepo.com/api/v1/map/relations \
-H "X-API-Key: nrp_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_idea_id": 42,
"target_idea_id": 18,
"relation_type": "related",
"note": "Both deal with theming"
}'

Response 201 Created

{
"id": 1,
"source_idea_id": 42,
"target_idea_id": 18,
"relation_type": "related",
"note": "Both deal with theming",
"created_at": "2026-03-24T09:00:00Z"
}

PATCH /api/v1/map/relations/:id

FieldTypeRequiredDescription
relation_typestringNoNew relation type
notestringNoUpdated note, max 500 characters
Terminal window
curl -X PATCH https://neuralrepo.com/api/v1/map/relations/1 \
-H "X-API-Key: nrp_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"relation_type": "blocks"}'

Response 200 OK — Returns the updated relation object.

DELETE /api/v1/map/relations/:id

Terminal window
curl -X DELETE https://neuralrepo.com/api/v1/map/relations/1 \
-H "X-API-Key: nrp_YOUR_KEY"

Response 204 No Content

When creating or updating relations, the API checks for circular dependencies on certain relation types. The behavior depends on the type of relation:

Relations of type blocks and parent are never allowed to form cycles. If adding such a relation would create a cycle, the request is rejected with 409 Conflict:

{
"error": "Relation would create a cycle"
}

There is no way to override this check for these types.

Relations of type supersedes are checked for cycles by default. If a cycle is detected, the request is rejected with 409 Conflict. However, you can bypass this check by adding ?force=true:

Terminal window
curl -X POST "https://neuralrepo.com/api/v1/map/relations?force=true" \
-H "X-API-Key: nrp_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"source_idea_id": 18,
"target_idea_id": 42,
"relation_type": "supersedes"
}'

Relations of type related, inspires, and duplicate do not perform cycle detection. These types are inherently non-directional or non-hierarchical, so cycles are allowed.

FieldTypeDescription
idnumberUnique relation identifier
source_idea_idnumberID of the source idea
target_idea_idnumberID of the target idea
relation_typestringrelated, parent, blocks, inspires, duplicate, supersedes
notestring | nullOptional description
created_atstringISO 8601 timestamp
StatusMeaning
200 OKSuccessful read or update
201 CreatedRelation created
204 No ContentRelation deleted
400 Bad RequestValidation error
401 UnauthorizedMissing or invalid auth
404 Not FoundRelation or idea not found
409 ConflictCycle detected