Steamworks Documentation
GetContexts/v0001
This returns the contexts that exist for the specified user.

Called by: Support Tool, Trading UI, Inventory UI

HTTP Method: GET

Parameters:

NameTypeRequiredDescription
keystringThis is the "Asset Server Key" that you provided in your app's Steam Economy Settings on the partner site.
appiduint3232bit App ID of the application associated with the contexts.
steamiduint6464bit Steam ID of the user to return contexts for.
parentuint64The 64-bit ID of the parent context to return children for. If this parameter is zero, return the root level contexts.
categorystring"history" or "assets" if this is being called from the support tool. If this call is being made from the trading or inventory UIs the category will be "trading". This can be useful if you have contexts that only make sense to appear in certain categories. It is also likely that some context commands only make sense in certain categories, so you can filter which commands you send based on the category. If you don't support the support tool APIs, it is fine to treat all categories the same.
commandsboolTrue if context commands should be included in the output.
languagestringISO639-1 language code plus ISO 3166-1 alpha 2 country code of the language to return strings in. Some examples include en_US, de_DE, zh_CN, and ko_KR. Default: en_US

Returns

The output from this method should be encoded in the JSON format.

Response:
  • result
    • success - True if the method was successful. If the asset server is returning false, it should set error to a string that explains why.
    • error - a string describing why this call failed. This message will be recorded in the error log, which is available under the Economy tab on the Steamworks site.
    • contexts - an array of the contexts that are children of the specified parent.
      • id - The 64-bit ID of the context within this game for this steam ID. See Steam Economy Context IDs for more information.
      • name - The name of the context. This will be displayed to support agents. If user_facing is true it will also be displayed to users.
      • nested - If this is true a subsequent call to GetContexts with this context as the parent will return a non-empty context list.
      • asset_count - The number of assets and currencies owned by the user in this context. This number is shown to the user and any context with an asset_count of zero will typically be hidden from the user.
      • user_facing - If this is true and the context contains assets it will be displayed in the trade UI and inventory UI.
      • commands - An array of commands to show for this context in the Economy page of the support tool. See below for more information on commands.
    • alerts(optional) - An array of alerts to show for this game in the trade UI. This node is ignored for categories other than "trading"
      • text - Localized string to show in the trade UI for this game.
      • color(optional) - Hex color code of the color to display this alert in.
    • trade_permissions(optional) - Trade permission level of this user. Value must be one of NONE, RECEIVEONLY, SENDONLY, SENDONLY_FULLINVENTORY, or FULL.
      Users with NONE will not be able to complete any trade including an asset from this game. Users with RECEIVEONLY will be allowed to receive assets for the game, but not add assets of their own to a trade. Users with SENDONLY will be allowed to add assets they own to a trade, but will not be allowed to receive assets for the game. Users with SENDONLY_FULLINVENTORY have the same restrictions as SENDONLY, but the user will be notified that the restriction is because their inventory for the game is full. Users with FULL permissions can add any of their own items to a trade that are marked as tradable or receive any tradable item from their trading partner. This node is ignored for categories other than "trading". Default: FULL.

Commands

Each context can contain commands that allow support agents to manipulate the user's assets. These only appear on the Economy page in the support tool. They are used for operations like adding new items, reloading the account, and deleting items. When a command is executed ContextCommand/v0001 will be called. Each command is specified as follows:
  • name - Name of the command. This is displayed in the support tool and will be returned to ContextCommand.
  • description - Description of what the command is going to do. This is displayed to the support agent in the confirmation dialog
  • record_note - If this is true the support agent will be prompted for a note to record in the support activity history for the account.
    False should be returned for commands that don't make any changes to the user's information (such as a command to reload the user from the database.)
    (Default: True)
  • asset_command(optional) - If this is true the command will appear on each asset in the context instead of on the context itself.
    If a support agent executes this command on a context the additional argument assetid will be added to the resulting call to ContextCommand.

  • options - An array of options to display in the confirmation dialog.
    • name - Name of the option.
    • type - Type of the control to show for the option. The support types are checkbox, dropdown, numeric, and type_picker.
    • default - Default for this option. This is a bool for checkbox options and the name of the value for dropdown optons.
    • supervisor_only - This is true if only a restricted set of support agents should have access to this option. For all other agents the default will be used.
    • values - An array of the possible values for dropdown options. This is not used for other option types.
      • name - Name to show the support agent for this value.
      • value - Value to return in ContextCommand if this is picked from the dropdown.

    • types - Array of types to display in type_picker options. This is not used for other option types.
      • name - Name of the type
      • value - Value to return for this type.
      • icon_url - URL of the icon to show next to this type in the picker control.
      • tags - An array of tags to show under the name in the type picker.

Example Output

{ "result": { "success": true, "contexts": [ { "id": 2, "name": "Backpack", "nested": false, "commands": [ { "name": "Reload", "description": "Reload the user's information from the database.", "record_note": false }, { "name": "Delete All", "description": "Delete all of the user's items.", "options": [ { "name": "Delete Purchased Items", "type": "checkbox", "default": false } ] }, { "name": "Add Item", "description": "Adds an item for the user. Please don't set Quality, Particle Effect, or Level unless you know what you're doing.", "options": [ { "name": "Quality", "type": "dropdown", "default": "unique", "values": [ { "name": "Any", "value": "Any" }, { "name": "Normal", "value": "normal" }, { "name": "Genuine", "value": "rarity1" }, { "name": "Vintage", "value": "vintage" }, { "name": "Unusual", "value": "rarity4" } ] }, { "name": "Particle Effect", "type": "dropdown", "default": "none", "values": [ { "name": "None", "value": 0 }, { "name": "burningplayer_red", "value": 1 }, { "name": "burningplayer_flyingbits", "value": 2 } ] }, { "name": "Level", "type": "numeric", "default": 0 }, { "name": "Not Tradable", "type": "checkbox", "default": false }, { "name": "Not Usable In Crafting", "type": "checkbox", "default": false }, { "name": "Item Type", "type": "type_picker", "types": [ { "value": "The Kritzkrieg", "icon_url": "http://media.steampowered.com/apps/440/icons/c_overhealer.b5ed539b534216652b45694e19c78d2aaebcfe5e.png", "name": "Kritzkrieg", "tags": [ "Slot: secondary", "Used By: Medic" ] }, { "value": "The Blutsauger", "icon_url": "http://media.steampowered.com/apps/440/icons/c_leechgun.198c5a7943a16f08b5227f2e84d165c153ed0223.png", "name": "Blutsauger", "tags": [ "Slot: primary", "Used By: Medic" ] } ] } ] }, { "name": "Delete Item", "asset_command": true, "description": "Delete an item" } ] , "asset_count": 180, "user_facing": true }, { "id": 3, "name": "Recipes", "nested": false, "asset_count": 0, "user_facing": false } ] , "alerts": [ ] , "trade_permissions": "FULL" } }