Home Documentation & Help
Steamworks Documentation
ISteamUser Interface
Functions for accessing and manipulating Steam user information.

This is also where the APIs for Steam Voice are exposed.

Member Functions

Member functions for ISteamUser are called through the global accessor function SteamUser().


void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer );
steamIDGameServerCSteamIDThis should be k_steamIDNonSteamGS if you're setting the IP/Port, otherwise it should be k_steamIDNil if you're clearing this.
unIPServeruint32The IP of the game server in host order, i.e == 0x7f000001.
usPortServeruint16The connection port of the game server, in host order.

Set the rich presence data for an unsecured game server that the user is playing on. This allows friends to be able to view the game info and join your game.

When you are using Steam authentication system this call is never required, the auth system automatically sets the appropriate rich presence.


EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID );
pAuthTicketconst void *The auth ticket to validate.
cbAuthTicketintThe size in bytes of the auth ticket. This must be the pcbTicket size provided by the call that created this ticket.
steamIDCSteamIDThe entity's Steam ID that sent this ticket.

Authenticate the ticket from the entity Steam ID to be sure it is valid and isn't reused.

The ticket is created on the entity with GetAuthSessionTicket or ISteamGameServer::GetAuthSessionTicket and then needs to be provided over the network for the other end to validate.

This registers for ValidateAuthTicketResponse_t callbacks if the entity goes offline or cancels the ticket. See EAuthSessionResponse for more information.

When the multiplayer session terminates you must call EndAuthSession.

Returns: EBeginAuthSessionResult
Triggers a ValidateAuthTicketResponse_t callback.

See Also: User Authentication and Ownership


bool BIsBehindNAT();
Checks if the current users looks like they are behind a NAT device.

This is only valid if the user is connected to the Steam servers and may not catch all forms of NAT.

Returns: bool
true if the current user is behind a NAT, otherwise false.


bool BIsPhoneIdentifying();
Checks whether the user's phone number is used to uniquely identify them.

Returns: bool
true if the current user's phone uniquely verifies their identity; otherwise, false.


bool BIsPhoneRequiringVerification();
Checks whether the current user's phone number is awaiting (re)verification.

Returns: bool
true if the it is requiring verification; otherwise, false.


bool BIsPhoneVerified();
Checks whether the current user has verified their phone number.

See the Steam Guard Mobile Authenticator page on the customer facing Steam Support site for more information.

Returns: bool
true if the current user has phone verification enabled; otherwise, false.


bool BIsTwoFactorEnabled();
Checks whether the current user has Steam Guard two factor authentication enabled on their account.

See the Steam Guard Mobile Authenticator page on the customer facing Steam Support site for more information.

Returns: bool
true if the current user has two factor authentication enabled; otherwise, false.


bool BLoggedOn();
Checks if the current user's Steam client is connected to the Steam servers.

If it's not then no real-time services provided by the Steamworks API will be enabled. The Steam client will automatically be trying to recreate the connection as often as possible. When the connection is restored a SteamServersConnected_t callback will be posted.

You usually don't need to check for this yourself. All of the API calls that rely on this will check internally. Forcefully disabling stuff when the player loses access is usually not a very good experience for the player and you could be preventing them from accessing APIs that do not need a live connection to Steam.

Returns: bool
true if the Steam client current has a live connection to the Steam servers; otherwise, false if there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.


void CancelAuthTicket( HAuthTicket hAuthTicket );
hAuthTicketHAuthTicketThe active auth ticket to cancel.

Cancels an auth ticket received from GetAuthSessionTicket. This should be called when no longer playing with the specified entity.

See Also: User Authentication and Ownership


EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate );
pCompressedconst void *The compressed data received from GetVoice.
cbCompresseduint32The size of the buffer passed into pCompressed.
pDestBuffervoid *The buffer where the raw audio data will be returned. This can then be passed to your audio subsystems for playback.
cbDestBufferSizeuint32The size of the buffer passed into pDestBuffer.
nBytesWrittenuint32 *Returns the number of bytes written to pDestBuffer, or size of the buffer required to decompress the given data if cbDestBufferSize is not large enough (and k_EVoiceResultBufferTooSmall is returned).
nDesiredSampleRateuint32The sample rate that will be returned. This can be from 11025 to 48000, you should either use the rate that works best for your audio playback system, which likely takes the users audio hardware into account, or you can use GetVoiceOptimalSampleRate to get the native sample rate of the Steam voice decoder.

Decodes the compressed voice data returned by GetVoice.

The output data is raw single-channel 16-bit PCM audio. The decoder supports any sample rate from 11025 to 48000. See GetVoiceOptimalSampleRate for more information.

It is recommended that you start with a 20KiB buffer and then reallocate as necessary.

See Steam Voice for more information.

Returns: EVoiceResult
The internal sample rate of the Steam Voice decoder.


void EndAuthSession( CSteamID steamID );
steamIDCSteamIDThe entity to end the active auth session with.

Ends an auth session that was started with BeginAuthSession. This should be called when no longer playing with the specified entity.

See Also: User Authentication and Ownership


HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket );
pTicketvoid *The buffer where the new auth ticket will be copied into if the call was successful.
cbMaxTicketintThe size of the buffer allocated for pTicket. This should be 1024.
pcbTicketuint32 *Returns the length of the actual ticket.

Retrieve a authentication ticket to be sent to the entity who wishes to authenticate you.

After calling this you can send the ticket to the entity where they can then call BeginAuthSession/ISteamGameServer::BeginAuthSession to verify this entities integrity.

When creating a ticket for use by the ISteamUserAuth/AuthenticateUserTicket Web API, the calling application should wait for the GetAuthSessionTicketResponse_t callback generated by the API call before attempting to use the ticket to ensure that the ticket has been communicated to the server. If this callback does not come in a timely fashion (10 - 20 seconds), then your client is not connected to Steam, and the AuthenticeUserTicket call will fail because it can not authenticate the user.

Returns: HAuthTicket
Triggers a GetAuthSessionTicketResponse_t callback.
A handle to the auth ticket. When you're done interacting with the entity you must call CancelAuthTicket on the handle.

Returns k_HAuthTicketInvalid if the call fails.

See Also: User Authentication and Ownership


EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 );
pcbCompresseduint32 *Returns the size of the available voice data in bytes.
pcbUncompressed_Deprecateduint32 *Deprecated.

Checks to see if there is captured audio data available from GetVoice, and gets the size of the data.

Most applications will only use compressed data and should ignore the other parameters, which exist primarily for backwards compatibility. See GetVoice for further explanation of "uncompressed" data.

See Steam Voice for more information.

Returns: EVoiceResult


bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket );
pTicketvoid *The encrypted app ticket is copied into this buffer.
cbMaxTicketintThe total size of the pTicket buffer in bytes.
pcbTicketuint32 *Returns the number of bytes copied into pTicket.

Retrieve an encrypted ticket.

This should be called after requesting an encrypted app ticket with RequestEncryptedAppTicket and receiving the EncryptedAppTicketResponse_t call result.

You should then pass this encrypted ticket to your secure servers to be decrypted using your secret key using SteamEncryptedAppTicket::BDecryptTicket.

NOTE: If you call this without calling RequestEncryptedAppTicket, the call may succeed but you will likely get a stale ticket.

Returns: bool
true if the call successfully returned an app ticket into pTicket.
false under the following conditions:
  • pcbTicket is NULL
  • pTicket is NULL
  • pTicket is too small to hold this ticket.
  • There was no ticket available. (Did you wait for EncryptedAppTicketResponse_t?)


int GetGameBadgeLevel( int nSeries, bool bFoil );
nSeriesintIf you only have one set of cards, the series will be 1.
bFoilboolCheck if they have received the foil badge.

Gets the level of the users Steam badge for your game.

The user has can have two different badges for a series; the regular badge (max level 5) and the foil badge (max level 1).

Returns: int
The level of the badge, 0 if they don't have it.


HSteamUser GetHSteamUser();
Gets Steam user handle that this interface represents.

This is only used internally by the API, and by a few select interfaces that support multi-user.

Returns: HSteamUser


int GetPlayerSteamLevel();
Gets the Steam level of the user, as shown on their Steam community profile.

Returns: int
The level of the current user.


CSteamID GetSteamID();
Gets the Steam ID of the account currently logged into the Steam client. This is commonly called the 'current user', or 'local user'.

A Steam ID is a unique identifier for a Steam accounts, Steam groups, Lobbies and Chat rooms, and used to differentiate users in all parts of the Steamworks API.

Returns: CSteamID

CSteamID steamID = SteamUser()->GetSteamID();


bool GetUserDataFolder( char *pchBuffer, int cubBuffer );
pchBufferchar *

Deprecated - You should use the Steam Cloud API from ISteamRemoteStorage instead.

Returns: bool


EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed_Deprecated = false, void *pUncompressedDestBuffer_Deprecated = 0, uint32 cbUncompressedDestBufferSize_Deprecated = 0, uint32 *nUncompressBytesWritten_Deprecated = 0, uint32 nUncompressedVoiceDesiredSampleRate_Deprecated = 0 );
bWantCompressedboolThis should always be true.
pDestBuffervoid *The buffer where the audio data will be copied into.
cbDestBufferSizeuint32The size of the buffer allocated for pDestBuffer.
nBytesWrittenuint32 *Returns the number of bytes written into pDestBuffer. This should always be the size returned by ISteamUser::GetAvailableVoice.
pUncompressedDestBuffer_Deprecatedvoid *Deprecated.
nUncompressBytesWritten_Deprecateduint32 *Deprecated.

Read captured audio data from the microphone buffer.

The compressed data can be transmitted by your application and decoded back into raw audio data using DecompressVoice on the other side. The compressed data provided is in an arbitrary format and is not meant to be played directly.

This should be called once per frame, and at worst no more than four times a second to keep the microphone input delay as low as possible. Calling this any less may result in gaps in the returned stream.

It is recommended that you pass in an 8 kilobytes or larger destination buffer for compressed audio. Static buffers are recommended for performance reasons. However, if you would like to allocate precisely the right amount of space for a buffer before each call you may use GetAvailableVoice to find out how much data is available to be read.

NOTE: "Uncompressed" audio is a deprecated feature and should not be used by most applications. It is raw single-channel 16-bit PCM wave data which may have been run through preprocessing filters and/or had silence removed, so the uncompressed audio could have a shorter duration than you expect. There may be no data at all during long periods of silence. Also, fetching uncompressed audio will cause GetVoice to discard any leftover compressed audio, so you must fetch both types at once. Finally, GetAvailableVoice is not precisely accurate when the uncompressed size is requested. So if you really need to use uncompressed audio, you should call GetVoice frequently with two very large (20KiB+) output buffers instead of trying to allocate perfectly-sized buffers. But most applications should ignore all of these details and simply leave the "uncompressed" parameters as NULL/0.

See Steam Voice for more information.

Returns: EVoiceResult


uint32 GetVoiceOptimalSampleRate();
Gets the native sample rate of the Steam voice decoder.

Using this sample rate for DecompressVoice will perform the least CPU processing. However, the final audio quality will depend on how well the audio device (and/or your application's audio output SDK) deals with lower sample rates. You may find that you get the best audio output quality when you ignore this function and use the native sample rate of your audio output device, which is usually 48000 or 44100.

See Steam Voice for more information.

Returns: uint32


int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure );
pAuthBlobvoid *A pointer to empty memory that will be filled in with the authentication token.
cbMaxAuthBlobintThe number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.
steamIDGameServerCSteamIDThe Steam ID of the game server, received from the game server by the client.
unIPServeruint32The IP address of the game server in host order, i.e == 0x7f000001.
usPortServeruint16The connection port of the game server, in host order.
bSecureboolWhether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running.)

This starts the state machine for authenticating the game client with the game server.

It is the client portion of a three-way handshake between the client, the game server, and the steam servers.

NOTE: When you're done with the connection you must call TerminateGameConnection.

NOTE: This is part of the old user authentication API and should not be mixed with the new API.

Returns: int
The number of bytes written to pBlob.

Returns 0 indicating failure, signifying that the pAuthBlob buffer passed in was too small, and the call has failed.

The contents of pAuthBlob should then be sent to the game server, for it to use to complete the authentication process.


SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude );
pDataToIncludevoid *The data which will be encrypted into the ticket.
cbDataToIncludeintThe total size in bytes of pDataToInclude.

Requests an application ticket encrypted with the secret "encrypted app ticket key".

The encryption key can be obtained from the Encrypted App Ticket Key page on the App Admin for your app.

There can only be one EncryptedAppTicketResponse_t pending, and this call is subject to a 60 second rate limit.

After receiving the response you should call GetEncryptedAppTicket to get the ticket data, and then you need to send it to a secure server to be decrypted with the SteamEncryptedAppTicket functions.

Returns: SteamAPICall_t to be used with a EncryptedAppTicketResponse_t call result.

class CEncryptedAppTicketExample { public: void RetrieveEncryptedAppTicket(); private: void OnEncryptedAppTicketResponse( EncryptedAppTicketResponse_t *pEncryptedAppTicketResponse, bool bIOFailure ); CCallResult< CEncryptedAppTicketExample, EncryptedAppTicketResponse_t > m_EncryptedAppTicketResponseCallResult; }; void CEncryptedAppTicketExample::RetrieveEncryptedAppTicket() { SteamAPICall_t hSteamAPICall = SteamUser()->RequestEncryptedAppTicket( &k_unSecretData, sizeof( k_unSecretData ) ); m_EncryptedAppTicketResponseCallResult.Set( hSteamAPICall, this, &CEncryptedAppTicketExample::OnEncryptedAppTicketResponse ); } void CEncryptedAppTicketExample::OnEncryptedAppTicketResponse( EncryptedAppTicketResponse_t *pEncryptedAppTicketResponse, bool bIOFailure ) { if ( bIOFailure ) { printf( "There has been an IO Failure when requesting the Encrypted App Ticket.\n" ); return; } switch ( pEncryptedAppTicketResponse->m_eResult ) { case k_EResultOK: { uint8 rgubTicket[1024]; uint32 cubTicket; if ( SteamUser()->GetEncryptedAppTicket( rgubTicket, sizeof( rgubTicket ), &cubTicket ) ) { // Normally at this point you would transmit the encrypted ticket to a trusted service that knows the decryption key // This code is just to demonstrate the ticket decrypting library DecryptTicket( rgubTicket, cubTicket ); } else printf( "GetEncryptedAppTicket failed.\n" ); } break; case k_EResultNoConnection: printf( "Calling RequestEncryptedAppTicket while not connected to steam results in this error.\n" ); break; case k_EResultDuplicateRequest: printf( "Calling RequestEncryptedAppTicket while there is already a pending request results in this error.\n" ); break; case k_EResultLimitExceeded: printf( "Calling RequestEncryptedAppTicket more than once per minute returns this error.\n" ); break; } }


SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL );
pchRedirectURLconst char *

Requests a URL which authenticates an in-game browser for store check-out, and then redirects to the specified URL.

As long as the in-game browser accepts and handles session cookies, Steam microtransaction checkout pages will automatically recognize the user instead of presenting a login page.

NOTE: The URL has a very short lifetime to prevent history-snooping attacks, so you should only call this API when you are about to launch the browser, or else immediately navigate to the result URL using a hidden browser window.

NOTE: The resulting authorization cookie has an expiration time of one day, so it would be a good idea to request and visit a new auth URL every 12 hours.

Returns: SteamAPICall_t to be used with a StoreAuthURLResponse_t call result.
Returns k_uAPICallInvalid if no connection to the Steam servers could be made.


void StartVoiceRecording();
Starts voice recording.

Once started, use GetAvailableVoice and GetVoice to get the data, and then call StopVoiceRecording when the user has released their push-to-talk hotkey or the game session has completed.

See Steam Voice for more information.


void StopVoiceRecording();
Stops voice recording.

Because people often release push-to-talk keys early, the system will keep recording for a little bit after this function is called. As such, GetVoice should continue to be called until it returns k_EVoiceResultNotRecording, only then will voice recording be stopped.


void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer );

Notify the game server that we are disconnecting.

This needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection call.

NOTE: This is part of the old user authentication API and should not be mixed with the new API.


void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" );
pchExtraInfoconst char *

Deprecated - Only used by only a few games to track usage events before Stats and Achievements was introduced.


EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID );
steamIDCSteamIDThe Steam ID of the user that sent the auth ticket.
appIDAppId_tThe DLC App ID to check if the user owns it.

Checks if the user owns a specific piece of Downloadable Content (DLC).

This can only be called after sending the users auth ticket to ISteamGameServer::BeginAuthSession/

Returns: EUserHasLicenseForAppResult

See Also: User Authentication and Ownership


These are callbacks which can be fired by calling SteamAPI_RunCallbacks. Many of these will be fired directly in response to the member functions of ISteamUser.


Sent by the Steam server to the client telling it to disconnect from the specified game server, which it may be in the process of or already connected to.
The game client should immediately disconnect upon receiving this message.
This can usually occur if the user doesn't have rights to play on the game server.

m_uAppIDuint32The App ID this call is for. Verify that it's the same as the current App ID with ISteamUtils::GetAppID.
m_unGameServerIPuint32The IP of the game server that is telling us to disconnect, in host order, i.e == 0x7f000001.
m_usGameServerPortuint16The port of the game server that is telling us to disconnect, in host order.
m_bSecureuint16Is the game server VAC secure (true) or not (false)?


Called when an encrypted application ticket has been received.

m_eResultEResultWas the call successful?
Possible results:

Associated Functions: RequestEncryptedAppTicket


Sent to your game in response to a steam://gamewebcallback/ command from a user clicking a link in the Steam overlay browser.
You can use this to add support for external site signups where you want to pop back into the browser after some web page signup sequence, and optionally get back some detail about that.

m_szURLchar[256]The complete url that the user clicked on.


Result when creating an auth session ticket.

m_hAuthTicketHAuthTicketThe handle to the ticket that was created.
m_eResultEResultThe result of the operation.

Associated Functions: GetAuthSessionTicket


Called when the callback system for this client is in an error state (and has flushed pending callbacks)
When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect.
This usually occurs in the rare event the Steam client has some kind of fatal error.

m_eFailureTypeuint8This is a EFailureType.


Called whenever the users licenses (owned packages) changes.

This callback has no fields.


Called when a user has responded to a microtransaction authorization request.

m_unAppIDuint32App ID for this microtransaction
m_ulOrderIDuint64Order ID provided for the microtransaction.
m_bAuthorizeduint8Did the user authorize the transaction (1) or not (0)?


Called when a connection attempt has failed.
This will occur periodically if the Steam client is not connected, and has failed when retrying to establish a connection.

m_eResultEResultThe reason why the connection failed.
m_bStillRetryingboolIs the Steam client still trying to connect to the server?


Called when a connections to the Steam back-end has been established.
This means the Steam client now has a working connection to the Steam servers. Usually this will have occurred before the game has launched, and should only be seen if the user has dropped connection due to a networking issue or a Steam server update.

This callback has no fields.


Called if the client has lost connection to the Steam servers.
Real-time services will be disabled until a matching SteamServersConnected_t has been posted.

m_eResultEResultThe reason we were disconnected from Steam.


Response when we have recieved the authentication URL after a call to RequestStoreAuthURL.

m_szURLchar[512]The authentication URL.

Associated Functions: RequestStoreAuthURL


Called when an auth ticket has been validated.

m_SteamIDCSteamIDThe Steam ID of the entity that provided the auth ticket.
m_eAuthSessionResponseEAuthSessionResponseThe result of the validation.
m_OwnerSteamIDCSteamIDThe Steam ID that owns the game, this will be different from m_SteamID if the game is being borrowed via Steam Family Sharing.

Associated Functions: BeginAuthSession


These are structs which functions in ISteamUser may return and/or interact with.


The structure that contains client callback data. This is only used internally inside SteamAPI_RunCallbacks.

m_hSteamUserHSteamUserThe user this callback is sent to.
m_iCallbackintThe unique ID of the callback.
m_pubParamuint8 *The pointer to the callback data.
m_cubParamintThe size of [param]m_pubParam[/param].


These are enums which are defined for use with ISteamUser.


Specifies what type of failure happened in IPCFailure_t.



These are constants which are defined for use with ISteamUser.