# Forbidden here, forbidden there

**URL:** <https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255>\
**Category:** App-Integration\
**Created:** [October 29, 2021, 6:49pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255 "2021-10-29T18:49:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcshakes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/mcshakes/32/2458_2.png) [@mcshakes](https://forum.alpaca.markets/u/mcshakes)\
**Post date:** [October 29, 2021, 6:49pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/1 "2021-10-29T18:49:51Z")

</div>

This is the message I’m always getting:

`{'message': 'forbidden.'}`

Whether I use my paper trading API Keys or the ones I got from OAuth Developer apps. Either way, the docs are unclear as to which keys I should use when trying to query simple data API. Endpoint:

`https://data.alpaca.markets/v1/last/stocks/{symbol}`  
`https://data.alpaca.markets/v2/last/stocks/{symbol}`

What am I doing wrong? Which keys should I be using?

---

<div class="post-metadata">

**Author:** ![oleg.rakhmatulin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/oleg.rakhmatulin/32/559_2.png) [@oleg.rakhmatulin](https://forum.alpaca.markets/u/oleg.rakhmatulin)\
**Post date:** [October 31, 2021, 11:31am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/2 "2021-10-31T11:31:30Z")

</div>

[Version 1](https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v1/) of the Data API is forbidden. Just use the [version 2](https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/) endpoints. But some URL for the v2 endpoints is different. For instance, the [latest trade](https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/historical/#returns-latest-trade-for-the-queried-stock-symbol) endpoint URL in v2 looks like this:

`https://data.alpaca.markets/v2/stocks/{symbol}/trades/latest`

---

<div class="post-metadata">

**Author:** ![mcshakes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/mcshakes/32/2458_2.png) [@mcshakes](https://forum.alpaca.markets/u/mcshakes)\
**Post date:** [November 3, 2021, 3:40am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/3 "2021-11-03T03:40:04Z")

</div>

No dice. Still says forbidden. Should I be using the keys from my paper wallet or the API keys that I created during App creation? Either way, both are giving me 403 Forbidden

---

<div class="post-metadata">

**Author:** ![algorithmatic](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@algorithmatic](https://forum.alpaca.markets/u/algorithmatic)\
**Post date:** [November 13, 2021, 11:36pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/4 "2021-11-13T23:36:38Z")

</div>

I have the same thing.  
v2  
Was working fine a few months ago and now forbidden for both paper and live keys.

It’s one thing to have code that doesn’t work, but for the hist feed to break randomly is unacceptable especially when I pay for the unlimited plan for rt feed.  
I’m not aware of any breaking changes for v2 over the last few months. Isn’t part of versioning meant to address breaking changes?

---

<div class="post-metadata">

**Author:** ![Z223I](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/z223i/32/3390_2.png) [@Z223I](https://forum.alpaca.markets/u/Z223I)\
**Post date:** [December 5, 2021, 6:31pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/5 "2021-12-05T18:31:48Z")

</div>

I too have the same problem.

---

<div class="post-metadata">

**Author:** ![jjphung](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jjphung/32/3679_2.png) [@jjphung](https://forum.alpaca.markets/u/jjphung)\
**Post date:** [February 10, 2022, 7:07am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/6 "2022-02-10T07:07:45Z")

</div>

Bump. Same thing. Anyone have a solution?

---

<div class="post-metadata">

**Author:** ![Radzi\_Purba\_LPCA](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/radzi_purba_lpca/32/4297_2.png) [@Radzi\_Purba\_LPCA](https://forum.alpaca.markets/u/Radzi_Purba_LPCA)\
**Post date:** [February 10, 2022, 8:14am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/7 "2022-02-10T08:14:45Z")

</div>

@jjphung @Z223I

Hello guys.  
The paper ID API, should use the sandbox endpoint, not the live one.  
here is the sandbox endpoint: `https://data.sandbox.alpaca.markets/v2`

The details, can be found here:

> **[Stock Pricing API](https://alpaca.markets/docs/api-references/market-data-api/stock-pricing-data/)**
>
> Alpaca Market Data API provides real-time & 5+ years of historical stock pricing data.

Thank you

---

<div class="post-metadata">

**Author:** ![Radzi\_Purba\_LPCA](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/radzi_purba_lpca/32/4297_2.png) [@Radzi\_Purba\_LPCA](https://forum.alpaca.markets/u/Radzi_Purba_LPCA)\
**Post date:** [February 10, 2022, 8:16am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/8 "2022-02-10T08:16:12Z")

</div>

@algorithmatic @mcshakes

---

<div class="post-metadata">

**Author:** ![Radzi\_Purba\_LPCA](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/radzi_purba_lpca/32/4297_2.png) [@Radzi\_Purba\_LPCA](https://forum.alpaca.markets/u/Radzi_Purba_LPCA)\
**Post date:** [February 10, 2022, 8:16am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/9 "2022-02-10T08:16:45Z")

</div>

@oleg.rakhmatulin

please look at my answer above

---

<div class="post-metadata">

**Author:** ![asqsh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/asqsh/32/3443_2.png) [@asqsh](https://forum.alpaca.markets/u/asqsh)\
**Post date:** [February 16, 2022, 7:09pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/10 "2022-02-16T19:09:12Z")

</div>

> [@Radzi\_Purba\_LPCA](#):
>
> The paper ID API, should use the sandbox endpoint, not the live one.  
> here is the sandbox endpoint: `https://data.sandbox.alpaca.markets/v2`

I am having the same issue right now.

Also I have to mention it HAS worked before with “[//data.alpaca.markets](https://data.alpaca.markets)”

I am on a paid plan.

I am using JS API as well as my requests saved in Postman - also with new Api Key/Secret

Is there any way to get appropriate support? “Contact” page refers to this forum and “Community” slack is currently only for Alpaca employees?

---

<div class="post-metadata">

**Author:** ![asqsh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/asqsh/32/3443_2.png) [@asqsh](https://forum.alpaca.markets/u/asqsh)\
**Post date:** [February 16, 2022, 7:23pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/11 "2022-02-16T19:23:36Z")

</div>

Also, I want to mention that the documentation states the following ( for example for crypto)

> **Base URL**
> 
> The Crypto Data API provides historical data through multiple endpoints. These endpoints have the same URL prefix (omitted from now on):
> 
> ```auto
> https://data.alpaca.markets/v1beta1/crypto
> 
> ```
> 
> This URL is the **same for both subscription plans** , there is no limitation
> 
> ### **Authentication** [#](https://alpaca.markets/docs/api-references/market-data-api/crypto-pricing-data/#authentication)
> 
> The authentication is done the same way as with the Trading API, simply set the following HTTP headers:
> 
> - `APCA-API-KEY-ID`
> - `APCA-API-SECRET-KEY`

Also, when looking at the source code of the api, there is no difference if paper/live when using Market Data Api

I expect a more qualified answer to this issue.

---

<div class="post-metadata">

**Author:** ![asqsh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/asqsh/32/3443_2.png) [@asqsh](https://forum.alpaca.markets/u/asqsh)\
**Post date:** [February 16, 2022, 11:52pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/12 "2022-02-16T23:52:53Z")

</div>

Was able to solve this by regenerating keys.

Might have been a simple copy/paste error in my case - and if so, foolishly multiple times

---

<div class="post-metadata">

**Author:** ![Jake\_London](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jake_london/32/3968_2.png) [@Jake\_London](https://forum.alpaca.markets/u/Jake_London)\
**Post date:** [March 23, 2022, 7:27pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/13 "2022-03-23T19:27:39Z")

</div>

I’m getting {“message”: “forbidden.”} on the python SDK, Postman and on my own simplified python connector. I get the same error when connecting to endpoints on api.alpaca.markets/v2; data.alpaca.markets/v2; data.sandbox.alpaca.markets/v2.

I’ve refreshed my keys.

What am I doing wrong? How do you connect to Alpaca via python?

---

<div class="post-metadata">

**Author:** ![adamhenson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/adamhenson/32/2220_2.png) [@adamhenson](https://forum.alpaca.markets/u/adamhenson)\
**Post date:** [April 22, 2022, 10:54am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/14 "2022-04-22T10:54:41Z")

</div>

Hello - this just started happening to me. It has been working fine for the past couple weeks. I have a paid plan and am actively using the API, however if I was hitting some rate limit, I would expect a different response. Also, the forbidden response has repeated over the past hour. Wondering if Alpaca is under maintenance again. I’ve noticed the status page is not always accurate.

I would like reals customer support to look into my account or at least a way to report an incident. Any ideas?

---

<div class="post-metadata">

**Author:** ![adamhenson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/adamhenson/32/2220_2.png) [@adamhenson](https://forum.alpaca.markets/u/adamhenson)\
**Post date:** [April 22, 2022, 11:00am UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/15 "2022-04-22T11:00:45Z")

</div>

Turns out, if you reset your paper account balance - it also deletes your API keys. I should have figured that out sooner. Anyways, that’s what happened to me. Hope it helps someone.

---

<div class="post-metadata">

**Author:** ![fa7ali7yX](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@fa7ali7yX](https://forum.alpaca.markets/u/fa7ali7yX)\
**Post date:** [May 7, 2022, 4:45pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/16 "2022-05-07T16:45:51Z")

</div>

Hi All,

I’m still getting the forbidden error, ‘b’{“message”: “forbidden.”}\n’, when trying to connect to the API using regular requests or using the SDK. Not sure what is wrong… I’ve tried regenerating my API keys multiple times.

Any help is appreciated.

Here is my attempt to access the account endpoint:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/2X/f/f0e0609ec05b0371deb7b65ae3b32e34c324d56c.png)

---

<div class="post-metadata">

**Author:** ![fa7ali7yX](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@fa7ali7yX](https://forum.alpaca.markets/u/fa7ali7yX)\
**Post date:** [May 7, 2022, 5:08pm UTC](https://forum.alpaca.markets/t/forbidden-here-forbidden-there/7255/17 "2022-05-07T17:08:58Z")

</div>

Figured it out using the SDK. Still curious why the request straight to the end point didn’t work though. As a nooby I’d love to understand.

Anyways, here is what worked for me:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/2X/9/92617589de95d592250cb6432d08098f4ef9c297.png)
