Skip to main content
GET
/
api
/
analytics
/
organizer
/
stats
curl -X GET "https://api.gatepass.io/api/analytics/organizer/stats?period=month" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "totalRevenue": 542750.00,
  "ticketsSold": 5234,
  "activeEvents": 8,
  "totalEvents": 24,
  "revenueGrowth": 23.5,
  "ticketsGrowth": 18.2,
  "recentSales": [
    {
      "id": "clx1234567890abcdef",
      "buyer": "[email protected]",
      "amount": 102.50,
      "tickets": 2,
      "timestamp": "2024-05-20T14:30:00Z",
      "eventName": "Tech Conference 2024"
    },
    {
      "id": "clx0987654321fedcba",
      "buyer": "[email protected]",
      "amount": 51.25,
      "tickets": 1,
      "timestamp": "2024-05-20T13:45:00Z",
      "eventName": "Music Festival 2024"
    },
    {
      "id": "clxabcdef123456789",
      "buyer": "[email protected]",
      "amount": 205.00,
      "tickets": 4,
      "timestamp": "2024-05-20T12:20:00Z",
      "eventName": "Startup Networking Event"
    }
  ],
  "topEvents": [
    {
      "eventId": "clx1111111111111111",
      "title": "Tech Conference 2024",
      "revenue": 125500.00,
      "ticketsSold": 1247,
      "totalTickets": 1500,
      "selloutPercentage": 83.1
    },
    {
      "eventId": "clx2222222222222222",
      "title": "Music Festival 2024",
      "revenue": 98750.00,
      "ticketsSold": 1956,
      "totalTickets": 2000,
      "selloutPercentage": 97.8
    },
    {
      "eventId": "clx3333333333333333",
      "title": "Startup Pitch Night",
      "revenue": 45200.00,
      "ticketsSold": 892,
      "totalTickets": 1000,
      "selloutPercentage": 89.2
    },
    {
      "eventId": "clx4444444444444444",
      "title": "Art Exhibition Opening",
      "revenue": 32100.00,
      "ticketsSold": 634,
      "totalTickets": 800,
      "selloutPercentage": 79.3
    },
    {
      "eventId": "clx5555555555555555",
      "title": "Food & Wine Tasting",
      "revenue": 28400.00,
      "ticketsSold": 505,
      "totalTickets": 600,
      "selloutPercentage": 84.2
    }
  ],
  "averageOrderValue": 103.68,
  "conversionRate": 12.3
}
Retrieve comprehensive sales statistics across all events organized by the authenticated user, including revenue, ticket sales, growth metrics, and recent transactions.

Authentication

Authorization
string
required
Bearer token for authentication (organizer role required)

Query Parameters

period
string
default:"all"
Time period for analytics: all, year, month, week
startDate
string
Custom start date for analytics (ISO 8601)
endDate
string
Custom end date for analytics (ISO 8601)

Response

totalRevenue
number
Total revenue across all completed orders
ticketsSold
number
Total number of tickets sold
activeEvents
number
Number of currently active (published and on-sale) events
totalEvents
number
Total number of events created
revenueGrowth
number
Revenue growth percentage compared to previous period
ticketsGrowth
number
Ticket sales growth percentage compared to previous period
recentSales
array
Recent sales transactions (last 10)
topEvents
array
Top 5 events by revenue
averageOrderValue
number
Average order amount
conversionRate
number
Percentage of event views that resulted in ticket purchases
curl -X GET "https://api.gatepass.io/api/analytics/organizer/stats?period=month" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "totalRevenue": 542750.00,
  "ticketsSold": 5234,
  "activeEvents": 8,
  "totalEvents": 24,
  "revenueGrowth": 23.5,
  "ticketsGrowth": 18.2,
  "recentSales": [
    {
      "id": "clx1234567890abcdef",
      "buyer": "[email protected]",
      "amount": 102.50,
      "tickets": 2,
      "timestamp": "2024-05-20T14:30:00Z",
      "eventName": "Tech Conference 2024"
    },
    {
      "id": "clx0987654321fedcba",
      "buyer": "[email protected]",
      "amount": 51.25,
      "tickets": 1,
      "timestamp": "2024-05-20T13:45:00Z",
      "eventName": "Music Festival 2024"
    },
    {
      "id": "clxabcdef123456789",
      "buyer": "[email protected]",
      "amount": 205.00,
      "tickets": 4,
      "timestamp": "2024-05-20T12:20:00Z",
      "eventName": "Startup Networking Event"
    }
  ],
  "topEvents": [
    {
      "eventId": "clx1111111111111111",
      "title": "Tech Conference 2024",
      "revenue": 125500.00,
      "ticketsSold": 1247,
      "totalTickets": 1500,
      "selloutPercentage": 83.1
    },
    {
      "eventId": "clx2222222222222222",
      "title": "Music Festival 2024",
      "revenue": 98750.00,
      "ticketsSold": 1956,
      "totalTickets": 2000,
      "selloutPercentage": 97.8
    },
    {
      "eventId": "clx3333333333333333",
      "title": "Startup Pitch Night",
      "revenue": 45200.00,
      "ticketsSold": 892,
      "totalTickets": 1000,
      "selloutPercentage": 89.2
    },
    {
      "eventId": "clx4444444444444444",
      "title": "Art Exhibition Opening",
      "revenue": 32100.00,
      "ticketsSold": 634,
      "totalTickets": 800,
      "selloutPercentage": 79.3
    },
    {
      "eventId": "clx5555555555555555",
      "title": "Food & Wine Tasting",
      "revenue": 28400.00,
      "ticketsSold": 505,
      "totalTickets": 600,
      "selloutPercentage": 84.2
    }
  ],
  "averageOrderValue": 103.68,
  "conversionRate": 12.3
}

Growth Calculation

Growth percentages are calculated by comparing:
  • Current Period: Selected date range or default period
  • Previous Period: Equal length period immediately before current period
Formula:
growth = ((current - previous) / previous) * 100
Negative values indicate a decline.

Dashboard Integration

This endpoint provides all data needed for an organizer dashboard:

Key Metrics Cards

<MetricCard 
  title="Total Revenue" 
  value={`$${stats.totalRevenue.toLocaleString()}`}
  growth={stats.revenueGrowth}
/>

<MetricCard 
  title="Tickets Sold" 
  value={stats.ticketsSold.toLocaleString()}
  growth={stats.ticketsGrowth}
/>

<MetricCard 
  title="Active Events" 
  value={stats.activeEvents}
/>

<MetricCard 
  title="Avg Order Value" 
  value={`$${stats.averageOrderValue.toFixed(2)}`}
/>

Recent Activity Feed

<ActivityFeed>
  {stats.recentSales.map(sale => (
    <ActivityItem
      key={sale.id}
      buyer={sale.buyer}
      amount={sale.amount}
      tickets={sale.tickets}
      event={sale.eventName}
      time={sale.timestamp}
    />
  ))}
</ActivityFeed>

Performance Leaderboard

<EventLeaderboard>
  {stats.topEvents.map(event => (
    <LeaderboardItem
      key={event.eventId}
      title={event.title}
      revenue={event.revenue}
      soldOut={event.selloutPercentage}
    />
  ))}
</EventLeaderboard>

Period Filters

Predefined Periods

  • all: All-time statistics
  • year: Last 365 days
  • month: Last 30 days
  • week: Last 7 days

Custom Date Range

const response = await fetch(
  '/api/analytics/organizer/stats?' + new URLSearchParams({
    startDate: '2024-01-01T00:00:00Z',
    endDate: '2024-03-31T23:59:59Z'
  }),
  {
    headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
  }
);
Use the period parameter for quick filters in your UI, and startDate/endDate for custom date range selection.

Real-Time Updates

Statistics are calculated in real-time from the database. No caching is applied, ensuring you always see the latest data. For high-traffic organizers, consider:
  • Client-side caching with a 5-minute TTL
  • Implementing webhook listeners for order updates
  • Using Server-Sent Events (SSE) for live dashboard updates

Export Data

To export analytics data for reporting:
// Fetch data
const stats = await fetch('/api/analytics/organizer/stats?period=year');
const data = await stats.json();

// Convert to CSV
const csv = convertToCSV(data.recentSales);

// Download file
const blob = new Blob([csv], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'sales-report.csv';
a.click();
This endpoint requires the user to have the ORGANIZER role. Standard users will receive a 403 Forbidden error.

Build docs developers (and LLMs) love