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
- Log in to the Admin Dashboard
- Navigate to Settings > API Keys
- Click Create API Key
- Select SANDBOX environment for testing
- 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:
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