JavaScript SDK — Friends

Friends — mp.friends

list
await mp.friends.list(playerToken)

Returns the player's friend list with presence.

lookup
await mp.friends.lookup(playerToken, playerTag)

Finds a player by Name#tag — the string shown at registration.

request
await mp.friends.request(playerToken, { playerTag?, playerId? })

Sends a friend request by tag or id.

accept / decline / remove
await mp.friends.accept(playerToken, playerId)
await mp.friends.decline(playerToken, playerId)
await mp.friends.remove(playerToken, playerId)

Answer incoming requests and manage the list.

steam
await mp.friends.steam(playerToken, steamIds)

Imports Steam friends — array of SteamID64 strings; matches players who registered with Steam.

invite / invites
await mp.friends.invite(playerToken, playerId)
await mp.friends.invites(playerToken)

Sends a game/room invite; lists pending invites.

acceptInvite / declineInvite
await mp.friends.acceptInvite(playerToken, inviteId)
await mp.friends.declineInvite(playerToken, inviteId)

Answers an invite by its invite_id.

Tags, requests and invites

Every player gets a shareable #tag: lookup resolves it to a player id, and request sends a friend request by tag or id. Requests sit pending until the other side accepts or declines; once accepted the relationship appears in both players' lists together with presence, so you can show who is online.

Invites ride the same graph — a friend can be pulled straight into a matchmaking lobby or a room, and pending invites can be listed and answered by id. Steam-enabled games can additionally import the Steam friends list: pass SteamID64 strings and the API matches them to players who registered through Steam.

  • Poll the list on a cadence or after realtime events — not every frame; presence does not change that fast.
  • Invites reference a lobby or room, so private sessions stay out of the public browser entirely.
  • Cache a resolved tag before repeated lookups — tags stay stable for the lifetime of the player.
  • Every call returns a Promise — await inside async functions. In browsers requests run over fetch with CORS; on Node.js 22.12+ the identical API uses the built-in fetch.