# HTTP Request
The HTTP Request node is one of the most versatile nodes in n8n. It allows you to make HTTP requests which can be used to query data from apps and services.
# Node Reference
- Authentication: In this dropdown list, there are several authentication options to use with HTTP requests.
- Basic Auth
- Digest Auth
- Header Auth
- OAuth1
- OAuth2
- None
- Request Method: In this dropdown list, there are several methods that can be used to send different type of HTTP requests.
- DELETE
- GET
- HEAD
- PATCH
- POST
- PUT
- URL: This field is where the URL to request has to be entered.
- Ignore SSL Issues: This option can be used to download the response even if SSL validation is not possible.
- Response Format: Select the format in which the data gets returned from the URL. You can choose between File, JSON, and String.
- JSON/RAW Parameters: This option can be used to specify whether the body/query parameter should be set via the value-key pair UI or JSON/RAW.
- Options
- Full Response: This option can be used to retrieve the full response instead of only the body from the URL.
- Follow Redirect: This option can be used to follow any redirections with a status code 3xx.
- Ignore Response Code: This option can be used to let the node execute even when the HTTP status code is not 2xx.
- Proxy: This field is used to specify an HTTP proxy that you may want to use.
- Timeout: The maximum time (in ms) to wait for a response header from the server before aborting the request.
- Headers: This section is used to specify any optional HTTP request headers you may want to include with your request.
- Query Parameters: This section is used to specify any HTTP query parameters you may want to include with your request.
# Example Usage
This workflow allows you to GET a sample list of users from reqres.in (opens new window), add a new user using a POST request, and update the user using a PATCH request. You can also find the workflow (opens new window) on n8n.io. This example usage workflow uses the following nodes.
The final workflow should look like the following image.
# 1. Start node
The start node exists by default when you create a new workflow.
# 2. HTTP Request node (GET)
- Enter
https://reqres.in/api/users
in the URL field. - Click on Execute Node to run the workflow.
# 3. HTTP Request1 node (POST)
- Select 'POST' from the Request Method dropdown list.
- Enter
https://reqres.in/api/users
in the URL field. - Click on the Add Parameter button in the Body Parameters section.
- Enter
name
in the Name field. - Enter
Neo
in the Value field. - Click on the Add Parameter button in the Body Parameters section.
- Enter
job
in the Name field. - Enter
Programmer
in the Value field. - Click on Execute Node to run the workflow.
# 4. HTTP Request2 node (PATCH)
- Select 'PATCH' from the Request Method dropdown list.
- Enter
https://reqres.in/api/users/2
in the URL field. - Click on the Add Parameter button in the Body Parameters section.
- Enter
name
in the Name field. - Enter
Neo
in the Value field. - Click on the Add Parameter button in the Body Parameters section.
- Enter
job
in the Name field. - Enter
The Chosen One
in the Value field. - Click on Execute Node to run the workflow.
# FAQs
# How to fetch a binary file from a URL?
- Enter the URL of the file in the URL field. For example, you can enter
https://n8n.io/n8n-logo.png
to fetch the n8n logo. - Select 'File' from the Response Format dropdown list.
- (Optional) Change the binary property value in the Binary Property field. Throughout the workflow, you can refer to the binary data with the value you set in this field.
- Click on Execute Node to run the node.
- After the node gets executed, click on the Binary tab.
- Click on the Show Binary Data button to view the file.
# How to send a binary file to an API endpoint?
Depending on your use-case, you might want to send a binary file to an API endpoint. To do that, follow the steps mentioned below.
- Connect the HTTP Request node with a node that has previously fetched the binary file. This node can be an HTTP Request node, Read Binary File node, Google Drive node or any such node.
- Select 'POST' from the Request Method dropdown list (Note: Refer to the API documentation of your API to make sure that you have selected the correct HTTP request method).
- Enter the URL where you want to send the binary file in the URL field.
- Toggle JSON/RAW Parameters to
true
. - Toggle Send Binary Data to
true
. - If you are referring to the binary property with a different value, enter that value in the Binary Property field.
- Click on Add Option and select 'Body Content Type' from the dropdown list.
- Select 'Form-Data Multipart' from the Body Content Type dropdown list.
- Click on Execute Node to run the node.
# How to get the HTTP status code after an execution?
- Click on Add Option and select 'Full Response'.
- Toggle Full Response to
true
.
When the node gets executed, you will receive the HTTP status code, the HTTP status message, and the header parameters.
# How to send XML data?
- Toggle JSON/RAW Parameters to
true
. - Click on Add Option and select 'Body Content Type'.
- Select 'RAW/Custom' from the Body Content Type field.
- Enter the XML data in the Body field.
# Further Reading
- Building an expense tracking app in 10 minutes 📱 (opens new window)
- Creating scheduled text affirmations with n8n 🤟 (opens new window)
- Cross-posting content automatically with n8n ✍️ (opens new window)
- HTTP Request Node — The Swiss Army Knife (opens new window)
- Supercharging your conference registration process with n8n 🎫 (opens new window)
← HTML Extract IF →