Skip to main content

Get Platform Analytics

Retrieves user count statistics by role for a specific platform.

Endpoint

GET /api/platform/analytics/:id

Authentication

Authentication is required. The user must have an admin role.

Path Parameters

ParameterTypeRequiredDescription
idintegerYesThe ID of the platform to retrieve analytics for

Response

Success Response

Code: 200 OK

Content:

{
"free": 88,
"premium": 52,
"basic": 281,
"admin": 6
}

The response contains a count of users for each role type:

  • free: Number of users with the free role
  • premium: Number of users with the premium role
  • basic: Number of users with the basic role
  • admin: Number of users with the admin role

Error Response

Code: 400 Bad Request

Content: {error}

Notes

  • This endpoint is primarily used for dashboard displays and administrative reporting
  • The counts represent the current state of user roles, not historical data
  • Only platform administrators can access this data to protect user privacy
  • The data is retrieved directly from the database and is not cached

Example

curl -X GET "https://api.tribesocial.io/api/platform/analytics/36" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json"