Developer Documentation

Build with the Syntro SDK

Add authentication, analytics, error tracking, and payments to your app in minutes. One API key, one SDK, everything you need.

Quick Setup

Install the SDK and initialize it with your API key from the Dashboard → Settings.

bash
npm install syntro-sdk
typescript
import { Syntro } from 'syntro-sdk';

const syntro = new Syntro('sk_your_api_key');
Tip: Find your API key in the Dashboard under Settings → API Key

Events & Analytics

Track custom business events to build analytics dashboards.

typescript
// Track a custom event
await syntro.event('CUSTOM', 'cart_add', 'User added product to cart', {
  productId: 'prod_123',
  category: 'electronics'
});

// Get analytics stats
const stats = await syntro.getStats();
// stats.summary = { custom: 12, error: 3, auth: 8, total: 23 }

// List raw events
const { events, total } = await syntro.listEvents({ 
  type: 'CUSTOM', limit: 20 
});

API Endpoints

Error Tracking

Track errors from your application. They appear in the Analytics → Errors tab.

typescript
// Track an error
await syntro.sendError('checkout_failed', 'Error loading checkout', {
  page: '/checkout',
  statusCode: 500,
  stack: error.stack
});

// Errors show up in Analytics → Errors tab with count and last seen

Authentication

Full user authentication for your app. Register, login, manage users and metadata.

typescript
// Register a new user
const { user, token, error } = await syntro.register(
  'johndoe', 'john@email.com', 'password123'
);

// Login
const { user, token } = await syntro.login('johndoe', 'password123');

// Verify JWT token (e.g. in your server middleware)
const { valid, user } = await syntro.verifyToken(token);

// Get user info
const username = await syntro.getUsername(userId);
const email    = await syntro.getUserEmail(userId);
const metadata = await syntro.getMetadata(userId);

// Update metadata (merge)
await syntro.updateMetadata(userId, { plan: 'pro', role: 'admin' });

// Delete a user
await syntro.deleteUser(userId);

API Endpoints

Billing & Payments

Accept payments with Stripe in 3 steps.

Step 1: Configure Stripe

Go to Settings → Stripe in your Syntro project. Add your Stripe Secret Key and Webhook Secret.

Step 2: Add Webhook in Stripe

In Stripe Dashboard → Developers → Webhooks, create a new endpoint:

text
URL:    https://api.syntro.run/v1/billing/webhook/<PROJECT_ID>
Event:  checkout.session.completed

Step 3: Create Payment

typescript
const { url, error } = await syntro.createPayment('Pro Plan', 999, {
  currency: 'usd',
  successUrl: 'https://yourapp.com/success',
  cancelUrl: 'https://yourapp.com/cancel',
  customerEmail: 'customer@email.com'
});

// Redirect to Stripe Checkout
if (url) window.location.href = url;
Auto-recorded: Syntro verifies the webhook, records the transaction, and logs a payment_completed event automatically.

API Endpoints

All SDK Methods

MethodDescription
event(type, name, msg?, meta?)Track any event
sendError(name, msg?, meta?)Track an ERROR event
getStats(type?)Get analytics stats
listEvents(opts?)List raw events
register(user, email, pass)Register user
login(username, password)Login with username
loginWithEmail(email, pass)Login with email
verifyToken(token)Verify JWT
getUser(userId)Get user by ID
getUsername(userId)Get username
getUserEmail(userId)Get email
getMetadata(userId)Get metadata
updateMetadata(userId, data)Merge-update metadata
updateUser(userId, data)Update user
deleteUser(userId)Delete user
listUsers(opts?)List users
createPayment(name, amount)Create Stripe checkout
listTransactions(opts?)List transactions
Syntro © 2026 — Built for developers.