Steam Web API key not working 403 forbidden

284 Views Asked by At

I'm trying a GET Request ( GetUserStatsForGame ) in Steam (https://partner.steamgames.com/doc/webapi/ISteamUserStats)

, But it's not working the output is this:

enter image description here

Here is my apiUrl = "https://partner.steam-api.com/ISteamUserStats/GetUserStatsForGame/v2/?key={{apiKey}}&steamid={{steamId}}&appid={{appIdCS2}}"

I tried it in postman, and I was hoping to get a XML format response.

1

There are 1 best solutions below

0
Hanni On

Within postman double check that your API Key is properly set as a variable. If you hover over the {{apiKey}} you can edit it and confirm. You can also hardcode it as I show below. To make sure it is in the xml format add in the &format=xml to the end of the url.

https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v2/?key=PASTEKEYHERE&steamid=PASTEID&appid=PASTEAPPID&format=xml

If you are doing this in javascript, it will probably look something like this, but note that I changed the {{VARIABLE}} to ${variable} in order to dynamically insert the variable values into strings.

// Replace these placeholders with your actual values
const apiKey = 'YOUR_ACTUAL_API_KEY';
const steamId = 'YOUR_STEAM_ID';
const appIdCS2 = 'YOUR_APP_ID';

https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v2/?key=${apiKey}&steamid=${steamId}&appid=${appIdCS2}&format=xml

I tested these both with my own API key and it seemed to work as expected.