Skip to main content

Getting Started

This guide will walk you through making your first API call to the MLM Platform.

Prerequisites

  • An MLM Platform account
  • Access to the Admin Dashboard
  • A development environment with HTTP client capabilities

Step 1: Get Your API Key

  1. Log in to the Admin Dashboard
  2. Navigate to Settings > API Keys
  3. Click Create API Key
  4. Select SANDBOX environment for testing
  5. Copy your API key and store it securely
Never expose your API key in client-side code or public repositories.

Step 2: Make Your First Request

Let’s verify your API key by creating a test user.
curl -X POST https://api.mlm-platform.example.com/functions/v1/users \
  -H "Content-Type: application/json" \
  -H "x-tenant-api-key: your_api_key_here" \
  -d '{
    "email": "test@example.com",
    "membership_tier": "ORDINARY"
  }'

Step 3: Verify the Response

A successful response will look like this:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "tenant_id": "123e4567-e89b-12d3-a456-426614174000",
  "email": "test@example.com",
  "membership_tier": "ORDINARY",
  "is_active": true,
  "can_recruit": true,
  "created_at": "2024-01-15T10:30:00Z"
}
Check the X-Environment header to confirm you’re using the sandbox:
X-Environment: SANDBOX

Step 4: Record a Purchase

Now let’s record a purchase to trigger commission calculation:
curl -X POST https://api.mlm-platform.example.com/functions/v1/events-purchase \
  -H "Content-Type: application/json" \
  -H "x-tenant-api-key: your_api_key_here" \
  -d '{
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "amount": 99.99,
    "currency": "USD"
  }'

Next Steps