Any node can be enabled as a read node by toggling the “read API” checkbox on the Trail canvas
Overview
This endpoint allows you to read data from any node in a trail, providing:- inputs: The input values used for the node
- outputs: The resulting data from the node execution
- Support for different node types with varying response formats
Node Types Supported
- read_function: Smart contract read-only functions
- write_function: Smart contract state-changing functions
- event: Blockchain event data
- code: TypeScript code execution results
Request Body
Same format as the evaluations endpoint:Response Formats
Code Nodes
Contract Nodes (read_function, write_function, event)
Nested JSON Format
For contract nodes, complex types are nested:- Tuples:
value
contains array of objects withname
,type
,value
- Arrays:
value
contains array of the array elements - Simple types:
value
contains the direct value - Unnamed args: Use
arg_{index}
as the key
Use Cases
- Pre-execution validation: Check if step is still valid (funds available, NFTs in stock)
- Post-execution data: Display results after transaction completion
- Dynamic UI updates: Show real-time contract state
- Execution context: Get data specific to user’s execution path
Important Notes
- Execution ID required: Must specify execution for context-specific data
- Read after execution: Some nodes require the step to be executed first (
readAfterExecution = true
) - Raw onchain data: Contract outputs need decimal adjustments - check step data for correct decimals
- Output schema: Find variable names in
outputSchema
field of readNodes array
Decimal Handling For Outputs
Contract function outputs are “raw” from blockchain:- Check
outputSchema
in step data for decimal places - Apply appropriate decimal conversion for display
- Ask user for clarification on expected decimal precision
Best Practices
- Check node requirements: Verify if step execution is required first
- Handle decimal conversion: Apply proper decimal places to raw values
- Cache wisely: Don’t spam this endpoint - avoid high-frequency polling
- Error handling: Handle cases where node data isn’t available yet
- Execution context: Always provide correct execution ID for user-specific data
Authorizations
Enter your bearer token in the format Bearer <token>
Headers
Application identifier for Herd Trail
Path Parameters
UUIDv7 string
UUIDv7 string
UUIDv7 string
Body
Response
200
Node data read successfully