rta

Get chat WebSocket authentication

Returns an authentication token for establishing a WebSocket connection to Xbox Live's Chat service.

What is Xbox Chat WebSocket?

The Chat WebSocket provides real-time messaging capabilities, allowing you to:

  • Receive instant message notifications
  • Send messages in real-time
  • Get typing indicators
  • Receive read receipts

WebSocket Connection

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

const socket = new WebSocket(
  `wss://chat.xboxlive.com/users/xuid(${yourXuid})/chat/connect?AuthKey=${authToken}`,
  'chat'
);

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

Use Cases

  • Real-time chat applications - Build instant messaging features
  • Notification systems - Alert users to new messages
  • Chat bots - Respond to messages automatically
get/v2/rta/chat

Response

Chat authentication token

{"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

No recorded changes to this endpoint across all 1 revision of this API.