Yet another 403 error...please help a newbie

Here is the faulty code

from credentials import AlpacaConfig
import alpaca_trade_api as tradeapi

alpaca = tradeapi.REST(key_id=AlpacaConfig.API_KEY,secret_key=AlpacaConfig.API_SECRET,base_url=AlpacaConfig.ENDPOINT, api_version=‘v2’)

Fetch Account

account = alpaca.get_account()

and then
HTTPError: 403 Client Error: Forbidden for url: https://broker-api.sandbox.alpaca.markets/v2/account

Solved,
I created an account on broker-app by ignorance. I ask for a deletion and created a new one on
https://app.alpaca.markets/.
It works directly.
Thanks

How did you solve it?

i have same it

@Will_Caster A 403 error is almost always using an incorrect API key or secret key. First ensure you are accessing the trading APIs and NOT the broker APIs. Next, ensure you are using the correct live or paper API keys (ie not using the paper account keys when accessing a live account) and finally, ensure you are using the most current API keys. Paper account keys get reset when the account is reset, so if the paper account was reset recently you will need to regenerate the keys and then use those new keys.

Try the following request. It fetches account info for a demo account. If you can get that to respond, then replace the API key and secret key with your own paper account keys. That should then return info for your account. If you get a forbidden error then either your key or secret key are incorrect.

curl --location 'https://paper-api.alpaca.markets/v2/account' \
--header 'APCA-API-KEY-ID: PKZ4HPYI4PMMCXZ4XEIS' \
--header 'APCA-API-SECRET-KEY: J3sV2W1nGK4PchSxb2jR1g5daSovyFcqLbgAABxB'

Does that help?