rta

Get RTA nonce token

Returns a nonce token for establishing a WebSocket connection to Xbox Live's Real-Time Activity (RTA) service.

What is RTA?

Real-Time Activity is Xbox Live's push notification system that allows you to subscribe to real-time updates for:

  • Rich Presence - Live status updates (what game, what activity)
  • Party Details - Party membership changes
  • Multiplayer Activity - Session join/leave events
  • Social Events - Friend list changes

WebSocket Connection

After obtaining the nonce, connect to the RTA WebSocket:

const response = await fetch('https://api.xbl.io/v2/rta', {
  headers: { 'X-Authorization': 'YOUR_API_KEY' }
});
const nonce = await response.text();

const socket = new WebSocket(
  `wss://rta.xboxlive.com/connect?nonce=${nonce}`,
  'rta.xboxlive.com.V2'
);

socket.onopen = () => {
  // Subscribe to presence changes for a user
  socket.send('[1,0,"https://userpresence.xboxlive.com/users/xuid(2533274792093122)/richpresence"]');

  // Subscribe to party details
  socket.send('[1,1,"http://sessiondirectory.xboxlive.com/users/xuid(2533274792093122)/partydetails"]');

  // Subscribe to multiplayer activity
  socket.send('[1,2,"https://multiplayeractivity.xboxlive.com/users/xuid(2533274792093122)"]');

  // Subscribe to friend list changes
  socket.send('[1,3,"http://social.xboxlive.com/users/xuid(2533274792093122)/friends"]');
};

socket.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('RTA Event:', data);
};

Subscription Message Format

[1, subscriptionId, "resourceUri"]

  • 1 - Message type (subscribe)
  • subscriptionId - Unique ID for this subscription (use incrementing integers)
  • resourceUri - The Xbox Live resource to subscribe to

Common Resource URIs

ResourceURI Pattern
Rich Presencehttps://userpresence.xboxlive.com/users/xuid({xuid})/richpresence
Party Detailshttp://sessiondirectory.xboxlive.com/users/xuid({xuid})/partydetails
Multiplayerhttps://multiplayeractivity.xboxlive.com/users/xuid({xuid})
Friendshttp://social.xboxlive.com/users/xuid({xuid})/friends
get/v2/rta

Response

RTA nonce token for WebSocket connection

{"stackTrail":"components:schemas:ApiResponse:properties:content","oasType":"schema","type":"unknown","description":"The response payload from the upstream Xbox/Microsoft API. The structure varies by endpoint - can be an object, array, or string."}
codeinteger required

HTTP status code from the upstream API. Common values: 200 (success), 400 (bad request), 401 (unauthorized), 404 (not found), 410 (deprecated/gone), 429 (rate limited), 500 (server error)

Example response

{
  "code": 200
}

Changes