API Documentation

Integrate with TPDB services using our REST APIs

On This Page

Authentication

All API endpoints require an API key.

Authorization: Bearer YOUR_API_KEY

API requests are limited to 24000 requests per day per API key.

Verify API

GET /api/verify

Verify a user by email, phone, playerId, or IP address. Used to check if a user exists and assess their risk level.

Query Parameters

NameTypeDescriptionRequired
emailstringUser email addressNo
phonestringUser phone numberNo
playerIdstringUser player IDNo
ipstringUser IP addressNo
idstringUser IDNo
extraEmailstringAdditional email to checkNo

Example Response

{
  "exists": true,
  "userId": [
    "string"
  ],
  "meta": [
    {
      "id": "string",
      "email": "us**@example.com",
      "phone": [
        "123****7890"
      ],
      "names": [
        "Jo** Do*"
      ],
      "playerIds": [
        "player123"
      ]
    }
  ],
  "riskLevel": "normal",
  "riskDetails": "User has no reports",
  "reportCount": 0,
  "privacyNotice": "Some personal information is partially masked for privacy protection."
}

Notes

  • At least one identifier (email, phone, playerId, or ip) must be provided
  • Personal information in the response is partially masked for privacy
  • The risk level can be "normal", "low", "medium", or "high"

Collect API

POST /api/collect

Send user data and transaction information to be stored in the system.

Request Body

{
  "user": {
    "email": "[email protected]",
    "phone": "+1234567890",
    "name": "John Doe",
    "playerId": "player123",
    "note": "Optional note",
    "ip": "192.168.1.1",
    "extraEmail": "[email protected]"
  },
  "transaction": {
    "orderId": "ORD12345",
    "productName": "Premium Subscription",
    "amount": "99.99",
    "paymentMethod": "Credit Card",
    "paymentNumber": "xxxx-xxxx-xxxx-1234",
    "paymentTransactionId": "TXN987654321"
  }
}

Example Response

{
  "success": true,
  "userId": "string",
  "message": "Data collected successfully"
}

Notes

  • The user object is required, while transaction is optional
  • Only email is required in the user object; all other fields are optional
  • When including a transaction, all fields except paymentNumber and paymentTransactionId are required

Statistics APIs

Access comprehensive analytics and statistics about your TPDB integration. Perfect for building dashboards and monitoring your platform's security metrics.

Common Query Parameters

ParameterTypeOptionsDescription
periodstringtoday, week, month, year, allTime period for data analysis (default: month)
limitnumber1-100Number of items to return for lists (default: 10)
GET /api/stats/analytics

Get comprehensive analytics including blocks, warnings, trends, and impact metrics.

Example Response

{
  "success": true,
  "data": {
    "summary": {
      "totalBlocked": 1245,
      "totalWarned": 823,
      "totalUsers": 15643,
      "totalTransactions": 89234,
      "totalReports": 567,
      "totalAppeals": 89
    },
    "trends": {
      "dailyBlocked": [
        12,
        15,
        8,
        22,
        18,
        25,
        19
      ],
      "dailyWarned": [
        8,
        11,
        6,
        14,
        12,
        16,
        13
      ],
      "userGrowth": [
        150,
        178,
        142,
        189,
        156,
        203,
        167
      ],
      "transactionVolume": [
        2340,
        2567,
        2145,
        2789,
        2456,
        2890,
        2634
      ],
      "reportVolume": [
        15,
        18,
        12,
        23,
        19,
        27,
        21
      ]
    },
    "performance": {
      "averageResponseTime": 245,
      "riskDetectionRate": 94.2,
      "falsePositiveRate": 2.1,
      "systemUptime": 99.8
    },
    "impact": {
      "fraudPrevented": 234567.89,
      "minorsProtected": 456,
      "moneyProtected": 1234567.89,
      "trustScore": 92.5
    }
  }
}
GET /api/stats/reports

Get detailed report statistics including breakdowns by type, status, and quality metrics.

Example Response

{
  "success": true,
  "data": {
    "summary": {
      "totalReports": 567,
      "pendingReports": 45,
      "approvedReports": 456,
      "rejectedReports": 66
    },
    "breakdown": {
      "byType": {
        "fraud": 234,
        "harassment": 156,
        "impersonation": 89,
        "other": 88
      },
      "byStatus": {
        "pending": 45,
        "approved": 456,
        "rejected": 66
      },
      "byReporterType": {
        "verified": 423,
        "unverified": 144
      }
    },
    "recentActivity": [
      {
        "id": "rpt_123",
        "type": "fraud",
        "status": "approved",
        "createdAt": "2024-01-15T10:30:00Z"
      },
      {
        "id": "rpt_124",
        "type": "harassment",
        "status": "pending",
        "createdAt": "2024-01-15T09:15:00Z"
      }
    ],
    "quality": {
      "averageResolutionTime": 2.5,
      "accuracyRate": 96.8,
      "reporterSatisfaction": 4.2
    }
  }
}
GET /api/stats/appeals

Get appeal statistics including success rates, common rejection reasons, and trends.

Example Response

{
  "success": true,
  "data": {
    "summary": {
      "totalAppeals": 89,
      "pendingAppeals": 12,
      "approvedAppeals": 34,
      "rejectedAppeals": 43
    },
    "breakdown": {
      "byReportType": {
        "fraud": 45,
        "harassment": 23,
        "impersonation": 12,
        "other": 9
      },
      "byOutcome": {
        "approved": 34,
        "rejected": 43,
        "pending": 12
      }
    },
    "outcomes": {
      "successRate": 44.1,
      "commonRejectionReasons": [
        {
          "reason": "Insufficient evidence",
          "count": 18
        },
        {
          "reason": "Previous violations",
          "count": 12
        },
        {
          "reason": "Invalid appeal",
          "count": 8
        }
      ]
    },
    "recentActivity": [
      {
        "id": "app_456",
        "reportType": "fraud",
        "status": "approved",
        "createdAt": "2024-01-15T14:20:00Z"
      },
      {
        "id": "app_457",
        "reportType": "harassment",
        "status": "rejected",
        "createdAt": "2024-01-15T13:45:00Z"
      }
    ]
  }
}
GET /api/stats/transactions

Get transaction analytics including payment patterns, risk analysis, and volume trends.

Example Response

{
  "success": true,
  "data": {
    "summary": {
      "totalTransactions": 89234,
      "successfulTransactions": 86789,
      "failedTransactions": 2445,
      "totalVolume": 4567890.12
    },
    "breakdown": {
      "byPaymentMethod": {
        "creditCard": 45123,
        "paypal": 23456,
        "bankTransfer": 12345,
        "crypto": 8310
      },
      "byAmountRange": {
        "0-50": 23456,
        "51-200": 34567,
        "201-1000": 23456,
        "1000+": 7755
      }
    },
    "timeAnalysis": {
      "hourlyTrends": [
        890,
        1234,
        1567,
        2345,
        3456,
        4567,
        3890
      ],
      "dailyVolume": [
        23456,
        25678,
        22345,
        27890,
        24567,
        28901,
        26789
      ],
      "weeklyGrowth": 12.5,
      "monthlyGrowth": 8.3
    },
    "riskAnalysis": {
      "flaggedTransactions": 234,
      "riskScore": 15.2,
      "preventedFraud": 45678.9
    }
  }
}
GET /api/stats/users

Get user statistics including behavior metrics, growth trends, and risk distribution.

Example Response

{
  "success": true,
  "data": {
    "summary": {
      "totalUsers": 15643,
      "activeUsers": 12456,
      "blockedUsers": 234,
      "newUsersThisPeriod": 567
    },
    "breakdown": {
      "byRiskLevel": {
        "normal": 14234,
        "low": 890,
        "medium": 345,
        "high": 174
      },
      "byStatus": {
        "active": 12456,
        "inactive": 2953,
        "blocked": 234
      }
    },
    "behavior": {
      "averageTransactionsPerUser": 5.7,
      "averageSessionDuration": 23.5,
      "returnRate": 78.3
    },
    "growth": {
      "dailySignups": [
        45,
        52,
        38,
        67,
        51,
        73,
        59
      ],
      "monthlyGrowth": 15.2,
      "retentionRate": 82.1
    },
    "mostActive": [
      {
        "userId": "usr_123",
        "transactionCount": 234,
        "riskLevel": "normal"
      },
      {
        "userId": "usr_124",
        "transactionCount": 198,
        "riskLevel": "low"
      }
    ]
  }
}
GET /api/stats/system-health

Get system health metrics including API performance, uptime, security metrics, and integration status.

Example Response

{
  "success": true,
  "data": {
    "status": "healthy",
    "performance": {
      "averageResponseTime": 245,
      "requestsPerMinute": 1250,
      "errorRate": 0.12,
      "throughput": 98.7
    },
    "resources": {
      "cpuUsage": 35.2,
      "memoryUsage": 67.8,
      "diskUsage": 45.3,
      "networkLatency": 23
    },
    "security": {
      "threatsBlocked": 1245,
      "securityScore": 95.2,
      "vulnerabilitiesFound": 0,
      "lastSecurityScan": "2024-01-15T06:00:00Z"
    },
    "integrations": {
      "databaseHealth": "healthy",
      "apiHealth": "healthy",
      "thirdPartyServices": "healthy",
      "maintenanceMode": false
    },
    "uptime": {
      "current": 99.98,
      "last24Hours": 100,
      "last7Days": 99.92,
      "last30Days": 99.89
    }
  }
}

Health Status Levels

  • healthy: All systems operating normally
  • warning: Some metrics are concerning but system is functional
  • critical: System issues requiring immediate attention