HTTP Request — Make HTTP requests to external APIs

Makes an HTTP request to any external API and outputs the response. Use it to call REST APIs, internal services, or any HTTP endpoint from within a workflow.

When to Use

Use HTTP Request for any outbound API call:

  • Fetching data from a third-party API
  • Sending data to an external service
  • Calling internal microservices or your own APIs
  • Proxying or forwarding webhook payloads to another system

Inputs

HandleTypeDescription
bodyanyRequest body content. Connect an upstream output to send data as the request payload. Optional — only used for POST, PUT, PATCH, and other methods that send a body.

When the body input is connected, dict and list values are sent as JSON (Content-Type: application/json is set automatically). Other values are sent as plain text.

Output

HandleTypeDescription
responseobjectThe HTTP response on the success path (2xx status codes only).

The response handle (accessed as {{ http_request.* }}) shape:

FieldTypeDescription
statusnumberHTTP status code (e.g., 200, 201, 204)
dataanyParsed response body (JSON if Content-Type is application/json, otherwise raw text)
headersobjectResponse headers as key-value pairs

Settings

SettingTypeDefaultDescription
methoddropdownGETHTTP method: GET, POST, PUT, PATCH, or DELETE.
urlstringTarget URL. Required. Supports template expression bindings for dynamic URLs.
headersobjectHTTP headers to include in the request. Supports template bindings on individual values.
queryobjectQuery parameters appended to the URL. Supports template bindings on individual values.
timeoutnumber30Request timeout in seconds.

Example

Canvas

Call the GitHub API to fetch repository information:

Webhook → HTTP Request → Transform → Send Email

HTTP Request settings:

  • Method: GET
  • URL: https://api.github.com/repos/{{ webhook.body.repository }}
  • Headers:
    {
      "Authorization": "Bearer {{ env.GITHUB_TOKEN }}",
      "Accept": "application/vnd.github+json"
    }
    

Access the response in a downstream node:

{{ http_request.data.stargazers_count }}
{{ http_request.data.description }}
{{ http_request.status }}

To send a JSON body, connect an upstream node to the body input handle (e.g., a Transform or Code node that shapes the payload).

To handle API failures without stopping the workflow, connect the On Error output to a fallback branch:

HTTP Request → response: Transform (process data)
            → error: Send Email (alert on failure)

TSL

import webhook from @tensorify/webhook-trigger:4.0.0
import http_request from @tensorify/http-request:3.0.0
import transform from @tensorify/transform:3.0.0

node trigger @tensorify/webhook-trigger:4.0.0 {
    path = "/github"
    method = "POST"
    provider = "generic"
}

node fetch @tensorify/http-request:3.0.0 {
    method = "GET"
    url = "https://api.github.com/repos/{{ webhook.body.repository }}"
    headers = "{\"Authorization\": \"Bearer {{ env.GITHUB_TOKEN }}\"}"
    timeout = 30
}

node format @tensorify/transform:3.0.0 {
    mode = "object"
    template = "{\"stars\": \"{{ http_request.data.stargazers_count }}\", \"description\": \"{{ http_request.data.description }}\"}"
}

trigger.payload -> fetch.body
fetch.response -> format.input

Error Handling

HTTP Request has a hidden On Error control output branch. Enable it via the "Error output handle" toggle at the bottom of the settings panel, or connect an edge to error in TSL (which enables it automatically).

The error branch fires when:

  • The URL is missing or empty after binding resolution
  • The response status code is 4xx or 5xx
  • The request times out (exceeds the timeout setting)
  • A network or connection error occurs

When the error branch executes, downstream nodes can access the error details via {{ <nodeId>__error }}:

FieldTypeDescription
errorstringHuman-readable error message (e.g., HTTP 404, Connection timeout)
nodeIdstringThe ID of the node that failed

If the error branch is not connected, any of the above failures halt execution on that path.

Connect the error output to a notification action, a fallback Return node, or a Stop node to handle failures gracefully.

TSL with error branch

import http_request from @tensorify/http-request:3.0.0
import return_node from @tensorify/return:3.0.0

node fetch @tensorify/http-request:3.0.0 {
    method = "GET"
    url = "https://api.example.com/users/{{ input.id }}"
}

node ok @tensorify/return:3.0.0 {
    returnMode = "simple"
}

node fail @tensorify/return:3.0.0 {
    returnMode = "custom"
    statusCode = "502"
    mode = "object"
    template = "{\"error\": \"{{ fetch__error.error }}\"}"
}

fetch.response -> ok.input
fetch.error -> fail.input

Common Gotchas

  • 4xx/5xx are errors: Unlike some HTTP clients, HTTP Request treats status codes ≥ 400 as failures. They route to the error branch (when connected) or halt the workflow — they do not continue on the success path. Use the error branch to handle expected failures like 404.
  • Success path is 2xx only: {{ http_request.* }} variables are only available on the success path. Do not rely on them after an error.
  • Timeout: Requests that exceed the timeout setting fail and route to the error branch.
  • Authentication: Put API keys in headers or query parameters using env var bindings ({{ env.MY_API_KEY }}). Do not hardcode secrets in settings.
  • Body input: GET and DELETE requests ignore the body input. Connect body only for POST, PUT, and PATCH.

See Also

  • Transform — reshape data before sending
  • Code — custom logic to build request payloads
  • If — branch on response data on the success path
  • Return — return API proxy responses synchronously
  • Environment Variables — store API keys safely
On this page