DEVELOPERDOCUMENTATION

Get started brewing loyalty in minutes. Simple API, clear examples, no unnecessary complexity.

HOW IT WORKS

Track user actions, award points, create achievements. That's the whole recipe.

1

CREATE PROJECT

Sign up and create a project. Get your API token.

2

DEFINE EVENTS

Create events in the dashboard with point values.

3

TRACK EVENTS

Send POST requests to /track. Points brew automatically.

AUTHENTICATION

All API requests require a Bearer token in the Authorization header. Get your token from the API Keys section in your project dashboard.

Authorization: Bearer your_api_token_here

KEEP IT SECURE: Never expose your API token in client-side code. Use it only on your server.

TRACK ENDPOINT
POSThttps://api.brewale.dev/track

Track a user event. The event name should match an event you've created in your dashboard. Points are awarded automatically based on the event's point value.

REQUEST BODY:

{
  "event": "PURCHASE",
  "userId": "user123"
}

RESPONSE:

{
  "success": true
}

NOTE: Events are processed asynchronously. The API returns immediately, and points are awarded within seconds. Check your dashboard to see users and their points.

CODE EXAMPLES
async function trackEvent(event, userId) {
  const response = await fetch('https://api.brewale.dev/track', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer your_api_token_here'
    },
    body: JSON.stringify({
      event: event,
      userId: userId
    })
  })
  
  if (!response.ok) {
    throw new Error(`Failed to track event: ${response.statusText}`)
  }
  
  return await response.json()
}

// Usage
await trackEvent('PURCHASE', 'user123')
await trackEvent('SIGNUP', 'user456')
WHAT YOU GET IN THE DASHBOARD

Once you're tracking events, the dashboard shows you everything you need:

User Profiles
View user points, activity history, and stats
Achievements & Levels
Create achievements and level progression
Analytics
See total users, events tracked, and engagement metrics
Event Management
Create and manage events with point values

READY TO START BREWING?

Sign up, create a project, and start tracking events in minutes. Simple API, no complexity, just results.