# Getting a Client Error: Unauthorized for url error

**URL:** <https://forum.alpaca.markets/t/getting-a-client-error-unauthorized-for-url-error/4660>\
**Category:** Getting Started with Alpaca\
**Created:** [February 26, 2021, 4:58pm UTC](https://forum.alpaca.markets/t/getting-a-client-error-unauthorized-for-url-error/4660 "2021-02-26T16:58:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yotama9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/yotama9/32/2195_2.png) [@yotama9](https://forum.alpaca.markets/u/yotama9)\
**Post date:** [February 26, 2021, 4:58pm UTC](https://forum.alpaca.markets/t/getting-a-client-error-unauthorized-for-url-error/4660/1 "2021-02-26T16:58:46Z")

</div>

Hi,

I’m getting started with the Alpaca API. I’ve created a paper account about an hour ago and I’m trying to setup a simple python script. I’ve been getting an the `401 Client Error: Unauthorized for url` and the `access key verification failed : access key not found (Code = 40110000)` errors, and I cannot figure out why. My code is straight forward:

```
import alpaca_trade_api as tradeapi

base_url = 'https://paper-api.alpaca.markets'
api_key_id = 'api_key_id'
api_secret = 'api_secret'

api = tradeapi.REST(
    key_id=api_key_id,
    secret_key=api_secret,
    base_url=base_url,
    api_version='v2'
)

account = api.get_account()
print(account)

```

I’m not a US resident, but as far as I can tell, this should work for a paper account, shouldn’t it?

---

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://forum.alpaca.markets/u/Peter)\
**Post date:** [February 26, 2021, 6:19pm UTC](https://forum.alpaca.markets/t/getting-a-client-error-unauthorized-for-url-error/4660/2 "2021-02-26T18:19:52Z")

</div>

I tested your code with my own paper keys and it worked. Are you sure you are using the keys from your paper account, not your live account? Also, the keys reset whenever you reset your paper account, so maybe that’s what did it? In any case, I’d try resetting your paper account and then grabbing your keys again.

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

---

<div class="post-metadata">

**Author:** ![yotama9](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/yotama9/32/2195_2.png) [@yotama9](https://forum.alpaca.markets/u/yotama9)\
**Post date:** [February 26, 2021, 6:32pm UTC](https://forum.alpaca.markets/t/getting-a-client-error-unauthorized-for-url-error/4660/3 "2021-02-26T18:32:43Z")

</div>

Ugh! This is embarrassing. I was looking at the app credential and not the trade credential. Thanks! Your screenshot explained where I was wrong.
