Make HTTP requests
Call external APIs with authentication, headers, and response handling.
The HTTP Request node is the primary way patterns interact with external services. It supports all standard HTTP methods, custom headers, request bodies, and returns the response status code, headers, and body. This guide covers everything you need to make reliable API calls from your patterns.
HTTP Request node overview
Input pins
| Pin | Type | Description |
|---|---|---|
| Method | String | The HTTP method: GET, POST, PUT, PATCH, or DELETE |
| URL | String | The full URL to send the request to |
| Headers | Object | Key-value pairs for request headers |
| Body | String | The request body (typically JSON) |
Output pins
| Pin | Type | Description |
|---|---|---|
| Status Code | Integer | The HTTP status code (200, 404, 500, etc.) |
| Response Headers | Object | The response headers as key-value pairs |
| Response Body | String | The raw response body as a string |
Make a simple GET request
- Right-click on the canvas and search for "HTTP Request".
- Add it to the canvas.
- Select the node to open the Inspector Panel and configure:
- Method:
GET - URL:
https://api.github.com/repos/octocat/Hello-World
- Method:
- Wire the execution flow from your trigger node to HTTP Request.
The response body arrives as a raw string. To work with it as an object, wire it into a JSON Parse node. See Work with JSON for details.
Send a POST request with a JSON body
To send data in the request body:
- Add an HTTP Request node and set the Method to
POST. - Set the URL to the target endpoint.
- Build the request body using Set Property and JSON Stringify nodes, or use a String literal with the JSON content.
- Wire the JSON string to HTTP Request's Body input pin.
You also need to set the Content-Type header so the server knows the body is JSON.
Setting headers
- Add a Set Property node.
- Set the Key to
Content-Type. - Add a String literal with the value
application/jsonand wire it to Set Property's Value input pin. - Wire Set Property's Object output pin to HTTP Request's Headers input pin.
Add authentication
Most APIs require authentication. The two most common patterns are API keys in headers and Bearer tokens.
API key in a header
Some APIs expect an API key in a custom header (for example, X-API-Key).
- Add a Set Property node. Set the Key to
X-API-Key. - Add a String literal with your API key value and wire it to Set Property's Value input pin.
- To add the
Content-Typeheader as well, chain a second Set Property node with the keyContent-Typeand valueapplication/json. - Wire the final Set Property's Object output pin to HTTP Request's Headers input pin.
Bearer token
APIs that use OAuth or JWT tokens expect an Authorization header with a Bearer prefix.
- Add a Format node with the template
Bearer {0}. - Wire your token value (from a variable, a connection, or a previous API response) to Format's first input.
- Add a Set Property node. Set the Key to
Authorization. - Wire Format's Result to Set Property's Value input pin.
- Wire Set Property's Object output pin to HTTP Request's Headers input pin.
For reusable credential management, consider using connections instead of hardcoding tokens.
Handle the response
Check the status code
Not every HTTP response is a success. Use a Branch node to check the status code before processing the body.
- Add an Equal node. Wire HTTP Request's Status Code to the first input and set the second input to
200. - Add a Branch node. Wire Equal's Result to Branch's Condition input pin.
- Wire the True path to your success logic.
- Wire the False path to your error logic.
Parse the response body
The response body is a raw string. To extract fields, parse it first:
- Add a JSON Parse node and wire HTTP Request's Response Body to its String input pin.
- Add Get Property nodes to extract the fields you need.
Error handling with Try / Catch
HTTP requests can fail for reasons beyond bad status codes — network timeouts, DNS resolution failures, or connection resets. These raise errors that stop the execution. Wrap HTTP Request in a Try / Catch to handle these gracefully.
For transient failures, combine Try / Catch with a Retry node:
See Handle errors for a full guide on error handling nodes.
Example: Call an API with auth and process the response
This pattern receives a webhook with a GitHub username, fetches the user's profile from the GitHub API, extracts their public repository count, and logs the result.
Pattern layout
Step-by-step
- On Webhook receives
{"username": "octocat"}. - Get Property extracts
"octocat". - Format builds the URL
https://api.github.com/users/octocat. - Set Property creates a headers object with the
Acceptheader. - HTTP Request sends a
GETrequest to the GitHub API. - JSON Parse converts the response body from a string to an object.
- Get Property extracts the
public_reposfield. - Format builds the message:
octocat has 8 public repositories. - Log writes the result to the console.
Test the pattern
- Select Run in the toolbar.
- Enter the test event data:
{
"body": { "username": "octocat" },
"headers": {},
"query": {},
"method": "POST"
}- Verify the console shows the formatted repository count message.