Need help with SteamWebAPI?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

138 Stars 46 Forks MIT License 30 Commits 9 Opened issues


Library for C# giving access to the functionality of the Steam Web API.

Services available


Need anything else?

Contributors list

This project is no longer actively maintained. You are advised to use a different library.

Steam Web API library


This is a .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes. The primary goal of this project is to support Steam Friends functionality. Other possible functionality like purchasing games and item trading may follow later. In short, it will contain everything needed to write a custom, cross-platform Steam Friends messenger in C#.




Enumeration of possible authentication results.

public enum LoginStatus


Status of a user.

public enum UserStatus
    Offline = 0,
    Online = 1,
    Busy = 2,
    Away = 3,
    Snooze = 4


Visibility of a user's profile.

public enum ProfileVisibility
    Private = 1,
    Public = 3,
    FriendsOnly = 8


Available sizes of user avatars.

public enum AvatarSize


Available update types.

public enum UpdateType


This is the main class you will be using. It manages the session of a single Steam user and all requests are issued through methods in this class. Below follows a description of every method.

LoginStatus Authenticate( String username, String password, String emailauthcode = "" )

Authenticate with a username and password. Sends the SteamGuard e-mail if it has been set up and an e-mail code has not been passed.

LoginStatus Authenticate( String accessToken )

Authenticate with an access token previously retrieved with a username and password (and SteamGuard code).

List<Friend> GetFriends( String steamId = null )

Fetch basic info for all friends of a given user.

List<User> GetUserInfo( List<String> steamids )

List<User> GetUserInfo( List<Friend> friends )

User GetUserInfo( String steamid = null )

Retrieve information about the specified users. Pass null for self.

Bitmap GetUserAvatar( User user, AvatarSize size = AvatarSize.Small )

Retrieve the avatar of the specified user as bitmap.

List<Group> GetGroups( String steamid = null )

Fetch basic group info for a given user.

List<GroupInfo> GetGroupInfo( List<String> steamids )

List<GroupInfo> GetGroupInfo( List<Group> groups )

GroupInfo GetGroupInfo( String steamid )

Retrieve information about the specified groups.

Bitmap GetGroupAvatar( Group group, AvatarSize size = AvatarSize.Small )

Retrieve the avatar of the specified group as bitmap.

bool SendTypingNotification( User user )

Let a user know you're typing a message. Should be called periodically.

bool SendMessage( User user, String message )

Send a text message to the specified user.

List<Update> Poll()

Check for updates and new messages.

ServerInfo GetServerInfo()

Returns info about the server, as specified in the ServerInfo class. This is the only call besides Authenticate that does not require a valid user session.



Structure containing basic friend info.

public class Friend
    public String steamid;
    public bool blocked;
    public DateTime friendSince;


Structure containing extensive user info.

public class User
    public String steamid;
    public ProfileVisibility profileVisibility;
    public int profileState;
    public String nickname;
    public DateTime lastLogoff;
    public String profileUrl;
    public String avatarUrl;
    public UserStatus status;
    public String realName;
    public String primaryGroupId;
    public DateTime joinDate;
    public String locationCountryCode;
    public String locationStateCode;
    public int locationCityId;

Note that some of these fields can be empty!


Basic group info.

public class Group
    public String steamid;
    public bool inviteonly;


Structure containing extensive group info.

public class GroupInfo
    public String steamid;
    public DateTime creationDate;
    public String name;
    public String headline;
    public String summary;
    public String abbreviation;
    public String profileUrl;
    internal String avatarUrl;
    public String locationCountryCode;
    public String locationStateCode;
    public int locationCityId;
    public int favoriteAppId;
    public int members;
    public int usersOnline;
    public int usersInChat;
    public int usersInGame;
    public String owner;


Structure containing information about a single update.

public class Update
    public DateTime timestamp;
    public String origin;
    public bool localMessage;
    public UpdateType type;
    public String message;
    public UserStatus status;
    public String nick;


Structure containing server info.

public class ServerInfo
    public DateTime serverTime;
    public String serverTimeString;


Here's how to log in with a username and password, ask for the SteamGuard code if necessary and display the amount of friends the user has.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using SteamWebAPI;

namespace SteamWebAPI { class Program { static void Main( string[] args ) { SteamAPISession session = new SteamAPISession();

        Console.Write( "Username: " );
        String username = Console.ReadLine();
        Console.Write( "Password: " );
        String password = Console.ReadLine();

        SteamAPISession.LoginStatus status = session.Authenticate( username, password );
        if ( status == SteamAPISession.LoginStatus.SteamGuard )
            Console.Write( "SteamGuard code: " );
            String code = Console.ReadLine();

            status = session.Authenticate( username, password, code );

        if ( status == SteamAPISession.LoginStatus.LoginSuccessful )
            List<steamapisession.friend> friends = session.GetFriends();
            int blockedFriends = friends.Count( f =&gt; f.blocked == true );
            Console.WriteLine( "You have " + ( friends.Count - blockedFriends ) + " friends and " + blockedFriends + " fiends!" );
            Console.WriteLine( "Failed to log in!" );

} </steamapisession.friend>

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.