Bot API Documentation (v1)
Overview
This API allows verified bot owners to programmatically update their bot's information displayed on SteamTradeBots.com. By sending regular updates, you ensure users see your bot's current status, exchange rates, and stock levels accurately.
Authentication
All API requests must be authenticated using an **API Key** specific to each bot. You can find the unique API Key for each of your verified bots on your Bot Owner Dashboard (Click the icon).
Include the API key as a query parameter in the request URL:
?api_key=YOUR_BOT_API_KEY_HERE
For example, if the endpoint is https://steamtradebots.com/api/v1/bot/update.php
, your request URL would look like:
https://steamtradebots.com/api/v1/bot/update.php?api_key=YOUR_BOT_API_KEY_HERE
Important: Keep your API Key confidential. While sending it in the URL is functional for this API version, be mindful of server logs and potential exposure if URLs are shared.
Rate Limiting
- Limit: 10 requests per bot per 5-minute window (subject to change).
- Recommendation: Update only when data changes. Check the
Retry-After
header in429 Too Many Requests
responses.
Update Bot Data
POST https://steamtradebots.com/api/v1/bot/update.php?api_key=YOUR_BOT_API_KEY_HERE
Description
Updates various data points for the bot associated with the provided API Key. Send only the fields you wish to update in the JSON request body.
Request Body (application/json
)
A JSON object containing the fields you want to update.
{
"status": "online",
"buy_sets_csgo": 25,
"sell_sets_csgo": 27,
"buy_sets_hydra": 15,
"sell_sets_hydra": 16,
"buy_sets_tod": 1,
"sell_sets_tod": 2,
"stock_gems": 2550000,
"stock_keys_hydra": 10,
"stock_tickets_tod": 25,
"stock_badge_appids": [730, 570],
"last_update_timestamp": 1748771273
// ... include other fields to update ...
}
Field Descriptions
Field | Type | Description |
---|---|---|
General Info | ||
status | String | Current bot status (online , offline , busy ). |
max_level | Integer | Max craftable set level (card bots). |
custom_message | String | Short message on profile (max 150 chars, as per DB). |
last_update_timestamp | Integer | Unix timestamp (seconds) of bot's last internal data update. |
Card Set Rates | ||
buy_sets_csgo | Integer/Decimal | Sets given for 1 CS:GO key. |
sell_sets_csgo | Integer/Decimal | Sets required for 1 CS:GO key. |
buy_sets_tf2 | Integer/Decimal | Sets given for 1 TF2 key. |
sell_sets_tf2 | Integer/Decimal | Sets required for 1 TF2 key. |
buy_sets_hydra | Integer/Decimal | Sets given for 1 Hydra key. |
sell_sets_hydra | Integer/Decimal | Sets required for 1 Hydra key. |
buy_sets_tod | Integer/Decimal | Sets given for 1 Tour of Duty Ticket. |
sell_sets_tod | Integer/Decimal | Sets required for 1 Tour of Duty Ticket. |
Gem Rates | ||
buy_gems_set | Integer/Decimal | Gems given for 1 regular set. |
sell_gems_set | Integer/Decimal | Gems required for 1 regular set. |
buy_gems_key_csgo | Integer/Decimal | Gems given for 1 CS:GO key. |
sell_gems_key_csgo | Integer/Decimal | Gems required for 1 CS:GO key. |
buy_gems_key_tf2 | Integer/Decimal | Gems given for 1 TF2 key. |
sell_gems_key_tf2 | Integer/Decimal | Gems required for 1 TF2 key. |
buy_gems_key_hydra | Integer/Decimal | Gems given for 1 Hydra key. |
sell_gems_key_hydra | Integer/Decimal | Gems required for 1 Hydra key. |
buy_gems_key_tod | Integer/Decimal | Sets given for 1 Tour of Duty Ticket. |
sell_gems_key_tod | Integer/Decimal | Sets required for 1 Tour of Duty Ticket. |
Foil Card Set Rates | ||
buy_foil_sets_csgo | Integer/Decimal | Foil sets given for 1 CS:GO key. |
sell_foil_sets_csgo | Integer/Decimal | Foil sets required for 1 CS:GO key. |
buy_foil_sets_tf2 | Integer/Decimal | Foil sets given for 1 TF2 key. |
sell_foil_sets_tf2 | Integer/Decimal | Foil sets required for 1 TF2 key. |
buy_foil_sets_hydra | Integer/Decimal | Foil sets given for 1 Hydra key. |
sell_foil_sets_hydra | Integer/Decimal | Foil sets required for 1 Hydra key. |
buy_foil_sets_tod | Integer/Decimal | Foil sets given for 1 Tour of Duty Ticket. |
sell_foil_sets_tod | Integer/Decimal | Foil sets required for 1 Tour of Duty Ticket. |
buy_foil_gems_set | Integer/Decimal | Gems given for 1 foil set. |
sell_foil_gems_set | Integer/Decimal | Gems required for 1 foil set. |
Badge Rates | ||
buy_gems_badge | Integer/Decimal | Gems given for 1 common/unspecified badge. |
sell_gems_badge | Integer/Decimal | Gems required for 1 common/unspecified badge. |
rates_badges | Object | Specific badge rates (Gems per Badge). Key = Badge ID (string or int), Value = "Buy/Sell" string. E.g., {"13": "150/120"} |
Stock Levels | ||
stock_sets | Integer | Total regular sets in stock. |
stock_unique_sets | Integer | Unique regular sets in stock (count of distinct AppIDs with sets). |
stock_foil_sets | Integer | Total foil sets in stock. |
stock_gems | Integer | Total gems in stock. |
stock_keys_csgo | Integer | CS:GO keys in stock. |
stock_keys_tf2 | Integer | TF2 keys in stock. |
stock_keys_hydra | Integer | Hydra keys in stock. |
stock_tickets_tod | Integer | Tour of Duty Tickets in stock. |
stock_badges | Object | Number of sets in stock for specific games. Key = Game AppID (numeric string or integer), Value = Quantity of sets (Integer). E.g., {"730": 100, "440": 50} |
stock_badge_appids | Array | List of Steam AppIDs (integers) for games the bot has badges for (i.e., games for which the bot has sets). E.g., [730, 570, 440] |
Example Request (curl
)
curl -X POST "https://steamtradebots.com/api/v1/bot/update.php?api_key=YOUR_BOT_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"status": "online",
"buy_sets_hydra": 15,
"sell_sets_hydra": 16,
"stock_sets": 200,
"stock_unique_sets": 15,
"stock_badge_appids": [730, 440, 570],
"stock_badges": {
"730": 100,
"440": 50,
"570": 50
},
"last_update_timestamp": 1748771273
}'
Responses
200 OK
Success:{ "success": true, "message": "Bot data updated successfully." }
400 Bad Request
Invalid Data:{ "success": false, "message": "Invalid data provided. Please check the errors field for details.", "errors": { "buy_sets_hydra": "'buy_sets_hydra' must be a number..." } }
401 Unauthorized
Invalid/Missing Key:{ "success": false, "message": "Authentication failed. API key missing from URL." }
403 Forbidden
Invalid Key/Bot Status:{ "success": false, "message": "Authentication failed or bot is inactive/unverified." }
405 Method Not Allowed
Incorrect HTTP Method:{ "success": false, "message": "Invalid request method. Only POST (and OPTIONS for preflight) is allowed." }
429 Too Many Requests
Rate Limit:{ "success": false, "message": "Rate limit exceeded. Please try again later.", "errors": {"retry_after_seconds": 60} }
500 Internal Server Error
Server Issue:{ "success": false, "message": "An internal server error occurred. Please check server logs." }
Notes
- Requires a valid Bot API Key with update permissions.
- Only include fields you want to update in the JSON body.
- Rate values can be integers or decimals. Stock values should generally be non-negative integers.
- For
rates_badges
, the key should be the Badge ID (numeric string or integer). The value for rates is a "Buy/Sell" string (Gems per Badge). - For
stock_badges
, the key should be the Game AppID. The value is the quantity of sets for that game. - The
stock_badge_appids
field should be an array of numerical Steam AppIDs for which the bot has sets. - The API automatically updates the bot's
updated_at
timestamp and potentiallystatus_last_update
on the site. - A successful update may clear any "missing data" flags on the site for your bot.
Code Examples
Example implementations for sending updates.
PHP (using cURL)
<?php
$botApiKey = 'YOUR_BOT_API_KEY_HERE'; // Replace with your actual API key
// Construct the URL with the API key as a query parameter
$apiUrl = 'https://steamtradebots.com/api/v1/bot/update.php?api_key=' . urlencode($botApiKey);
$data = [
'status' => 'online',
'buy_sets_csgo' => 25,
'sell_sets_csgo' => 27,
'stock_sets' => 150,
'stock_unique_sets' => 3,
'stock_badge_appids' => [730, 440, 570],
'stock_badges' => [ // Example for stock_badges
"730" => 75, // 75 CS:GO sets
"440" => 50, // 50 TF2 sets
"570" => 25 // 25 Dota 2 sets
],
'last_update_timestamp' => time()
];
$jsonData = json_encode($data);
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // Or CURLOPT_POST, true
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length: ' . strlen($jsonData)
// No Authorization header needed if API key is in URL
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
if ($curlError) {
echo "cURL Error: " . $curlError;
} else {
echo "HTTP Status Code: " . $httpCode . "\n";
echo "Response Body: " . $response . "\n";
$responseData = json_decode($response, true);
if ($responseData && isset($responseData['success'])) {
if ($responseData['success']) {
echo "Update successful: " . $responseData['message'] . "\n";
} else {
echo "Update failed: " . $responseData['message'] . "\n";
if (isset($responseData['errors'])) {
print_r($responseData['errors']);
}
}
}
}
?>
Python (using `requests`)
import requests
import json
import time
bot_api_key = 'YOUR_BOT_API_KEY_HERE'
# Construct the URL with the API key as a query parameter
api_url_base = 'https://steamtradebots.com/api/v1/bot/update.php'
api_url = f"{api_url_base}?api_key={bot_api_key}"
data = {
'status': 'online',
'buy_sets_csgo': 25,
'sell_sets_csgo': 27,
'stock_sets': 150,
'stock_unique_sets': 3,
'stock_badge_appids': [730, 440, 570],
'stock_badges': { # Example for stock_badges
"730": 75, # 75 CS:GO sets
"440": 50, # 50 TF2 sets
"570": 25 # 25 Dota 2 sets
},
'last_update_timestamp': int(time.time())
}
# Headers no longer need Authorization if key is in URL
headers = {
'Content-Type': 'application/json'
}
try:
response = requests.post(api_url, headers=headers, json=data, timeout=10)
print(f"HTTP Status Code: {response.status_code}")
print(f"Raw Response Body: {response.text}")
response.raise_for_status()
response_data = response.json()
print(f"Parsed Response Body: {response_data}")
if response_data.get('success'):
print(f"Update successful: {response_data.get('message')}")
else:
print(f"Update failed: {response_data.get('message')}")
if response_data.get('errors'):
print(f"Errors: {response_data.get('errors')}")
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
except json.JSONDecodeError:
print(f"Failed to decode JSON response. Raw response was: {response.text}")