# n8n HTTP Request Bearer Auth: Send an API Key Header

> Send an API key safely in the n8n HTTP Request node: Generic Credential Type, Bearer Auth, removing api_key from the URL and fixing 401s.

Source: https://learn.ynteractive.com/content/blog/n8n-http-request-bearer-auth · Updated 2026-10-20 · Free from Stepthrough (https://learn.ynteractive.com)

Quick answer

To send an [API key](https://learn.ynteractive.com/content/glossary/api-key) as a [bearer token](https://learn.ynteractive.com/content/glossary/bearer-token) in the n8n [HTTP Request node](https://learn.ynteractive.com/content/glossary/http-request-node), set **Authentication** to **Generic Credential Type**, **Generic Auth Type** to **Bearer Auth**, then create a credential and paste the key into **Bearer Token**. n8n sends the header `Authorization: Bearer <your key>` on every call and keeps the key out of the URL. The free [Litescrape in n8n](https://learn.ynteractive.com/content/litescrape-n8n-serpapi-alternative) lesson switches a price-tracking workflow from a key in the URL to a bearer header.

Last updated October 20, 2026

[Take the free module →](https://learn.ynteractive.com/courses/n8n-jump-start/15)Module 15 of the free [n8n Jump Start](https://learn.ynteractive.com/courses/n8n-jump-start) course, about 7 minutes. No account needed.

By [Robert Breen](https://learn.ynteractive.com/content/about) · Published October 20, 2026 · Updated October 20, 2026 · 3 min read

n8n · HTTP Request · API keys

## Why not put the API key in the URL?

Keys in the URL end up in logs, browser history and screenshots. Many APIs, Litescrape among them, want the key in a header instead. A credential also means the key isn't visible in the workflow when you share or export it. The glossary entries on [API keys](https://learn.ynteractive.com/content/glossary/api-key) and [bearer tokens](https://learn.ynteractive.com/content/glossary/bearer-token) explain both.

## How do I set up Bearer Auth?

From the lesson, where Northpeak Packs (made up) checks competitor prices every Monday:

1. Double-click the **HTTP Request** node.
2. Replace the old address in **URL** with the new endpoint.
3. Under **Query Parameters** (turn on **Send Query Parameters** if you don't see them), delete parameters the new API doesn't need. Here: **engine**, because the URL already says Google Shopping, and **api_key**, because the key moves to a header.
4. Scroll up to **Authentication** and choose **Generic Credential Type**.
5. Open **Generic Auth Type** and choose **Bearer Auth**.
6. Open the **Bearer Auth** credential drop-down and click **+ Create new credential**.
7. Paste the key into **Bearer Token** and click **Save**.
8. Click **Execute step** to send one test request.

## Which auth type do I need?

Read the API's docs for the header it expects.

| API docs say | Generic Auth Type |
| --- | --- |
| `Authorization: Bearer YOUR_KEY` | Bearer Auth |
| A custom header like `X-API-Key: YOUR_KEY` | Header Auth |
| `?api_key=YOUR_KEY` in the URL | Query Auth |
| Username and password | Basic Auth |
| "Connect your account" with a login screen | OAuth2 API |

The list in n8n also has Custom Auth, Digest Auth and OAuth1 API for rarer cases.

## What should the response look like?

In the lesson, results come back in **shopping_results**, with **title**, **source**, **price** and **extracted_price**, the same field names the next nodes already use, so nothing downstream changes. When you swap one API for another, compare field names before you run the whole workflow.

## Try it free, step by step

**Litescrape in n8n: Swap SerpApi for a Cheaper Search API**. Switch a weekly n8n competitor-price workflow from SerpApi to Litescrape's Google Shopping API: change the HTTP Request URL, move the key into a Bearer Auth credential, test it and check the sheet. You do every step yourself in a practice copy of n8n, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

[Start the free lesson](https://learn.ynteractive.com/modules/litescrape-n8n-search-api)

[Or read the full step-by-step guide](https://learn.ynteractive.com/content/litescrape-n8n-serpapi-alternative)

## Why do I get 401 Unauthorized?

- The key is wrong, expired or has no credit left.
- The auth type doesn't match what the API expects (Bearer vs Header Auth).
- The old `api_key` query parameter is still there and conflicts.
- There's a stray space before or after the key.

Other codes are in [HTTP Status Codes in n8n](https://learn.ynteractive.com/content/blog/n8n-http-status-codes).

## How do I keep a weekly API call cheap?

Free tiers are small (the lesson's key comes with 5 free calls). Test with **Execute step** once, not on a loop, and pin the response while you build the rest of the workflow so you don't spend calls. The [query parameter](https://learn.ynteractive.com/content/glossary/query-parameter) and [rate limit](https://learn.ynteractive.com/content/glossary/rate-limit) entries cover the rest.

## Key takeaways

- Use Generic Credential Type > Bearer Auth when an API wants Authorization: Bearer.
- Remove api_key from query parameters once the key is in a credential.
- Match the auth type to the API's docs: Bearer, Header, Query or Basic.
- Compare response field names when you swap APIs.

## Frequently asked questions

**How do I add a bearer token in n8n?**

In the HTTP Request node, set Authentication to Generic Credential Type, choose Bearer Auth, create a credential and paste the token.

**What is the difference between Bearer Auth and Header Auth in n8n?**

Bearer Auth always sends Authorization: Bearer plus your token. Header Auth sends any header name and value you choose, such as X-API-Key.

**Is my API key visible in the workflow?**

Not when it's stored in a credential. The workflow only references the credential.

**Which course is this in?**

The free [n8n Jump Start](https://learn.ynteractive.com/courses/n8n-jump-start) course.

## Free lessons in this post

- [Litescrape in n8n: Swap SerpApi for a Cheaper Search API](https://learn.ynteractive.com/content/litescrape-n8n-serpapi-alternative): Switch a weekly n8n competitor-price workflow from SerpApi to Litescrape's Google Shopping API: change the HTTP Request URL, move the key into a Bearer Auth credential…

## Watch it in a free lesson: AI Receipt Extractor: Receipts to Google Sheets with n8n

### AI Receipt Extractor: video walkthrough

Full walkthrough · 5:35 · with captions

Drop a photo of a receipt into an n8n chat. An AI agent reads it, pulls out the date, vendor and amount, picks a category, and adds a row to Google Sheets. The whole lesson narrated step by step, recorded in Stepthrough’s simulated practice environment.

[Watch it with chapters and the full transcript](https://learn.ynteractive.com/content/ai-receipt-extractor-n8n-google-sheets#watch)

From the free lesson [AI Receipt Extractor: Receipts to Google Sheets with n8n](https://learn.ynteractive.com/content/ai-receipt-extractor-n8n-google-sheets)

## Related terms

Plain-English definitions, each with an example from a free lesson.

[API key](https://learn.ynteractive.com/content/glossary/api-key) · [Bearer token](https://learn.ynteractive.com/content/glossary/bearer-token) · [HTTP Request node](https://learn.ynteractive.com/content/glossary/http-request-node) · [API endpoint](https://learn.ynteractive.com/content/glossary/api-endpoint) · [Edit Fields (Set) node](https://learn.ynteractive.com/content/glossary/edit-fields-node) · [Split Out node](https://learn.ynteractive.com/content/glossary/split-out-node) · [Web scraping](https://learn.ynteractive.com/content/glossary/web-scraping)

[The full AI glossary](https://learn.ynteractive.com/content/glossary)

## Keep reading

- [Website Form to Google Sheets: Two Ways with n8n](https://learn.ynteractive.com/content/blog/website-form-to-google-sheets): Two ways to send a website form to Google Sheets with n8n: a ready-made template with its own form, or a Lovable page with a webhook and an AI agent.
- [n8n Showing Feedback Agent FAQ: Real Estate Setup](https://learn.ynteractive.com/content/blog/n8n-showing-feedback-agent-faq): Plain answers about an n8n AI agent that turns buyer agents' showing feedback into one row per showing in Google Sheets for the weekly seller update.
- [n8n Showing Feedback Agent: 9 Mistakes to Avoid](https://learn.ynteractive.com/content/blog/n8n-showing-feedback-agent-mistakes): Mistakes that hurt an n8n showing feedback agent for listing agents, from price advice and buyers' names to mismatched columns and missing memory.

[All blog posts](https://learn.ynteractive.com/content/blog) · [All free tutorials](https://learn.ynteractive.com/content)
