I’m quite new to alpaca and i tried to get my postions but it did not work so i tried this:
import requests
# Replace with your own Alpaca API key and secret
APCA_API_KEY_ID = 'API-KEY'
APCA_API_SECRET_KEY = 'SECRET-KEY'
import requests
from config import *
url = 'https://api.alpaca.markets/v2/account'
headers = {
'APCA-API-KEY-ID': APCA_API_KEY_ID,
'APCA-API-SECRET-KEY': APCA_API_SECRET_KEY
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
account_info = response.json()
print(f"Account ID: {account_info['id']}, Status: {account_info['status']}")
else:
print(f"Error: {response.status_code} - {response.text}")
I know i am using the correct api keys. but im still gettin Error: 403.
If anyone can help i thank you in advance.