Plunk "Incorrect Bearer token specified" 401: Fix the Base URL
Plunk's "HTTP 401: Unauthorized. Incorrect Bearer token specified" usually means your client is calling the legacy host api.useplunk.com instead of next-api.useplunk.com. Change the base URL, or upgrade Upyo to 0.4.1 or 0.5.1 if you use its Plunk transport. Your key is probably fine.
Sohail Hussain7 min readShort answer
- The usual cause reported for this 401 is a client calling the legacy host api.useplunk.com with a valid key. Change the base URL to next-api.useplunk.com, the host Plunk's current docs use.
- If you send through the Upyo library, the issue report says the fix shipped in 0.4.1 (0.4 line) and 0.5.1 (0.5 line), so upgrade.
- If the host is already correct, re-copy the key and confirm that production picked up the new environment variable.
You sent a message through Plunk, you are sure the key is right, and you got this:
Send failed: HTTP 401: Unauthorized. {"code":401,"error":"Unauthorized","message":"Incorrect Bearer token specified"}
A 401 means the request reached a Plunk server and that server refused the token in your Authorization header. The mail never left, so nothing bounced and no recipient server is involved.
Why it happens
The causes below are ordered by how often they are reported, most common first. Only the first is tied to a specific report; the rest are general causes of any bearer-token 401.
1. The client calls the legacy host. The report behind this article (an issue on the Upyo library's tracker, number 35) describes a Plunk transport pointed at api.useplunk.com. Valid keys got 401 there, while the host in Plunk's docs, next-api.useplunk.com, was the fix. I have not found Plunk documentation that explains why the legacy host rejects the key, so treat "it does not recognize keys issued for the current API" as a likely explanation, not a confirmed one.
2. A library with an old default. Your own code may never mention the legacy host while a pinned library version does. That is how the same key can work in curl against the new host and fail inside your app. For Upyo, the report names 0.4.1 and 0.5.1 as the fixed versions.
3. The legacy API is on a deadline. The report says the legacy API would keep running only until October, and only for existing customers. I could not confirm that date in Plunk's own documentation, and it may already have passed. Check Plunk's docs or dashboard for the current status. The fix is the same either way.
4. The key or header is malformed. A stray space or newline from a .env file, quotes around the value, or a missing space after Bearer will produce the same message. The format is Bearer followed by one or more spaces and the token, as RFC 6750 defines it, and protocol parameter names and values are case sensitive unless noted otherwise.
5. A stale deployment. You updated the variable locally, but a running container, serverless function or CI secret still holds the old value.
Step-by-step fixes
Fix 1: Switch to the current host
- Search your repo, config files and environment variables for
api.useplunk.com. - Find where the base URL is set: an environment variable, a client constructor option, or a hard-coded fetch URL.
- Change the host to
next-api.useplunk.com. Keep the path exactly as Plunk's current API docs show it, since paths may differ from the legacy API. - Redeploy, send one test message, and read the full response body.
If you make the HTTP call yourself, only the host changes. The header shape stays the same:
Authorization: Bearer {your-plunk-key}
Content-Type: application/json
Fix 2: Upgrade Upyo
- Check the installed Upyo version in your lockfile.
- On the 0.4 line, upgrade to
0.4.1. On the 0.5 line, upgrade to0.5.1. - Remove any custom base URL you added as a workaround, or confirm it points at
next-api.useplunk.com. - Rebuild and resend.
I won't guess the option name for overriding the base URL, because it may differ between versions. Check the Plunk transport's README for your version.
Fix 3: Re-check the key and header
- Copy the key again from your Plunk dashboard and paste it into a plain-text editor first, to strip whitespace.
- If you have several projects, confirm the key belongs to the project you are sending from.
- Confirm the header reads
Bearer, one space, then the key, with no quotes around it. - Check Plunk's API docs for which key the send endpoint expects, and use that one.
Fix 4: Make sure production has the new value
- Print the host your app actually uses at startup (never the key).
- Compare local and production environment variables.
- Restart or redeploy so the service reloads them. Containers and serverless platforms often keep old values until the next deploy.
Keep the full key out of logs
When debugging, log the host and the last four characters of the key only. A full bearer token in a log file or support ticket is a leaked credential, and anyone holding it can use it.
Which cause do you have
| What you see | Likely cause | Fix |
|---|---|---|
Config or library default shows api.useplunk.com | Legacy host | Set base URL to next-api.useplunk.com |
| Old Upyo version, no custom URL | Library default | Upgrade to 0.4.1 or 0.5.1 |
| Correct host, key just re-copied, still 401 | Wrong key, project or header format | Fix 3 |
| Works on your laptop, fails in production | Stale environment variable | Update the secret and redeploy |
| curl to the new host works, app fails | App still uses the old host or library | Fix 1 or Fix 2 |
A quick isolation test: send the same request with curl to next-api.useplunk.com using your key. If curl succeeds, the key is fine and the problem is your app's host or library. If curl also fails, focus on the key.
Checklist before you try again
- The base URL is
next-api.useplunk.com, set in one place. - If you use Upyo, you are on 0.4.1, 0.5.1 or later.
- The key has no leading or trailing whitespace and no surrounding quotes.
- The header is
Authorization: Bearer {key}. - Production has been restarted since the variable changed.
Preventing a repeat
Keep the base URL in a single environment variable so a provider host change is a one-line edit. Read your email library's release notes when a provider announces an endpoint move. Alert on failed sends too, so an endpoint shutdown does not silently drop mail. A 401 from a provider will not fix itself.
If nothing works
Contact Plunk through the support channel in your dashboard or on their website. Include the full response body, the UTC timestamp of a failed request, the host you called, the last four characters of the key, and the fact that you already tried next-api.useplunk.com. If you use Upyo, add your exact version.
Subject: 401 "Incorrect Bearer token specified" on next-api.useplunk.com
Hello,
My send requests return:
{"code":401,"error":"Unauthorized","message":"Incorrect Bearer token specified"}
Host called: next-api.useplunk.com
Timestamp (UTC): {timestamp}
Key ending in: {last-4-characters}
Library and version: {library-and-version}
Already tried: re-copying the key, restarting the service, testing with curl.
Can you confirm the key is active for this API and which key the send endpoint expects?
Thanks
This is not a Mailneo problem; Plunk is not one of the providers Mailneo connects to, so we can't help with the error itself.
Common questions
Is my API key compromised if I get this 401?
Not by itself. A 401 on the wrong host usually means that host does not accept the key. If you pasted the key somewhere public while debugging, rotate it anyway.
Do I need a new key for next-api.useplunk.com?
The report says the same valid key worked once the host was changed, so you normally should not. If it still fails on the new host, create a fresh key in your dashboard and test with curl.
Why does the error say "Bearer token" when I only set an API key?
You send the key in the Authorization header using the Bearer scheme, so the server calls it a bearer token. RFC 6750 describes the Bearer scheme as intended primarily for server authentication through the Authorization header. It is the same value.
Will the legacy host keep working?
I can't verify that. Plan on the new host only, and watch Plunk's announcements for anything that changes it.
Explore: Email Marketing Strategy
Related Articles
ActiveCampaign n8n error 301 on create contact: causes and fixes
A 301 from the ActiveCampaign node means the request went to a URL that redirects, so start with the API URL in your n8n credential. Copy it from Settings, then Developer, and check the scheme and path. Zapier 403 and cURL error 28 behind Cloudflare have different causes, covered below.
"Stage not on allowlist": Apollo to HubSpot sync fix
The error "Stage not on allowlist" means the contact's Apollo stage is not on the list of stages permitted to push to HubSpot. Open the HubSpot integration in Apollo, go to the Sync tab, and add that stage under "Stages for push contacts". Lifecycle stage mapping is a separate setting.
Salesmate "Authorization with Gmail failed": Gmail IMAP fix
Salesmate shows "Authorization with Gmail failed" when it can't read your Gmail account over IMAP. In Gmail settings, enable IMAP, choose "Do not limit the number of messages in an IMAP folder", and show All Mail in IMAP. Then reconnect the account in Salesmate. Other causes are covered below.
AWeber export "Stop Status" and "Stop Time" columns explained
In an AWeber subscriber export, a non-empty Stop Time and a non-zero Stop Status most likely mean the person has stopped receiving your mail, usually because they unsubscribed. AWeber doesn't explain the columns in the file, so verify against a few known unsubscribes, then import those rows as blocked, not subscribed.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free