> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bloxiana.lol/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Snipe WebSocket API

> Real-time player tracking system for Roblox games

# Snipe WebSocket API

The Snipe WebSocket API enables real-time tracking of Roblox players across game servers using advanced search techniques.

## Authentication

```javascript theme={null}
const ws = new WebSocket('wss://your-snipe-server.com');
ws.on('open', () => {
  ws.send(JSON.stringify({
    type: 'AUTH',
    key: 'YOUR_API_KEY_HERE'
  }));
});
```

All connections require authentication with a valid API key.

## Endpoints

### `START_SNIPE`

Initiates a player search operation.

**Request:**

```json theme={null}
{
  "type": "START_SNIPE",
  "snipeId": "123456789",
  "userInfo": {
    "id": 123456789,
    "name": "RobloxUsername",
    "displayName": "DisplayName",
    "playerToken": "optional_player_token"
  },
  "gameInfo": {
    "name": "Game Name",
    "placeId": 1234567890,
    "universeId": 1234567890,
    "deepSearch": false
  },
  "thumbnailUrl": "https://thumbnails.roblox.com/...",
  "searchType": "basic|deep"
}
```

**Responses:**

* `PLAYER_FOUND`
* `PLAYER_NOT_FOUND`
* `PLAYER_IN_DIFFERENT_GAME`
* `PROGRESS_UPDATE`
* `ERROR`

### `CANCEL_SNIPE`

Cancels an ongoing snipe operation.

**Request:**

```json theme={null}
{
  "type": "CANCEL_SNIPE",
  "snipeId": "123456789"
}
```

### `GET_STATS`

Retrieves server statistics.

**Request:**

```json theme={null}
{
  "type": "GET_STATS"
}
```

**Response:**

```json theme={null}
{
  "type": "STATS_RESPONSE",
  "stats": {
    "startTime": 1234567890,
    "uptime": 3600000,
    "totalSnipes": 100,
    "successfulSnipes": 85,
    "failedSnipes": 15,
    "currentConnections": 10,
    "activeSnipes": 5,
    "deepSearchQueueSize": 2,
    "deepSearchActive": 3,
    "memoryUsage": 256.5
  }
}
```

## Response Types

### Player Found

```json theme={null}
{
  "type": "PLAYER_FOUND",
  "snipeId": "123456789",
  "server": {
    "id": "server_job_id",
    "playing": 12,
    "maxPlayers": 30,
    "playerTokens": ["token1", "token2"]
  },
  "playerToken": "found_player_token",
  "searchMethod": "token_cache|thumbnail_match|public_join_data",
  "serversScanned": 150,
  "searchTime": 45000
}
```

### Player Not Found

```json theme={null}
{
  "type": "PLAYER_NOT_FOUND",
  "snipeId": "123456789",
  "serversScanned": 200,
  "searchTime": 60000
}
```

### Player In Different Game

```json theme={null}
{
  "type": "PLAYER_IN_DIFFERENT_GAME",
  "snipeId": "123456789",
  "actualGame": {
    "universeId": 987654321,
    "placeId": 9876543210,
    "gameId": "different_job_id",
    "lastLocation": "Different Game Name"
  },
  "searchMethod": "public_join_data",
  "searchTime": 5000
}
```

## Code Examples

### discord.js Implementation

```javascript theme={null}
const { WebSocket } = require('ws');
const { EmbedBuilder } = require('discord.js');

class SnipeManager {
  constructor(client) {
    this.client = client;
    this.ws = null;
    this.activeSnipes = new Map();
    this.reconnectInterval = 5000;
    
    this.connect();
  }

  // ... (implementation details)
}
```

### discord.py Implementation

```python theme={null}
import websockets
import json
from discord import Embed

class SnipeManager:
    def __init__(self, bot):
        self.bot = bot
        self.active_snipes = {}
        self.ws = None
        self.reconnect_interval = 5
        
    async def connect(self):
        # ... (implementation details)
```

## Roblox API Requirements

### User Information

```javascript theme={null}
async function getUserInfo(userIdOrName) {
  const response = await fetch(`https://users.roblox.com/v1/users/${userIdOrName}`);
  if (!response.ok) throw new Error('User not found');
  return await response.json();
}
```

### Game Information

```javascript theme={null}
async function getGameInfo(placeId) {
  const placeResponse = await fetch(`https://apis.roblox.com/universes/v1/places/${placeId}/universe`);
  if (!placeResponse.ok) throw new Error('Place not found');
  const { universeId } = await placeResponse.json();
  
  const universeResponse = await fetch(`https://games.roblox.com/v1/games?universeIds=${universeId}`);
  if (!universeResponse.ok) throw new Error('Universe not found');
  const { data: [gameInfo] } = await universeResponse.json();
  
  return {
    name: gameInfo.name,
    placeId,
    universeId
  };
}
```

## Error Handling

Common error responses include:

```json theme={null}
{
  "type": "ERROR",
  "error": "Authentication failed",
  "details": "Invalid API key"
}
```

```json theme={null}
{
  "type": "ERROR",
  "error": "Invalid message type",
  "details": "Unknown message type received"
}
```

## Rate Limits

* Maximum 50 concurrent snipes per connection
* 10 snipe requests per minute
* 1000 WebSocket messages per minute

***

This documentation follows Mintlify's structure with:

1. Clear endpoint definitions
2. Code examples in multiple languages
3. Response schemas
4. Error handling details
5. Required external API information

The content is organized in a way that Mintlify can automatically generate a beautiful documentation site with interactive code examples and API explorer.
