Workshop.codes has several JSON endpoints for you to use and build your own tools with. These endpoints have no request limit, just be reasonable.
For now this API doesn't follow any guidelines or specifications. As a result it can be a little bit brittle. For simple use this should be no problem, but know there are no advanced parameters that let you fully customise your queries. This will hopefully change in the future with a v2 which will follow the jsonapi.org specifications.
In essence almost all pages that display codes have a
.json endpoint which can easily be accessed by adding
.json to the url. This exists for the homepage, on-fire, filters, search, show, and user profile pages.
All pages return 20 codes at once, given that amount of codes are available.
Each query returns the following per post:
code: Import code of the post
nice_url: Optional url that redirects to the code
title: Title of the post
thumbnail: URL to the thumbnail. This thumbnail is 690x394 in size.
categories: An array of user selected categories, up to 3.
- Possible categories are: Free for all, Team Deathmatch, Solo, Elimination, 1vs1, King of the Hill, Boss Mode, Minigames, Parkour, Race, Survival, Protect, Hide and Seek, PvE, Practice Mode, Hero Adjustments, New Heroes, Scrims, Tools, Miscellaneous
maps: An array of maps the code uses. Atleast 1.
heroes: An array of heroes the code uses. Atleast 1.
tags: A string of comma separated tags. Optional.
created_at: The datetime the post was first created.
updated_at: The datetime the post was last updated.
last_revision_created_at: The datetime the last revision got added to this post. This is used to determine if a post is "expired".
username: Username of the author
nice_url: Optional nice url which redirects to the userpage
verified: Boolean which states if the user is verified or not. The nice_url only works for verified users.
To access the most recent posts:
Both of these will return a list of the 20 most recently created codes. The next page can be accessed by changing the number, as you might have guessed.
To request "on fire" posts:
Additional pages can be requested like before.
To search for a specific query:
To request additional pages:
This query is not case sensitive.
Search results are based on a post's Code, Title, Tags, Username, Categories, Maps, Heroes, in that order of importance. These are additionally influenced by the posts "hotness" or "on fire" score. The query is "fuzzy" meaning they allow for misspellings or close matches. For example "mccree" and "mcree" will return the same results, altough correct spellings will be higher ranked if relevant.
Filters can be used to refine a search result, or on their own without a search query.
Additional filters can be added like so:
These filters need to be in correct order. Every filter is optional and can be left out, but they still need to be in the correct order.
To circumvent this you can also use a different format:
This format still requires at least 1 filter to follow the "nice" format.
Be aware that the "nice" format uses plural names such as "heroes", where as the parameters use singular such as "hero".
This can also be combined with search:
categories/:category: Posts that have this category selected
heroes/:hero: Posts that have this hero selected
maps/:map: Posts that have this map selected
from/:from: Posts that are created after this date.
to/:to: Posts that are created before this date.
exclude-expired/:expired: Whether or not to include expired posts. true or false.
author/:author: Author username, only verified authors are included in this last
search/:search: Search query
sort/:sort: Posts are sorted by this value. Possible values are:
language/:language: Posts made in this locale. Possible values are:
page/:page: Page number. Each page returns a maximum of 20 codes.
Codes by user
Request all codes by a user:
To request additional pages:
Usernames are not case sensitive, but do require battle.net or discord id. The
# needs to be escaped as
Request a code with:
This code is not case sensitive. Unlike on the website itself, old revisions will not redirect to the correct code.
To search the wiki you can use:
This will return a maximum of 20 results. The markdown of these results is cleaned up to make sense in other markdown environments, specifically for Discord.
There is currently no way of returning only a single result.
To get a dictionary of all Workshop terms use
This will return an array of all values and actions the Workshop has to offer. For example;
["Abort","Abort If","Abort If Condition Is False","Abort If Condition Is True", ...
There is no way to filter this array via additional parameters.