HTTP Request Node
Make HTTP requests to external APIs and services.
This node provides a flexible way to send HTTP requests to any URL and process the response data. All response details (status code, headers, body) are available in the output for further processing in your workflow.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
method | string | ✅ | HTTP method (GET, POST, PUT, DELETE, PATCH) |
url | string | ✅ | Target URL (supports expressions) |
headers | string | ❌ | HTTP headers as JSON string (supports expressions) |
body | string | ❌ | Request body (supports expressions) |
responseType | string | ❌ | Response parsing type (json or text) |
method
Type: string | Required: ✅
The HTTP method to use for the request.
Supported methods:
GET- Retrieve data from the serverPOST- Send data to the server for processingPUT- Update or create a resourceDELETE- Remove a resourcePATCH- Partially update a resource
url
Type: string | Required: ✅
The target URL for the HTTP request. Supports both static URLs and dynamic expressions.
Examples:
-
Static:
https://api.example.com/users -
Dynamic:
https://search.needle.app/api/v1/collections/${input.collection_id}/searchNote: For dynamic URLs, set
parameterMode.urlto"expression". Variables are accessed viainputvariable ininputrun mode and viaiteminitemrun mode.
headers
Type: string | Required: ❌
HTTP headers to include with the request. Must be a valid JSON string containing key-value pairs.
Examples:
-
Static:
{"Content-Type": "application/json", "Authorization": "Bearer token"} -
Dynamic:
{"Content-Type": "application/json", "x-api-key": input.api_key}Note: For dynamic URLs, set
parameterMode.headersto"expression". Variables are accessed viainputvariable ininputrun mode and viaiteminitemrun mode.
body
Type: string | Required: ❌
Request body data. The format depends on the Content-Type header:
application/json- JSON stringapplication/x-www-form-urlencoded- URL-encoded stringtext/plain- Plain text string
Examples:
-
Static:
{"query": "search term", "limit": 10} -
Dynamic:
{"text": input.search_text, "top_k": input.top_k}Note: For dynamic URLs, set
parameterMode.bodyto"expression". Variables are accessed viainputvariable ininputrun mode and viaiteminitemrun mode.
responseType
Type: string | Required: ❌ | Default: json
Specifies how the response body should be parsed:
json(default) - Parse response as JSON objecttext- Keep response as raw text string
Examples
1. Simple GET Request
Fetch data from a public API:
Parameters:
{
"method": "GET",
"url": "https://jsonplaceholder.typicode.com/posts/1",
"responseType": "json"
}
Output:
{
"response": {
"status": 200,
"headers": { "content-type": "application/json" },
"body": {
"id": 1,
"title": "sunt aut facere repellat provident",
"body": "quia et suscipit..."
}
}
}
2. POST Request with Authentication
Send data with API key authentication:
Parameters:
{
"method": "POST",
"url": "https://api.example.com/data",
"headers": "{\"Content-Type\": \"application/json\", \"Authorization\": \"Bearer your-token\"}",
"body": "{\"query\": \"search term\"}",
"responseType": "json"
}
3. Dynamic Request with Input Variables
Use workflow input to construct the request dynamically:
Input:
{
"api_key": "some-api-key",
"top_k": "4",
"collection_id": "clt_01JW8MAK76KR36PG2VCQRGVXEG",
"search_text": "needle typescript"
}
Parameters:
{
"runMode": "input",
"method": "POST",
"url": "https://search.needle.app/api/v1/collections/${input.collection_id}/search",
"headers": "{\"Content-Type\": \"application/json\", \"x-api-key\": input.api_key}",
"body": "{\"text\": input.search_text, \"top_k\": input.top_k}",
"responseType": "json",
"parameterMode": {
"url": "expression",
"headers": "expression",
"body": "expression"
}
}
Output:
{
"response": {
"status": 200,
"headers": {
"content-length": "12049",
"content-type": "application/json"
},
"body": {
"result": [
{ "id": "chk_123", "content": "relevant content", "distance": 0.42 }
]
}
}
}
Output Structure
The HTTP Request node returns a response object with the following structure:
{
"response": {
"status": 200, // HTTP status code
"headers": {
// Response headers as key-value pairs
"content-type": "application/json",
"content-length": "1234"
},
"body": {} // Response body (parsed according to responseType)
}
}
Response Body Parsing:
responseType: "json"- Body is parsed as JSON objectresponseType: "text"- Body remains as raw text string
Expression Support
The HTTP Request node supports dynamic expressions in the following parameters:
| Parameter | Expression Syntax | Example |
|---|---|---|
url | ${input.variable_name} or input.variable_name | https://api.com/${input.user_id} |
headers | input.variable_name in JSON | {"Authorization": "Bearer " + input.token} |
body | input.variable_name in JSON | {"query": input.search_term} |
Parameter Mode Configuration:
{
"parameterMode": {
"url": "expression", // Evaluate as expression
"headers": "expression", // Evaluate as expression
"body": "expression" // Evaluate as expression
}
}
Important Notes
- Parameter Mode Required: For any parameter using expressions, you must set the corresponding
parameterModefield to"expression" - Variable Access: Variable syntax depends on the
runMode:"input"run mode: Makesinputvariable available in expressions"item"run mode: Makesitemvariable available in expressions