-
Notifications
You must be signed in to change notification settings - Fork 1
SteamID Model
SteamID is the identity model used across the Steam ecosystem.
It is not limited to player accounts. A SteamID can identify individuals, clans, game servers, chat objects, anonymous accounts, and other Steam account types.
steam-go exposes local SteamID parsing and conversion through:
import "github.com/gofurry/steam-go/steamid"The package is entirely local. It does not require a Steam Web API key and does not make network requests.
The canonical Steam identity is a packed 64-bit value:
63 56 55 52 51 32 31 0
┌────────────────────┬───────────┬─────────────────────┬────────────────────┐
│ Universe 8 bits │ Type 4bit │ Instance 20 bits │ AccountID 32 bits │
└────────────────────┴───────────┴─────────────────────┴────────────────────┘
Conceptually:
SteamID
=
Universe
+ AccountType
+ Instance
+ AccountID
These components give a SteamID more meaning than a plain numeric user ID.
For example, the same 32-bit AccountID could theoretically belong to identities with different account types or instances.
Steam identities appear in several common forms.
| Representation | Example | Typical use |
|---|---|---|
| AccountID | 12345 |
Low 32-bit account identifier |
| SteamID64 | 76561197960278073 |
Steam Web API and Community profiles |
| Steam2 | STEAM_1:1:6172 |
Source / GoldSrc server tooling |
| Steam3 | [U:1:12345] |
Modern typed Steam identity representation |
These are not four unrelated identifiers.
They are different representations of Steam identity data.
For a normal Public Individual account:
AccountID: 12345
↓
SteamID64:
76561197960278073
Steam2:
STEAM_1:1:6172
Steam3:
[U:1:12345]
AccountID is only the low 32 bits of a SteamID.
By itself, it does not contain:
- Universe
- AccountType
- Instance
Because of this, converting an AccountID into a full SteamID requires additional assumptions.
steam-go interprets a standalone AccountID through steamid.Parse as a Public Individual Desktop identity.
For explicit construction, use:
id, err := steamid.NewIndividual(12345)or provide all components with steamid.New.
SteamID64 is the packed 64-bit representation commonly seen in Steam Web APIs.
For example:
76561197960278073
A numeric Steam Community profile URL also contains this form:
https://steamcommunity.com/profiles/76561197960278073
In steam-go:
id, err := steamid.ParseSteamID64("76561197960278073")Use ParseCommunityURL when parsing the URL form.
Steam2 IDs use the familiar Source-style representation:
STEAM_X:Y:Z
Example:
STEAM_1:1:6172
They are mainly meaningful for Individual accounts and are common in Source / GoldSrc server administration, ban lists, and older tooling.
Historical software may expose Public universe IDs as:
STEAM_0:...
while the canonical Public universe is 1.
steam-go accepts both STEAM_0 and STEAM_1 for Public IDs and emits STEAM_1 as its canonical representation.
Steam2 cannot represent every possible Steam identity without losing information. steam-go therefore returns an error instead of inventing a lossy conversion.
Steam3 explicitly carries an account type character:
[U:1:12345]
Common examples include:
| Character | Meaning |
|---|---|
U |
Individual |
G |
Game server |
A |
Anonymous game server |
g |
Clan |
T |
Chat |
c |
Clan chat |
L |
Lobby |
a |
Anonymous user |
Steam3 may also contain an explicit instance:
[U:1:12345:2]
The account type is important. [U:...] and [g:...], for example, are not interchangeable even when their AccountID component is the same.
Steam Community commonly uses two profile URL forms:
/profiles/<SteamID64>
and:
/id/<vanity>
A numeric /profiles/ URL can be parsed locally:
id, err := steamid.ParseCommunityURL(
"https://steamcommunity.com/profiles/76561197960278073",
)A vanity URL such as:
https://steamcommunity.com/id/example-user
does not contain the SteamID.
Resolving it requires a Steam network request. steam-go deliberately keeps this separate: steamid.ParseCommunityURL reports a vanity reference, while the existing client.API.SteamUser.ResolveVanityURL capability performs network resolution.
For general local input:
id, err := steamid.Parse("STEAM_1:1:6172")
if err != nil {
return err
}
fmt.Println(id.String())
fmt.Println(id.AccountID())
fmt.Println(id.Universe())
fmt.Println(id.AccountType())
fmt.Println(id.Instance())Parse accepts:
- AccountID
- SteamID64
- Steam2
- Steam3
It does not automatically resolve vanity names or fetch profile data.
- Use SteamID64 when interacting with most Steam Web APIs.
- Use Steam2 when interoperating with Source / GoldSrc tooling that expects it.
- Prefer Steam3 when the account type and instance are important.
- Do not treat AccountID as a complete Steam identity without knowing the missing components.
- Do not assume every numeric
uint64is a structurally valid SteamID. - Do not perform lossy conversion between representations silently.
- Treat vanity names as references that require explicit network resolution.
For the complete steam-go API, validation rules, conversion behavior, and error model, see docs/steamid.md.
____ ____ ____ _ _ ____ ____ _ _ / ____ ___ ____ ____ _ _ ____ ____
| __ | | |___ | | |__/ |__/ \_/ / [__ | |___ |__| |\/| __ | __ | |
|__] |__| | |__| | \ | \ | / ___] | |___ | | | | |__] |__|
- SteamID Model
- Steam Web API Notes
- Public Store Page Access Notes
- Partner API Notes
- OpenID Notes
- A2S Notes
- Steam Keys and Access Tokens
- Steam Static Assets
- Steam VDF and addons/vdf
- Steam Web API 特性说明
- 公开商店页面访问说明
- Partner API 说明
- OpenID 说明
- A2S 说明
- Steam Key 与 Access Token
- Steam 静态资源
- Steam VDF 与 addons/vdf