alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
143 stars 13 forks source link

401 Client Error: Unauthorized for URL #117

Closed jho closed 4 years ago

jho commented 4 years ago

Getting 401 Client Error Unauthorized URL trying to get data from polygon using the backtrader integration. Same API key I was using just a day or two ago and it was working fine. I've tried generating new API keys but nothing seems to work.

401 Client Error: Unauthorized for url: https://api.polygon.io/v2/aggs/ticker/SPXS/range/1/day/2012-01-01/2020-04-06?unadjusted=False&apiKey=MY_API_KEY_REDACTED

If I switch to paper trading mode. I get the following:

ValueError: Invalid Polygon credentials, Failed to authenticate: {'ev': 'status', 'status': 'auth_failed', 'message': 'authentication failed'}

umitanuki commented 4 years ago

Please make sure you are using the correct API key for your current live trading account (or paper account associated with it). API key with the legacy accounts is no longer working as they are decommissioned as previously communicated.

jho commented 4 years ago

Not sure what a legacy account is but like I said I just regenerated the keys in my account from the dashboard and still get this error.