API Documentation

XTracker REST API Reference

Overview

The XTracker API provides access to user tracking data, tweet metrics, and analytics.

Base URL: http://localhost:3000/api

Public Endpoints

GET/users

Get all tracked users with their tracking periods.

Query Parameters:
  • includeInactive (boolean) - Include inactive trackings
// Example Response
{
  "success": true,
  "data": [
    {
      "id": "uuid",
      "handle": "elonmusk",
      "name": "Elon Musk",
      "platformId": "44196397",
      "avatarUrl": "https://...",
      "verified": true,
      "trackings": [...],
      "_count": { "posts": 1250 }
    }
  ]
}
GET/users/[handle]

Get a specific user by their handle.

// Example: GET /users/elonmusk
GET/users/[handle]/trackings

Get all tracking periods for a specific user.

Query Parameters:
  • activeOnly (boolean) - Only return active trackings
GET/trackings

Get all tracking periods across all users.

Query Parameters:
  • activeOnly (boolean, default: true) - Filter to active trackings only
GET/trackings/[id]

Get a specific tracking period with optional statistics.

Query Parameters:
  • includeStats (boolean) - Include computed statistics
GET/metrics/[userId]

Get metrics for a specific user.

Query Parameters:
  • type (string, default: "daily") - Metric type
  • startDate (ISO date) - Start date filter
  • endDate (ISO date) - End date filter

Admin Endpoints

Admin endpoints are only visible to authenticated administrators.Login to view admin endpoints →

Response Format

All endpoints return JSON in this format:

// Success Response
{
  "success": true,
  "data": { ... },
  "message": "Optional success message"
}

// Error Response
{
  "success": false,
  "error": "Error message description"
}

Rate Limiting

Public endpoints are rate-limited to prevent abuse. Admin endpoints have higher limits. Rate limit information is included in response headers.