API Documentation

The Magic Worlds Tracker API lets you integrate affiliate tracking into any website, game, or Web3 application.

Base URL

https://api.magicworldstracker.eu
✨ Web3 Ready

Track wallet connects, NFT mints, token swaps, subscriptions, referrals, and in-game actions.

Quick Start

1. Add the Tracking Script

HTML
<script src="https://api.magicworldstracker.eu/api/track/script.js"></script>

2. Track Conversions

JavaScript
// Wallet connection
AffiliateTracker.trackWalletConnect('0x1234...abcd', 'ethereum');
// Purchase
AffiliateTracker.trackPurchase(99.99, 'USD', 'order-123');
// NFT mint
AffiliateTracker.trackNFTMint('#1234', 'MagicWorlds');
// Token swap
AffiliateTracker.trackTokenSwap('ETH', 'MAGIC', 0.5);
// Level up
AffiliateTracker.trackLevelUp(5);
// Subscription
AffiliateTracker.trackSubscription('pro', 9.99, 'USD');

Authentication

All protected API requests require a Bearer token in the Authorization header:

HTTP Header
Authorization: Bearer YOUR_JWT_TOKEN

S2S Tracking

POST/api/track/conversion

Record a conversion server-side. Authenticate with your API secret header.

cURL
curl -X POST https://api.magicworldstracker.eu/api/track/conversion \
  -H "Content-Type: application/json" \
  -H "X-API-Secret: YOUR_TRACKING_SECRET" \
  -d '{"affiliate_code":"ABC12345","conversion_type":"purchase","conversion_value":99.99}'

Conversion Types

wallet_connect

User connects crypto wallet

purchase

Purchase or transaction

signup

User registration

in_game_action

Custom in-game event

referral

User refers another

subscription

Recurring payment

nft_mint

NFT mint event

token_swap

Token swap event

level_up

In-game level up

Affiliate Signup

POST/api/affiliates/signup

Register a new affiliate. Creates a unique code, crypto wallet, and sends welcome email.

ParameterTypeRequired
namestringyes
emailstringyes
merchant_slugstringone of
merchant_idintegerone of

Affiliate Login

POST/api/affiliates/login

Request a magic login link. The link is sent via email and expires in 15 minutes.

POST/api/affiliates/forgot-password

Request a password reset email. Works for affiliates with a password set.

Affiliate Statistics

GET/api/affiliates/stats?period=week

Get performance stats. period = today | week | month | all. Requires Bearer token.

GET/api/affiliates/conversions

List all conversions for the authenticated affiliate. Paginated.

Merchant Registration

POST/api/merchants/signup

Create a new merchant account. Returns API key + secret and sends welcome email.

Merchant Login

POST/api/merchants/login

Login with email and password. Returns JWT token valid for 7 days.

Merchant Stats

GET/api/merchants/stats

Get merchant dashboard stats: affiliates, clicks, conversions, revenue, top affiliates. Requires merchant Bearer token.