# HTTP Error on get\_barset

**URL:** <https://forum.alpaca.markets/t/http-error-on-get-barset/8811>\
**Category:** Alpaca Account Troubleshooting\
**Created:** [March 17, 2022, 2:19pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811 "2022-03-17T14:19:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_McGuigan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ryan_mcguigan/32/2882_2.png) [@Ryan\_McGuigan](https://forum.alpaca.markets/u/Ryan_McGuigan)\
**Post date:** [March 17, 2022, 2:19pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/1 "2022-03-17T14:19:26Z")

</div>

New error this morning. I am live trading. This has worked every other day prior.

My code is python 3.9  
I am using alpaca trade api 1.4.1

This morning get\_barset is not working. It returned an HTTP error.

Here is the code snippet:  
quote = conn\_rest.get\_barset(‘IVV’, limit=1, timeframe=‘minute’)

Here is the error message:  
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: [https://data.alpaca.markets/v1/bars/minute?symbols=IVV&limit=1](https://data.alpaca.markets/v1/bars/minute?symbols=IVV&limit=1)

---

<div class="post-metadata">

**Author:** ![Hudson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hudson/32/3663_2.png) [@Hudson](https://forum.alpaca.markets/u/Hudson)\
**Post date:** [March 17, 2022, 2:29pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/2 "2022-03-17T14:29:30Z")

</div>

I’m seeing a similar error here: [New Errors with no changes](https://forum.alpaca.markets/t/new-errors-with-no-changes/8812)  
Glad to see I’m not the only one. Must be a widespread issue.

---

<div class="post-metadata">

**Author:** ![Tekton](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@Tekton](https://forum.alpaca.markets/u/Tekton)\
**Post date:** [March 17, 2022, 2:34pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/3 "2022-03-17T14:34:58Z")

</div>

I’m getting the same error.

---

<div class="post-metadata">

**Author:** ![kevin\_wild](https://avatars.discourse-cdn.com/v4/letter/k/d26b3c/32.png) [@kevin\_wild](https://forum.alpaca.markets/u/kevin_wild)\
**Post date:** [March 17, 2022, 2:40pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/4 "2022-03-17T14:40:52Z")

</div>

Yeah I am experiencing the same issue.

---

<div class="post-metadata">

**Author:** ![Guuu\_Ofggg](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/guuu_ofggg/32/3926_2.png) [@Guuu\_Ofggg](https://forum.alpaca.markets/u/Guuu_Ofggg)\
**Post date:** [March 17, 2022, 3:32pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/5 "2022-03-17T15:32:45Z")

</div>

I have the same error, it is not working .Python 3.8 ad Alpaca API 1.4.1

This is my code  
base\_url = ‘[https://paper-api.alpaca.markets/](https://paper-api.alpaca.markets/)’  
api = alpaca.REST(api\_key, api\_secret, base\_url, api\_version=‘v2’)  
pepe=api.get\_barset(“AAPL”, ‘minute’, 1)

For any reason api\_get\_barset is calling v1  
Raise HTTPError(http\_error\_msg, response=self)  
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: [https://data.alpaca.markets/v1/bars/minute?symbols=AAPL&limit=1](https://data.alpaca.markets/v1/bars/minute?symbols=AAPL&limit=1)

Actually it was in the documentation, 🙂 this works for me.  
pepe=api.get\_bars(“AAPL”, TimeFrame.Minute, limit=1,adjustment=‘raw’)

---

<div class="post-metadata">

**Author:** ![seaflow](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@seaflow](https://forum.alpaca.markets/u/seaflow)\
**Post date:** [March 17, 2022, 4:00pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/6 "2022-03-17T16:00:40Z")

</div>

I see the same error today on get\_barset!

---

<div class="post-metadata">

**Author:** ![gggovroom](https://avatars.discourse-cdn.com/v4/letter/g/e9a140/32.png) [@gggovroom](https://forum.alpaca.markets/u/gggovroom)\
**Post date:** [March 17, 2022, 5:47pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/7 "2022-03-17T17:47:36Z")

</div>

I read on another forum that v1 has been deprecated as of March 17.

Cheers.

---

<div class="post-metadata">

**Author:** ![karl.dreyerjr](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@karl.dreyerjr](https://forum.alpaca.markets/u/karl.dreyerjr)\
**Post date:** [March 17, 2022, 6:04pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/8 "2022-03-17T18:04:49Z")

</div>

same here … invalid endpoint for both v1 and v2

---

<div class="post-metadata">

**Author:** ![karl.dreyerjr](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@karl.dreyerjr](https://forum.alpaca.markets/u/karl.dreyerjr)\
**Post date:** [March 17, 2022, 6:05pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/9 "2022-03-17T18:05:31Z")

</div>

Ah, that could be it. I missed that. I’ll try v2 again and see if that works

---

<div class="post-metadata">

**Author:** ![Ryan\_McGuigan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ryan_mcguigan/32/2882_2.png) [@Ryan\_McGuigan](https://forum.alpaca.markets/u/Ryan_McGuigan)\
**Post date:** [March 17, 2022, 8:05pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/10 "2022-03-17T20:05:09Z")

</div>

It was the depreciation. Use .get\_bars instead.

Working code is: conn\_rest.get\_bars(‘IVV’, ‘1Min’, limit=1)

---

<div class="post-metadata">

**Author:** ![Hudson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hudson/32/3663_2.png) [@Hudson](https://forum.alpaca.markets/u/Hudson)\
**Post date:** [March 17, 2022, 8:47pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/11 "2022-03-17T20:47:41Z")

</div>

Hey Ryan! Appreciate you diving into this! The error I receive when trying to move my stuff to get\_bars over get\_barset is:

“invalid start”

Not sure what that means or how to fix an error such as that. Not giving me much information.

---

<div class="post-metadata">

**Author:** ![KD\_A](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kd_a/32/3431_2.png) [@KD\_A](https://forum.alpaca.markets/u/KD_A)\
**Post date:** [March 17, 2022, 8:53pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/12 "2022-03-17T20:53:48Z")

</div>

Thanks for that response. It worked.

---

<div class="post-metadata">

**Author:** ![Kyley](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kyley/32/2927_2.png) [@Kyley](https://forum.alpaca.markets/u/Kyley)\
**Post date:** [March 17, 2022, 8:55pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/13 "2022-03-17T20:55:05Z")

</div>

I attempted to run your example and it required start and end points. After doing so it states that it needs a value instead of a string for timeframe. When i get rid of the quotes my python reader throws an error saying invalid syntax.

any help is appreciated.

---

<div class="post-metadata">

**Author:** ![KD\_A](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kd_a/32/3431_2.png) [@KD\_A](https://forum.alpaca.markets/u/KD_A)\
**Post date:** [March 17, 2022, 8:57pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/14 "2022-03-17T20:57:02Z")

</div>

In the definition of get\_bars(), start is an argument. What you are passing is invalid for that argument.  
Also, it is important to specify the limit argument as in the example “limit=1”.

def get\_bars(self,  
symbol: Union[str, List[str]],  
timeframe: TimeFrame,  
start: Optional[str] = None,  
end: Optional[str] = None,  
adjustment: str = ‘raw’,  
limit: int = None,  
) → BarsV2:

---

<div class="post-metadata">

**Author:** ![Ryan\_McGuigan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ryan_mcguigan/32/2882_2.png) [@Ryan\_McGuigan](https://forum.alpaca.markets/u/Ryan_McGuigan)\
**Post date:** [March 17, 2022, 9:06pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/15 "2022-03-17T21:06:37Z")

</div>

This is probably it. Paste your code Hudson, if not.

---

<div class="post-metadata">

**Author:** ![KD\_A](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kd_a/32/3431_2.png) [@KD\_A](https://forum.alpaca.markets/u/KD_A)\
**Post date:** [March 18, 2022, 4:08am UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/16 "2022-03-18T04:08:13Z")

</div>

> [@Ryan\_McGuigan](#):
>
> conn\_rest.get\_bars(‘IVV’, ‘1Min’, limit=1)

If you do not need to specify start and end points, don’t. Those arguments are optional.  
Use Ryan’s code as close as possible.

1. Replace the symbol to what you want
2. Replace conn\_rest with whatever is appropriate for your code.

Paste your code if you need further help

---

<div class="post-metadata">

**Author:** ![Hamid\_Gholizadegan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hamid_gholizadegan/32/3842_2.png) [@Hamid\_Gholizadegan](https://forum.alpaca.markets/u/Hamid_Gholizadegan)\
**Post date:** [March 18, 2022, 6:45am UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/17 "2022-03-18T06:45:46Z")

</div>

if we want to switch to get\_bars the issue is timestamp is from 8 am to 23 which doesn’t make sense. And the market time is from 12:30 to 20

---

<div class="post-metadata">

**Author:** ![redac7](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@redac7](https://forum.alpaca.markets/u/redac7)\
**Post date:** [March 18, 2022, 1:28pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/18 "2022-03-18T13:28:38Z")

</div>

I’m probably doing something dumb on my part, I’m still stuck this is what I’m seeing:

> > > barset = api\_v2.get\_bars(‘AAPL’, “1Min”, limit=1)  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > TypeError: get\_bars() missing 2 required positional arguments: ‘start’ and ‘end’

---

<div class="post-metadata">

**Author:** ![Ryan\_McGuigan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ryan_mcguigan/32/2882_2.png) [@Ryan\_McGuigan](https://forum.alpaca.markets/u/Ryan_McGuigan)\
**Post date:** [March 18, 2022, 1:45pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/19 "2022-03-18T13:45:29Z")

</div>

Is api\_v2 your rest connection?

---

<div class="post-metadata">

**Author:** ![redac7](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@redac7](https://forum.alpaca.markets/u/redac7)\
**Post date:** [March 18, 2022, 1:52pm UTC](https://forum.alpaca.markets/t/http-error-on-get-barset/8811/20 "2022-03-18T13:52:23Z")

</div>

yes:

> > > api\_v2 = tradeapi.REST(APCA\_API\_KEY\_ID, APCA\_API\_SECRET\_KEY, api\_version=‘v2’)

does that look right? I’ll ask but I should also look this up as well any method I could run to verify I’m using the correct version like:  
api\_v2.show\_version()

[Next page](https://forum.alpaca.markets/t/http-error-on-get-barset/8811.md?page=2)
