Node Navigation
This guide covers retrieving individual nodes, listing child nodes, understanding node relationships, and navigating document hierarchies. For document management basics, see Document Management.
Retrieving Nodes
Node retrieval enables you to access individual content elements by identifier. Each node carries complete information including content, positions, metadata, embeddings, and relationships. This information enables you to understand node context, navigate document structures, and access specific content elements.
To retrieve a node, provide the node identifier and root node identifier. The root node identifier groups nodes by document, enabling efficient queries that understand document boundaries. The response includes complete node information, enabling you to access content, understand relationships, and navigate hierarchies.
Node retrieval returns nodes regardless of processing state, so you can access nodes even while processing is in progress. This enables progressive access to content as it becomes available, supporting the bonsai philosophy of selective, attentive processing.
- Request
- Response
GET /v1/nodes/node-123?root_node_id=corpus-456
Authorization: Bearer <your-token>
{
"node_id": "node-123",
"root_node_id": "corpus-456",
"node_type": "TEXT",
"content": "The methodology section describes...",
"parent_node_id": "node-100",
"next_node_id": "node-124",
"positions": [
{
"type": "bbox",
"path": [1, 2, 3],
"geometry": {
"x0": 100,
"y0": 200,
"x1": 300,
"y1": 400,
"page_number": 5
}
}
],
"metadata": {
"confidence": 0.95,
"section": "methodology"
}
}
See the API Reference for complete endpoint documentation.
Listing Child Nodes
Child node listing enables you to explore document hierarchies by retrieving nodes that belong to a specific parent. This operation supports pagination, enabling efficient navigation through large document structures without loading complete hierarchies.
The list operation accepts a root node identifier and optional filters for node types. You can list all child nodes, or filter to specific types like text nodes or image nodes. This filtering enables focused exploration that matches your navigation needs.
List results include pagination tokens enabling you to retrieve additional pages. The response includes total counts indicating hierarchy sizes, enabling you to understand document structure and plan navigation strategies. Results are ordered to preserve document structure, enabling sequential navigation through content.
- Request
- Response
GET /v1/nodes/children?root_node_id=corpus-456&parent_node_id=node-100&node_types=TEXT&page_size=20
Authorization: Bearer <your-token>
{
"nodes": [
{
"node_id": "node-123",
"node_type": "TEXT",
"content": "First paragraph...",
"next_node_id": "node-124"
},
{
"node_id": "node-124",
"node_type": "TEXT",
"content": "Second paragraph...",
"next_node_id": "node-125"
}
],
"next_page_token": "eyJwYWdlIjoxfQ==",
"total_count": 45
}
- Use node type filters to focus on relevant content types
- Leverage pagination for large document hierarchies
- Use
total_countto understand structure size before navigation - Combine with search to find entry points, then navigate from there
Understanding Node Relationships
Nodes maintain relationships that enable hierarchical and sequential navigation. Parent-child relationships create vertical hierarchies where nodes contain other nodes, enabling navigation from containers to contents. Sequential relationships create horizontal flows where nodes link to their successors, enabling navigation through reading order.
The node response includes parent and next node identifiers when relationships exist. You can use these identifiers to navigate hierarchies: follow parent links to move upward toward document roots, or follow next links to move laterally through sequential content. This navigation enables exploration of document structures without requiring complete hierarchy loading.
Hierarchical paths provide encoded lineage from root to node, enabling efficient queries that find descendants, identify ancestors, and count nodes at specific depths. These paths enable structural queries that understand document organization without requiring tree traversal.
- Parent-child: Vertical hierarchy (containment relationships)
- Sequential: Horizontal flow (reading order)
- Ancestral paths: Encoded lineage for efficient queries
For detailed information about node structure, see the Node concept documentation.
Navigating Document Structures
Document navigation combines node retrieval and child listing to explore complete document hierarchies. Start with the corpus node to understand document metadata, then list child nodes to discover document structure. Retrieve specific nodes to access content, and use relationships to navigate between related nodes.
Navigation patterns depend on your use case:
- Reading-Oriented
- Structure-Oriented
- Search-Oriented
Follow sequential links to move through content in reading order. Start with the first node and follow next_node_id links to read through the document sequentially.
Follow parent-child relationships to understand document organization. Start with the corpus node, list children to discover sections, then drill down into specific content elements.
Use search results as entry points, then navigate from discovered nodes to related content. Combine search and navigation for comprehensive document exploration.
The navigation system supports progressive exploration where you discover structure incrementally rather than loading complete hierarchies. This approach enables efficient navigation of large documents while maintaining flexibility to explore different paths based on your needs.
- Python Example
- JavaScript Example
import requests
headers = {"Authorization": "Bearer <your-token>"}
# Start with corpus
corpus_id = "corpus-123"
response = requests.get(
f"https://<your_domain>/v1/corpus/{corpus_id}",
headers=headers
)
corpus = response.json()
# List child nodes (ARTIFACT)
response = requests.get(
f"https://<your_domain>/v1/nodes/children",
headers=headers,
params={"root_node_id": corpus_id}
)
children = response.json()
# Navigate to first child
if children["nodes"]:
first_node_id = children["nodes"][0]["node_id"]
response = requests.get(
f"https://<your_domain>/v1/nodes/{first_node_id}",
headers=headers,
params={"root_node_id": corpus_id}
)
node = response.json()
print(f"Content: {node['content']}")
# Follow sequential link
if node.get("next_node_id"):
next_response = requests.get(
f"https://<your_domain>/v1/nodes/{node['next_node_id']}",
headers=headers,
params={"root_node_id": corpus_id}
)
next_node = next_response.json()
print(f"Next: {next_node['content']}")
const corpusId = "corpus-123";
const headers = { Authorization: "Bearer <your-token>" };
// Start with corpus
const corpusResponse = await fetch(
`https://<your_domain>/v1/corpus/${corpusId}`,
{ headers }
);
const corpus = await corpusResponse.json();
// List child nodes
const childrenResponse = await fetch(
`https://<your_domain>/v1/nodes/children?root_node_id=${corpusId}`,
{ headers }
);
const children = await childrenResponse.json();
// Navigate sequentially
let currentNodeId = children.nodes[0]?.node_id;
while (currentNodeId) {
const nodeResponse = await fetch(
`https://<your_domain>/v1/nodes/${currentNodeId}?root_node_id=${corpusId}`,
{ headers }
);
const node = await nodeResponse.json();
console.log(node.content);
currentNodeId = node.next_node_id;
}
Next Steps
Now that you understand node navigation, explore:
- Search Operations: Find nodes to navigate from
- Common Patterns: Real-world navigation workflows
- Node Concept: Deep dive into node structure and relationships