Hi there, i am new to alpaca, i am trying to sign trade agreement but getting the following response:
Status: 404
Response: Not Found
using the following code.
import requests
with open(“D:/trade/key.txt”, “r”) as f:
API_KEY, API_SECRET = f.read().splitlines()
account_id = “xxxxxxxxx”
Static payload with crypto agreement details
payload = {
“agreements”: [
{
“agreement”: “crypto_agreement”,
“signed_at”: “2025-05-27T19:38:44Z”,
“ip_address”: “x.x.x.x”
}
]
}
Correct endpoint for updating existing user with crypto agreement
url = f"https://api.alpaca.markets/v1/accounts/{account_id}"
Authorization headers
headers = {
“APCA-API-KEY-ID”: API_KEY,
“APCA-API-SECRET-KEY”: API_SECRET,
“Content-Type”: “application/json”
}
Submit the request to Alpaca
try:
response = requests.patch(url, headers=headers, json=payload)
print(“ Status:”, response.status_code)
print(“ Response:”, response.text)
except Exception as e:
print(“ Error:”, str(e))
Please help