Skip to main content

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

ParameterTypeRequiredDescription
methodstringHTTP method (GET, POST, PUT, DELETE, PATCH)
urlstringTarget URL (supports expressions)
headersstringHTTP headers as JSON string (supports expressions)
bodystringRequest body (supports expressions)
responseTypestringResponse parsing type (json or text)

method

Type: string | Required:

The HTTP method to use for the request.

Supported methods:

  • GET - Retrieve data from the server
  • POST - Send data to the server for processing
  • PUT - Update or create a resource
  • DELETE - Remove a resource
  • PATCH - 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}/search

    Note: For dynamic URLs, set parameterMode.url to "expression". Variables are accessed via input variable in input run mode and via item in item run 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.headers to "expression". Variables are accessed via input variable in input run mode and via item in item run mode.

body

Type: string | Required:

Request body data. The format depends on the Content-Type header:

  • application/json - JSON string
  • application/x-www-form-urlencoded - URL-encoded string
  • text/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.body to "expression". Variables are accessed via input variable in input run mode and via item in item run mode.

responseType

Type: string | Required: ❌ | Default: json

Specifies how the response body should be parsed:

  • json (default) - Parse response as JSON object
  • text - 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 object
  • responseType: "text" - Body remains as raw text string

Expression Support

The HTTP Request node supports dynamic expressions in the following parameters:

ParameterExpression SyntaxExample
url${input.variable_name} or input.variable_namehttps://api.com/${input.user_id}
headersinput.variable_name in JSON{"Authorization": "Bearer " + input.token}
bodyinput.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 parameterMode field to "expression"
  • Variable Access: Variable syntax depends on the runMode:
    • "input" run mode: Makes input variable available in expressions
    • "item" run mode: Makes item variable available in expressions