Getting forbidden as a response whenever hitting the Market Data api

When I attempt to get historical market data it says “forbidden”, even though I have tried using the API keys via both basic auth and using the headers you recommended, and neither worked. Any idea what the problem is?

The broker API has been working with no issues, so it’s a bit odd that it’s been so difficult to get market data to work. Any suggestions?

Hey @chrono58, sorry for taking long to reply.

‘Forbidden’ errors typically occur when using your API keys in the environment (domain). It will help to know the endpoint you’re hitting (with the complete URL).

For eg: With the Broker API, kindly make sure to use this domain: https://data.sandbox.alpaca.markets/v2 to access historical data in sandbox