Get File Contents Node
Retrieve the full text contents of a file in a Needle collection.
The Get File Contents node reads the extracted text content of a specific file from a Needle collection. It requires a file ID (which you can obtain from the List Files or Search Files by Name nodes) and returns the document's text. This is useful for feeding full document content into AI nodes for analysis, summarization, or data extraction.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
collectionId | string | ✅ | The Needle collection containing the file | |
fileId | string | ✅ | "" | The ID of the file to read (supports expressions) |
instructions | string | ❌ | "" | Additional instructions (template mode) |
runMode | string | ✅ | item | Run mode: item or input |
collectionId
Type: string | Required: ✅
The ID of the Needle collection that contains the file. Select from the dropdown in the node configuration UI.
fileId
Type: string | Required: ✅
The ID of the file to retrieve contents from. File IDs always start with the prefix fle_. You can obtain file IDs from the List Files node or Search Files by Name node.
Examples:
- Static:
fle_01K47WKN43WJ5VY3EG282ZCQJP - Dynamic (expression):
item.id(from a List Files output)
instructions
Type: string | Required: ❌
Additional natural language instructions for content retrieval. Evaluated in template mode.
Examples:
Extract newsletter contentGet the file contents only of yesterday's notifications file.
runMode
Type: string | Required: ✅ | Default: item
Controls how the node processes input data:
item— Runs once per array element. Commonly used to get contents for each file from a List Files output.input— Runs once for the entire input.
Configuring This Node
When you select a Get File Contents node on the workflow canvas, the right-hand configuration panel displays the following sections from top to bottom:
Run Mode & Error Handling
At the top of the panel you will find:
- Run Mode dropdown — Choose between Item (the node executes once per array element) and Input (the node executes once for the entire input object). This corresponds to the
runModeparameter. - Continue on Error toggle — When enabled, the workflow continues to the next node even if this node encounters an error. When disabled (the default), a node error will stop the workflow run.
Variables
A multi-select dropdown that lets you bind workflow variables to this node. Bound variables become accessible in expressions via the variables object (e.g. variables.myVar). You can also click the Create variable button to define a new workflow variable inline without leaving the node panel.
Collection
A dropdown listing all Needle collections you have access to. Select the collection that contains the file you want to read. This sets the collectionId parameter.
Instructions
A template text area where you can provide natural language guidance for content retrieval. Use ${...} syntax to interpolate dynamic values from the workflow context. For example:
Get the contents of the file uploaded on ${variables.targetDate}.
Property Fields
Below the Instructions area, property fields are organized into Required and Optional sections:
- fileId (Required) — The ID of the file to retrieve contents from.
Each property field has a parameter mode selector (accessible via a small icon on the field) with three options:
| Mode | Description |
|---|---|
| Fixed | Enter a static value directly (e.g. paste a known file ID). |
| Expression | Write a JavaScript expression with access to input, item, and variables from the workflow. |
| AI Decide | Let the AI agent determine the value at runtime based on the node's instructions and context. |
Examples
1. Get Contents of a Specific File
Retrieve the contents of a known file:
Parameters:
{
"runMode": "input",
"collectionId": "<your-collection-id>",
"fileId": "fle_01K47WKN43WJ5VY3EG282ZCQJP"
}
2. Get Contents for Each File in a List
Process the output of a List Files node to read each file:
Parameters:
{
"runMode": "item",
"collectionId": "<your-collection-id>",
"fileId": "",
"instructions": ""
}
The fileId is automatically resolved from the item when the AI agent calls the tool.
3. Get Contents Using Dynamic File ID
Use a file ID from input data:
Parameters:
{
"runMode": "input",
"collectionId": "<your-collection-id>",
"fileId": "input.fileId",
"parameterMode": {
"fileId": "expression"
}
}
4. Let AI Decide Which File
When the file ID should be determined by context:
Parameters:
{
"runMode": "input",
"collectionId": "<your-collection-id>",
"fileId": "\"fle_01K5QYR5SWDGVKHWK255HRNXET\"",
"instructions": "Get the file contents only of yesterday's notifications file.",
"parameterMode": {
"fileId": "ai-decide"
}
}
Output Structure
The node returns the text content of the file:
{
"content": "Full extracted text content of the document...",
"fileId": "fle_01ABC...",
"fileName": "quarterly-report.pdf"
}
Important Notes
- File ID prefix: File IDs always start with
fle_. Ensure the correct format is used. - Collection access: The user running the workflow must have at least viewer access to the collection.
- Indexed files only: The file must be fully indexed before its contents can be retrieved.
- Common pattern: List Files → Get File Contents → AI Node is a common pipeline for processing all documents in a collection.
- Continue on Error: Enable the Continue on Error toggle in the node panel to allow the workflow to proceed even if a file cannot be read (e.g. the file is still indexing or the ID is invalid).
- Workflow Variables: Bind workflow variables to this node to use them in expressions. For example, set
fileIdto an expression likevariables.targetFileIdto make the file configurable across runs. - Parameter modes: Each property field supports three modes — Fixed (enter a known file ID directly), Expression (JavaScript with access to
input,item,variables), and AI Decide (the AI agent determines the correct file at runtime). Choose the mode that fits your use case via the mode selector on each field.