Troubleshooting2 min readUpdated Mar 22, 2026

Fixing Authentication Issues

TL;DR

Send your API key in the X-API-Key header (not Authorization). Make sure your email is verified and the key hasn't been regenerated.

Common Authentication Mistakes

Getting a 401 INVALID_API_KEY error? Work through this checklist:

**Wrong header name** — PriceFetch uses `X-API-Key`, not `Authorization`, not `Bearer`, not `Api-Key`. The header name is case-insensitive, but the value must be your exact API key.

**Using the key prefix instead of the full key** — the dashboard shows a prefix like `pf_live_abc1...` for display. Your actual key is longer. Copy the full key from the dashboard when you first create it. If you lost it, regenerate a new one.

**Email not verified** — API keys are only active after email verification. Check your inbox (and spam folder) for the verification email. Resend it from the dashboard if needed.

**Key was regenerated** — when you regenerate your API key, the old key is immediately invalidated. If you regenerated your key but your application still uses the old one, update it.

**Extra whitespace** — copy-paste sometimes adds leading/trailing spaces or newlines to the key. Trim your key value before setting it in your environment variables.

bash
# Correct usage
curl -H "X-API-Key: pf_live_your_full_key_here" \
  "https://api.pricefetch.dev/v1/price?url=https://www.amazon.com/dp/B0EXAMPLE"

# Common mistakes:
# Wrong header name
curl -H "Authorization: Bearer pf_live_..." ...   # WRONG
curl -H "Api-Key: pf_live_..." ...                 # WRONG

# Correct in Python
import requests
resp = requests.get(
    "https://api.pricefetch.dev/v1/price",
    params={"url": "https://www.amazon.com/dp/B0EXAMPLE"},
    headers={"X-API-Key": "pf_live_your_full_key_here"},
)

# Correct in Node.js
const resp = await fetch(
  "https://api.pricefetch.dev/v1/price?url=https://www.amazon.com/dp/B0EXAMPLE",
  { headers: { "X-API-Key": "pf_live_your_full_key_here" } }
);

API Key Security

Never hardcode your API key in source code. Use environment variables:

- **Python**: `os.environ["PRICEFETCH_API_KEY"]` - **Node.js**: `process.env.PRICEFETCH_API_KEY` - **Shell**: `export PRICEFETCH_API_KEY=pf_live_...`

Add `.env` to your `.gitignore`. If your key is accidentally committed to a public repo, regenerate it immediately from the dashboard. The old key is invalidated the moment you regenerate.

Use separate keys for development and production if your plan supports it. This way, revoking a compromised dev key doesn't break production.

Still stuck?

Our support team can help debug your integration.

Contact Support

Frequently asked questions

Start fetching prices — 500 free credits

Sign up in 30 seconds. No credit card required. One credit per successful API call.