Hi, I’ve been messing around with the trade api, and I’ve continued to get the error (Searched the forum couldn’t find anything):
{'errors': [{'code': 9, 'message': 'Invalid number of trade offers.', 'userFacingMessage': 'Something went wrong'}]}
I don’t know why this error is being caused, any help is appreciated thanks.
import requests
import os
import json
session = requests.Session()
session.cookies[".ROBLOSECURITY"] = os.environ['Key']
userId = 430874503
itemIWant = 928908332 #Asset Id
owners = session.get(f"https://inventory.roblox.com/v2/assets/{itemIWant}/owners?limit=25").json()
for i in owners['data']:
if i['owner'] != None:
ownerId = i['owner']['id']
UAID = i['id']
data = {
"offers": [
{
"userId": ownerId, #traderUserId
"userAssetIds": [
UAID
],
"robux": 0
},
{
"userId": 430874503, #My UserId
"userAssetIds": [
22162349315
],
"robux": 0
}
]
}
req = session.post("https://trades.roblox.com/v1/trades/send", data=data)
if "X-CSRF-Token" in req.headers:
session.headers["X-CSRF-Token"] = req.headers["X-CSRF-Token"]
if req.status_code == 403:
request = session.post("https://trades.roblox.com/v1/trades/send", data=data)