Making HTTP Requests Using Node.js Fetch API

To send HTTP requests using the Node.js Fetch API, you need Node.js v18 or higher. Like the browser version, the Node.js Fetch API is promise-based and works perfectly with async/await structures. The global fetch() method takes two parameters: the URI of the resource you want to fetch and an optional "options" parameter that provides additional parameters for the request. Using the "options" parameter, you can pass the HTTP method, additional HTTP headers, POST data, and request credentials. The fetch() method returns a promise, which resolves to a Response object. You can obtain the response in JSON format by calling response.json(), or as plain text by calling response.text(). In this Node.js Fetch Example, we make a request to the ReqBin echo URL using the fetch() method. Click Execute to run the Node.js Fetch Example online and see the result.
Making HTTP Requests Using Node.js Fetch API Execute
(async () => {
  const response = await fetch('', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer [token]'

  const data = await response.json();