I’m having a persistent authentication issue with the Market Data API that I haven’t been able to resolve after extensive troubleshooting.
Account type: Paper trading
Issue:
Requests to the Trading API (paper-api.alpaca.markets) authenticate successfully — I can retrieve account info and it works as expected.
However, requests to the Market Data API (data.alpaca.markets) consistently return a 401 Unauthorized error, but notably as a raw nginx HTML page rather than Alpaca’s standard JSON error format:
401 Authorization Required401 Authorization Required
nginx
Example failing request:
GET https://data.alpaca.markets/v2/stocks/bars?start=...&timeframe=1Day&symbols=AAPL&limit=10000
What I’ve already tried:
- Regenerated my API key/secret pair from the dashboard and tested with fresh credentials — same result
- Verified the same credentials work correctly against the Trading API
- Confirmed I’m not using a paid data feed and don’t believe one should be required for basic IEX historical bars
- Upgraded to the latest alpaca-py Python SDK version
- Verified network connectivity to data.alpaca.markets (server responds, just rejects auth)
- Tested using the official alpaca-py client library (StockHistoricalDataClient)
I’d appreciate any insight into why this specific endpoint would reject valid, working credentials.