Perplexity Error 401 – How to Fix Unauthorized Error

PerplexityErrors & BugsUpdated May 17, 2026
Quick Answer

Perplexity error 401 means Unauthorized — your session has expired or your API key is invalid. For web users, log out at perplexity.ai/settings/account, clear cookies, and log back in. For API users, check that your key is active at perplexity.ai/settings/api and that you are sending it as a Bearer token in the Authorization header. A 401 error is never caused by Perplexity's servers — it is always an authentication issue on your end.

Step-by-Step Fix

Step 1. Confirm You Are Seeing a 401 Error

A Perplexity 401 error may appear as:

  • The exact text "401 Unauthorized"
  • "You are not authorized to access this resource"
  • "Authentication required"
  • A redirect back to the Perplexity login page mid-session

If you are an API user, the JSON response body will typically contain "status": 401 and a message like "detail": "Invalid authentication credentials".

Do not confuse 401 with 403 — 401 means you are not authenticated at all, while 403 means you are authenticated but not permitted. The fixes are different.

Step 2. Fix for Web Users — Log Out and Log Back In

The fastest fix for web users is to fully log out and create a fresh session.

  1. Go to perplexity.ai/settings/account
  2. Scroll to the bottom and click Log Out
  3. Close the tab and open a completely new tab
  4. Clear your cookies for perplexity.ai:
    • Chrome/Edge: Ctrl+Shift+Delete → Cookies → Clear
    • Firefox: Ctrl+Shift+Delete → Cookies → Clear Now
    • Safari: Settings → Privacy → Manage Website Data → remove perplexity.ai
  5. Navigate to perplexity.ai and log in again with your credentials
  6. Test a search query to confirm the 401 error is resolved

This process regenerates a fresh authentication token and eliminates any corrupted session state.

Step 3. Fix for API Users — Verify and Reformat Your API Key

If you are using the Perplexity API and receiving 401 errors, follow these checks in order:

Check 1: Verify your API key is active

  1. Go to perplexity.ai/settings/api
  2. Confirm the key you are using appears in the list and is not revoked
  3. If the key is missing or revoked, generate a new one

Check 2: Verify Bearer token format

Your Authorization header must be exactly:

Authorization: Bearer pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Common mistakes that cause 401:

  • Authorization: pplx-xxxx (missing "Bearer")
  • Authorization: bearer pplx-xxxx (lowercase b — must be capital B)
  • Authorization: Bearer "pplx-xxxx" (quotes around the key — do not include quotes)
  • X-API-Key: pplx-xxxx (wrong header name — Perplexity uses Authorization, not X-API-Key)

Check 3: Send a minimal test request

Test with curl to isolate whether the issue is your key or your code:

curl -X POST https://api.perplexity.ai/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"model":"llama-3.1-sonar-small-128k-online","messages":[{"role":"user","content":"Hello"}]}'

If this returns a 200 response, your key is valid and the problem is in your application code. If it returns 401, the key itself is invalid — generate a new one.

Step 4. Regenerate Your API Key

If your API key is confirmed invalid or you cannot locate it:

  1. Go to perplexity.ai/settings/api
  2. Click Generate New Key
  3. Copy the key immediately — it will only be shown once in full
  4. Update the key in your application, environment variables, or .env file
  5. Do not hardcode the key in source code; store it in an environment variable like PPLX_API_KEY

Step 5. Check for Browser Extension or Cookie Interference (Web Users)

If logging out and back in does not resolve the 401 error:

  1. Open Perplexity in an incognito/private window with extensions disabled
  2. Try to log in and use Perplexity normally
  3. If it works in incognito: a browser extension is modifying your cookies or request headers
  4. Disable extensions one at a time in your normal browser to identify the culprit
  5. Common offenders: Cookie AutoDelete, Privacy Cleaner, VPN browser extensions, header modifier extensions

Why This Happens

A 401 Unauthorized error occurs because Perplexity's server cannot confirm who you are. Every request to Perplexity — whether a web search or an API call — must include a valid credential: either a session cookie (web) or an API key (API). When that credential is missing, expired, or malformed, the server returns 401 and refuses the request.

Session cookies expire naturally after inactivity periods. API keys can be revoked manually, expire if the associated account has payment issues, or become invalid if copied incorrectly. The 401 error means no part of Perplexity's infrastructure is broken — the fix is always to provide a valid credential.


Common Mistakes to Avoid

  • Assuming 401 means Perplexity is down — a 401 error is never a server outage. It is always an authentication issue. Checking the status page will show everything operational.
  • Forgetting to include "Bearer" in the API Authorization header — the word Bearer is required. Omitting it is the single most common API integration mistake and produces an immediate 401.
  • Copying an API key with extra spaces or line breaks — when copying from a browser, it is easy to accidentally include a trailing space. Always trim whitespace from your API key before use.
  • Storing API keys in source code — hardcoding API keys means they can be accidentally committed to version control. If a key is exposed this way, revoke it immediately and generate a new one.
  • Trying to refresh the page instead of logging out — a refresh does not clear an expired session token. You must fully log out and log back in to get a fresh authentication cookie.
  • Generating a new API key without updating it in your application — a fresh key does nothing if your application is still using the old revoked key. After generating a new key, update every location where the key is stored: environment variables, config files, CI/CD secrets, and any deployed instances.
  • Using an API key from a different Perplexity account — if you have multiple Perplexity accounts, make sure the API key you are using belongs to the account with an active paid subscription. API access on Perplexity requires a Pro or API subscription.

Perplexity 401 vs 403: What Is the Difference?

It is easy to confuse these two errors. Here is the key distinction:

  • 401 Unauthorized: Perplexity cannot verify who you are. You have not provided credentials, or the credentials you provided are invalid or expired. Fix: authenticate (log in or provide a valid API key).
  • 403 Forbidden: Perplexity knows who you are, but you are not permitted to access the requested resource. Fix: check your subscription level, account status, or region.

If your error alternates between 401 and 403, start with the 401 fix (log in / refresh credentials) — a 403 after a successful login points to a permission issue, not an authentication issue.


When to Contact Perplexity Support

Contact support@perplexity.ai if:

  • You have completed all steps above and still receive 401 errors while logged in
  • Your API key shows as active in the dashboard but returns 401 in API calls
  • Your account was recently migrated, merged, or changed (for example, switching from Google login to email/password)
  • You suspect your account has been locked or flagged

Include your account email, the exact error response, and the steps you have already tried.


View all Perplexity guides

Perplexity · Errors & Bugs

More Perplexity errors & bugs guides

Browse all guides in this category to troubleshoot related issues faster.

Browse all guides →

Frequently Asked Questions

HTTP 401 Unauthorized means Perplexity's server received your request but could not verify your identity. For web users this happens when your login session has expired, your browser cookie was corrupted, or you were automatically logged out. For API users, 401 means the API key in your request is missing, expired, revoked, or formatted incorrectly. The 401 code is defined in the HTTP standard as an authentication failure — it has nothing to do with Perplexity's server health or availability.

Related Guides

Continue with nearby guides in the same topic to rule out adjacent causes faster.

Perplexity Citations Not Loading or Sources Missing – How to Fix

Perplexity citations fail to load in over 70% of cases because an ad blocker or privacy extension is blocking the source-fetching requests that run alongside the AI response. Disable your ad blocker (uBlock Origin, AdGuard, Ghostery) for perplexity.ai, reload the page, and run your query again — citations should appear as numbered blue links below the answer. If the problem continues, switch from Pro Search to Standard Search as a quick test, then clear your browser cache.

Perplexity Error 403 – How to Fix Forbidden Error

Perplexity error 403 means Forbidden — your request was understood but blocked. The three most common causes are: regional restrictions (Perplexity is unavailable in some countries), account-level restrictions (your account was flagged or your subscription lapsed), and content policy blocks (the specific query was rejected). Start by disconnecting any VPN, then checking your account status at perplexity.ai/settings/account, then clearing cookies and logging back in.

Perplexity Error 500 – How to Fix Internal Server Error

Perplexity error 500 is an Internal Server Error — the problem is entirely on Perplexity's servers, not your device or network. There is no local fix. Check perplexity.ai/status to see if an incident is active, then wait 5 to 15 minutes before retrying. Most Perplexity 500 errors resolve automatically within 15 minutes as the server recovers. If the error persists beyond 30 minutes, report it at perplexity.ai/contact.

Perplexity Error in Processing Query: Causes and Fixes

The 'Error in Processing Query' message on Perplexity appears when your query is too long or complex for the model to process, contains phrasing that triggers content filters, or when a backend service times out mid-response. The fastest fix is to shorten your query to under 500 characters, remove ambiguous or sensitive phrasing, and resubmit. If the error persists across multiple queries, check perplexity.ai/status for an ongoing service incident.

Perplexity Error Messages – What They Mean and How to Fix

Perplexity error messages fall into three groups: rate limit errors (too many requests — wait 60 seconds or upgrade your plan), service errors (something went wrong, network error — refresh the page or check perplexity.ai/status), and query errors (error processing query, content policy — rephrase or shorten your search). The fix depends on which error you see. This guide covers the 10 most common Perplexity error messages with specific solutions for each.

Perplexity 'Something Went Wrong': API Failures and Service Timeouts Fixed

The 'Something Went Wrong' error on Perplexity signals a technical failure in the backend — typically an API call failure, model endpoint timeout, or web retrieval service error — rather than a user-facing input problem. This error is distinct from the generic 'Error in Processing Query' message, which usually involves query content. For 'Something Went Wrong,' wait 30 to 60 seconds and retry; if the error persists for more than 5 minutes, check perplexity.ai/status for an active incident.