Since the STK developers never made a reference for their users API, I decided to make my own.
The API URL is: https://online.supertuxkart.net/api/v2/user/<apicall>
The POST format must be in this way: <arg1>=<value>&<arg2>=<value>....
For example, userid=345397&token=xxxxxxxxxxxxxxx
Using curl:
curl -X POST \
-d "userid=345397&token=xxxxxxxxxxxxxxxxxx" \
--user-agent "SuperTuxKart/1.4 (Linux)" \ # optional, but recommended.
https://online.supertuxkart.net/api/v2/user/poll
Using Python (requests)
import requests
headers = {
"content-type": "application/x-www-form-urlencoded", # mandatory, or API will just give you errors.
"user-agent": "SuperTuxKart/1.4 (Linux)" # again, is optional.
}
API_URL = "https://online.supertuxkart.net/api/v2"
req = requests.get(API_URL + "/user/poll", data="userid=345397&token=xxxxxxxxxxxxxxxxxxx", headers=headers)
print(req.content)
Polls user to ensure authentication
int
userid
- User IDstring
token
- Token of user
<poll success="yes" info="" />
Authenticate user
string
username
- Usernamestring
password
- Passwordoptional
bool
save_session
- Whether to remember user or not (creates permanent token)
<connect success="yes" token="xxxxxxxxxxxxxxxxxxxx" username="searinminecraft" realname="searinminecraft" userid="345397" achieved="1 2 3 4 5 6 7 8 9 10 11 12" info=""/>
Retrieves session information (username, etc.)
int
userid
- User IDstring
token
- Token of user
Example Response:
<saved-session success="yes" token="xxxxxxxxxxxxxxxxxxxx" username="searinminecraft" realname="searinminecraft" userid="345397" info=""/>
Retrieves friends list of a user. Requires current user to be authenticated. (a.k.a have a valid userid
and token
value)
int
userid
- User IDstring
token
- Token of Userint
visitingid
- The User ID of the user you want to get their friends list. Can be the same asuserid
<get-friends-list success="yes" info="" visitingid="345397">
<friends>
<friend is_pending="no" online="no" date="2022-07-17 07:39:43">
<user id="368965" user_name="The_Black_Cat_Hollyleaf"/>
</friend>
<friend is_pending="no" online="no" date="2022-08-07 05:04:23">
<user id="49576" user_name="kimden"/>
</friend>
</friends>
</get-friends-list>
If the visitingid
is different from userid
, it only shows limited information:
<get-friends-list success="yes" info="" visitingid="345397">
<friends>
<friend>
<user id="375997" user_name="ichigo-ojetti"/>
</friend>
<friend>
<user id="372507" user_name="ernugraha"/>
</friend>
<friend>
<user id="368965" user_name="The_Black_Cat_Hollyleaf"/>
</friend>
</friends>
</get-friends-list>
Retrives achievements of a user.
int
userid
- User IDstring
token
- Token of Userint
visitingid
- The User ID of the user you want to get their achievements. Can be the same asuserid
<get-achievements success="yes" info="" visitingid="345397" achieved="1 2 3 4 5 6 7 8 9 10 11 12"/>
Retrieves the vote of an addon the current user sent.
int
userid
- User IDstring
token
- Token of Userstring
addonid
- Addon ID. For example:mod-circuit
When voted on:
<get-addon-vote success="yes" voted="yes" rating="3" info=""/>
If not voted on yet:
<get-addon-vote success="yes" voted="no" rating="-1" info=""/>
Casts a vote to an addon
int
userid
- User IDstring
token
- Token of Userstring
addonid
- Addon ID. For example:mod-circuit
int
rating
- Rating value. Decimal values are accepted. Must not exceed 6 or go below 0.
<set-addon-vote success="yes" new-average="1.6304347826087" new-number="23" addon-id="bowling" info=""/>
Pings SuperTuxKart Servers to tell the player has quit the game.
int
userid
- User IDstring
token
- Token of user
<client-quit success="yes" info=""/>
Deauthenticates user, destroys the session and resets the token.
int
userid
- User IDstring
token
- Token of user
<disconnect success="yes" info=""/>
Tells the SuperTuxKart servers the player has earned an achievement.
int
userid
- User IDstring
token
- Token of userlist
achievement-ids
- Achievement(s) the player has earned. In their ID number form. You must not use normal spaces, instead use their url encoded version, which is%20
Send a friend-request to a player
int
userid
- User IDstring
token
- Token of userint
friendid
- ID of user to send a request to
<friend-request success="yes" info=""/>
Accepts an incoming friend request.
int
userid
- User IDstring
token
- Token of userint
friendid
- ID of user to accept
<accept-friend-request success="yes" info=""/>
Declines an incoming friend request.
int
userid
- User IDstring
token
- Token of userint
friendid
- ID of user to decline
<decline-friend-request success="yes" info=""/>
Cancels a sent friend request.
int
userid
- User IDstring
token
- Token of userint
friendid
- ID of user to cancel a friend request
<cancel-friend-request success="yes" info=""/>
Remove a friend
int
userid
- User IDstring
token
- Token of userint
friendid
- ID of user remove friend
<remove-friend success="yes" info=""/>
Search for a user in SuperTuxKart
int
userid
- User IDstring
token
- Token of userstring
search-string
- Search keyword
A search for "kimden" results in:
<user-search success="yes" info="" search-string="kimden">
<users>
<user id="49576" user_name="kimden"/>
<user id="352929" user_name="kimden."/>
</users>
</user-search>
Creates an account for STKAddons.
Misusing this API call is against the SuperTuxKart Terms of Service and may result in an IP ban from STKAddons.
string
username
- Usernamestring
password
- Passwordstring
password-confirm
- Password confirmation (Must be the same aspassword
!)string
realname
- Real Namestring
email
- Emailstring
terms
- Determines if user agrees to the SuperTuxKart Terms of Service. The value must beon
in order for the request to succeed.
<registration success="yes" info=""/>
It will then send an email to the specified email to activate the account
For account recovery
string
username
- Usernamestring
email
- Email used in registration
<recover success="yes" info=""/>
It will then send an email to the specified email for password reset instructions.
Change password of user
int
userid
- ID of userstring
current
- Current passwordstring
new1
- New passwordstring
new2
- Password confirmation (must be the same value asnew1
)
<change-password success="yes" info=""/>
Get ranking of user.
int
userid
- User IDstring
token
- Token of Userint
id
- Same concept asvisitingid
. The User ID of the user you want to get their ranking.
If the user has no ranking yet:
<get-ranking success="yes" info="" scores="1300" max-scores="1300" num-races-done="0" raw-scores="4000" rating-deviation="1000" disconnects="0" rank="-1"/>
If user has ranking:
<get-ranking success="yes" info="" scores="630.6653440411751" max-scores="2276.387630577021" num-races-done="39" raw-scores="3330.665344041175" rating-deviation="1000" disconnects="412322137026" rank="4592"/>
Gets the top 10 ranked players.
int
userid
- User IDstring
token
- Token of User
<top-players success="yes" info="">
<players>
<player username="nascartux-2" scores="7657.051018343762" max-scores="7686.999211052843" num-races-done="2901" raw-scores="7764.397012824206" rating-deviation="135.78199816014822" disconnects="0" rank="1"/>
<player username="mimiz" scores="7608.833835057674" max-scores="7651.954686723075" num-races-done="1060" raw-scores="7841.301482237427" rating-deviation="177.48921572658446" disconnects="0" rank="2"/>
<player username="remihb" scores="7403.394040960673" max-scores="7737.632453303215" num-races-done="3252" raw-scores="7409.564099391821" rating-deviation="102.05668614371609" disconnects="0" rank="3"/>
<player username="Wax-stk" scores="7200.275236442525" max-scores="7775.726439171751" num-races-done="1083" raw-scores="7610.627221224665" rating-deviation="236.78399492738004" disconnects="0" rank="4"/>
<player username="CrystalTheEevee" scores="6617.824052240317" max-scores="6677.0429712336145" num-races-done="305" raw-scores="6934.104910384785" rating-deviation="205.426952714823" disconnects="0" rank="5"/>
<player username="LLS" scores="6598.321221149626" max-scores="6697.379956214026" num-races-done="1391" raw-scores="6900.834206951637" rating-deviation="200.83766193400373" disconnects="0" rank="6"/>
<player username="Haenschen" scores="6351.652495551109" max-scores="6828.968507331748" num-races-done="210" raw-scores="7378.38258979998" rating-deviation="442.2433647496239" disconnects="0" rank="7"/>
<player username="Le-stig-du-21" scores="6308.569829362183" max-scores="6322.254940985489" num-races-done="546" raw-scores="6361.686425079046" rating-deviation="117.70553190562093" disconnects="2305843009213693952" rank="8"/>
<player username="George-Calibur" scores="6285.743295645444" max-scores="6428.288991805244" num-races-done="1146" raw-scores="6303.97559881003" rating-deviation="106.07743438819521" disconnects="0" rank="9"/>
<player username="FabianF" scores="6186.659355399041" max-scores="6868.924612256909" num-races-done="738" raw-scores="6534.386705134331" rating-deviation="215.9091165784304" disconnects="1073741824" rank="10"/>
</players>
</top-players>
Submits ranking to SuperTuxKart Servers. Used exclusively for ranked servers. The account must have the required permission (the same as asking permission to create a ranked server) in order to access the endpoint.
<submit-ranking success="yes" info=""/>
Resets ranking of user. This is an elevated endpoint, which requires the account to have administrator privileges.
int
userid
- User IDstring
token
- Token of User