api.php?type= (update | lastcheck | lastchange | stats | ttm | ttmrank | formatname | search | recordsofplayer | previousname) &player= (player_name)
api.php?type= (track | datapoints | trackehp) &player= (player_name) &time= (seconds)
api.php?type= (comptotal | comprankings) &competition= (comp_id) [&skill= (skill_id)]
api.php?type= (players | time)
api.php?type= (records | currenttop) [&timeperiod = (day | week | month)] [&skill= (skill)] [&players= (name1,name2...) | &compid= (id) | &groupid= (id)] [&filter= (vh_filter)] [&pagenum= (page)] [&count= (players per page)]
api.php?type= (virtualhiscores) [&page= (vh_page)] [&players= (name1,name2...) | &compid= (id) | &groupid= (id)] [&filter= (vh_filter)] [&pagenum= (page)] [&count= (players per page)] [&skill= (skill for skillhiscores)]
Prints any Virtual Hiscores page just as you would see it on the original page, except that this API function does not print out ranks. Get the data at a certain rank, 1337, by using &pagenum=1337&count=1.

api.php?type= (virtualhiscoresrank) &player= (player_name) [&page= (vh_page)] [&players= (name1,name2...) | &compid= (id) | &groupid= (id)] [&filter= (vh_filter)] [&pagenum= (page)] [&count= (players per page)] [&skill= (skill for skillhiscores)]
Prints a single number which is the player's rank on a the Virtual Hiscores page.

api.php?type= (virtualhiscoresatplayer) &player= (player_name) [&page= (vh_page)] [&players= (name1,name2...) | &compid= (id) | &groupid= (id)] [&filter= (vh_filter)] [&pagenum= (page)] [&count= (players per page)] [&skill= (skill for skillhiscores)]
A mix between virtualhiscores and virtualhiscoresrank. Prints out the rank and the relevant data for a certain player.

*GET variables for virtual hiscores API work the same as the original page. The API types virtualhiscores, virtualhiscoresrank, virtualhiscoresatplayer, records, and currenttop can be used with the same filtering variables: names/compid/groupid, filter, pagenum, and count.

api.php?multiquery= (json_parameters)
A multiquery can be used to avoid sending multiple HTTP requests. The multiquery variable should be set to a JSON array, with each element containing the variables to be sent for each query. The variables are inherited from the previous element(s) unless they are explicitly changed. You may have to encode the JSON text to send it in the URL. Here's an example of the "player" variable being inherited in the second query:
api.php?multiquery= [{"type": "stats", "player": "foot"}, {"type": "track"}]

The player variable can be set to any text. If no alphanumeric characters are given in the text, the invalid username error code will be printed out. Examples:
"S_U__O__M_I" = "s_u__o__m_i"
"S-u _o-_M!i" = "s_u__o__m_i"
"_?? !@$@s u??o(%m.i--??" = "s_u__o__m_i"
"***!!!***" = Invalid name

The time variable can be set to anything like this:
"12345" = 12345 seconds
"12345s" = 12345 seconds
"3d6h23m2s" = 282182 seconds
"1y1M1w1d1h1m1s" = 34909261 seconds
"0" = 0 seconds
"60m" = 3600 seconds
"1d" = 86400 seconds
"7d" = 604800 seconds
"31d" = 2678400 seconds

The skill variable should be set to a number 0 through 23 or the complete name for a skill. "ehp" can be used in some cases.
"6" = #6, Prayer
"Agility" = #17, Agility
"EHP" = #99, EHP
"ehp" = #99, EHP
"runecrafting" = #21, Runecrafting
"ConstrucTION!!!" = #23, Construction
"0" = #0, Overall
"1337" = #0, Overall
"hello world" = #0, Overall

The filter variable can be 1def, 3cmb, onhiscores, or a combination of those delimited by commas.

Error values:
-1 = User not in database
-2 = Invalid username
-3 = Database error
-4 = Server under heavy load; api temporarily disabled

The rest of the site is prioritized over the API under times of heavy load. If this is a big problem for your application, you may contact us about receiving an API key for $20. With an API key, you will never receive "-4" errors. We reserve the right to revoke your API key if its usage significantly effects the performance of the rest of the site. If your API key is revoked, you may receive a partial refund or exchange your API key for donator perks. This API key does not prevent your requests from getting blocked by the DoS prevention system if you send too many requests too quickly. If you need to obtain a lot of data at once from this API, use a multiquery (see above).

If you use data from Crystal Math Labs in your project, it would be greatly appreciated if you link back to our site. We are interested in checking out what is made using this API. Send us your project here.";