Introduction
In our last module, you successfully built a complete notification workflow that listens for a GitHub push event, parses the payload, and posts a formatted commit summary to Slack. This is a powerful pattern for creating visibility into your development lifecycle.
Now, we will shift from simply reporting on events to actively orchestrating them. This lesson marks the beginning of our deep dive into CI/CD automation. We will focus on the HTTP Request node, the universal tool for interacting with any REST API. Your goal today is to learn how to use this node to make authenticated queries to a CI/CD tool's API. Mastering this is the foundational skill for triggering builds, checking job statuses, and managing deployments, bringing you closer to your goal of orchestrating entire CI/CD pipelines within n8n.
The Universal API Tool: The HTTP Request Node
While n8n has dedicated nodes for many popular services like Slack and GitHub, it's impossible to have a pre-built node for every tool or every possible API action. This is especially true in the CI/CD space, where you might use Jenkins, GitLab, GitHub Actions, or even custom-built internal tools, each with its own rich API.
The HTTP Request node is your solution. It allows you to make any standard HTTP call (GET, POST, PUT, DELETE, etc.) to any API endpoint. For someone with your experience in CI/CD, you can think of this node as the n8n equivalent of using curl or a Python requests script to interact with an API, but with the added benefits of n8n's credential management and visual workflow structure.
Understanding API Authentication
To perform any meaningful action on a CI/CD tool's API, you must first authenticate. The HTTP Request node in n8n provides a robust system for handling various authentication methods securely.
The video below gives an excellent overview of the different authentication mechanisms available in n8n. We will focus on the most common ones used for interacting with programmatic APIs.
Complete n8n Authentication Mastery in 14 Minutes | All Auth Methods | Complete Guide
The video "n8n Authentication Explained" by FuturMinds breaks down the key concepts you'll need.
Please watch the following segments: First, watch the section on predefined vs. generic credentials. This explains why we sometimes use the generic HTTP Request node even for services that have their own dedicated n8n node. Next, focus on the segment covering Bearer and Header authentication. This is one of the most common patterns for modern APIs, where you send a secret token in the request headers. This is the method we will use for GitHub's API. Finally, watch the conceptual overview of OAuth2. While we won't implement it today, understanding this flow is crucial as it's the standard for many modern services that involve user-delegated permissions.
To complement the video, the official n8n documentation provides a comprehensive written guide to all supported authentication types. It serves as a great reference.
This documentation page is a handy reference for configuring authentication.
Review the list of Supported authentication methods to see the available options. Then, pay special attention to the descriptions for Header auth and Bearer auth, as these are directly relevant to our upcoming exercise.
Practical Application: Querying the GitHub API
Now, let's put this theory into practice. Your task is to build a simple workflow that uses the HTTP Request node to query the GitHub API for information about a repository. This simulates the first step of a CI/CD process, such as checking the latest commit before triggering a build.
We will authenticate using a GitHub Personal Access Token (PAT), which uses the Bearer Token authentication scheme you just learned about.
Step 1: Generate a GitHub Personal Access Token
First, you need to create a PAT in your GitHub account.
- Navigate to your GitHub Settings > Developer settings > Personal access tokens > Tokens (classic).
- Click Generate new token (classic).
- Give your token a descriptive name (e.g., "n8n-cicd-orchestrator").
- Set an expiration date.
- Under Select scopes, check the
reposcope. This grants full control of private repositories, which is necessary for most CI/CD tasks. - Click Generate token and copy the token immediately. You will not be able to see it again.
The process of using a PAT for authentication is a common pattern detailed in many online guides.
How to Create GitHub Pull Requests Automatically in n8n (Just 4 Steps) | GrowwStacks Blog
This article, while focused on creating pull requests, starts with the fundamental authentication setup we need.
Read the section Authentication Setup. This reinforces the need for a PAT with the repo scope and storing it securely in n8n. The FAQ section also has a good summary under the question How does n8n authenticate with GitHub for these requests?.
Step 2: Configure and Execute the HTTP Request Node
Now, let's build the workflow in n8n.
- Create a new workflow and add an
HTTP Requestnode. - Authentication:
- Set Authentication to
Generic Credential Type. - Set Generic Auth Type to
Bearer Auth. - Click Create New for the credential.
- Give the credential a name, like "GitHub PAT".
- In the Bearer Token field, paste the PAT you just copied from GitHub. n8n will automatically handle adding the
Bearerprefix andAuthorizationheader. - Click Save.
- Set Authentication to
- URL and Method:
- Set the Method to
GET. - In the URL field, we will use the GitHub API endpoint to get a reference, for example, the latest commit on the main branch. The endpoint is:
https://api.github.com/repos/{owner}/{repo}/git/refs/heads/main. - Replace
{owner}with your GitHub username or organization and{repo}with a repository name.
- Set the Method to
- Headers:
- Most APIs, including GitHub's, require specific headers. The GitHub API documentation specifies an
Acceptheader to ensure you get the correct API version. - Under the Send Headers section, add a header with:
- Name:
Accept - Value:
application/vnd.github.v3+json
- Name:
- Most APIs, including GitHub's, require specific headers. The GitHub API documentation specifies an
Your configured node should look something like this, with the authentication, method, URL, and headers correctly set.

- Execute and Inspect:
- Click Execute step.
- If successful, you will see a JSON output containing details about the
mainbranch reference. Look for theobject.shafield—this is the SHA hash of the latest commit, a piece of data you might use in a downstream CI/CD step.
A pro-tip for working with APIs: many documentation sites provide cURL examples. n8n can import these directly to pre-fill the node for you.
How To Master N8N API Call in MINUTES: Connect ANY API with Ease
This clip from "How To Master N8N API Call in MINUTES" by Austin Reed shows a powerful time-saving feature.
Watch the segment from where he discusses cURL commands to see how you can copy a cURL command from API documentation and paste it into the Import cURL dialog in the HTTP Request node to automatically configure the method, URL, headers, and body.
Conclusion
In this lesson, you have learned how to use the versatile HTTP Request node to make authenticated API calls. This is the cornerstone of orchestrating CI/CD pipelines in n8n, moving you from a passive observer of events to an active conductor.
Key Takeaways:
- The
HTTP Requestnode is the universal tool for communicating with any REST API not covered by a dedicated n8n node. - Securely authenticating API calls is crucial. n8n's credential manager supports common methods like Bearer Token, Header Auth, Basic Auth, and OAuth2.
- For many CI/CD tools like GitHub, authentication is handled via a Personal Access Token (PAT) sent as a Bearer Token in the
Authorizationheader. - Constructing a successful API call requires careful reading of the target API's documentation to determine the correct URL, HTTP method, headers, and body format.
In our next lesson, we will combine these new skills with our knowledge of webhooks. You will learn how to trigger a CI/CD build by making a POST request to a tool's API, using data from the Git push event that initiated the workflow.