MegaReach API Documentation

← Back to Home | Getting Started

API Overview

The MegaReach API provides programmatic access to our platform's features, allowing developers to integrate social automation, rewards, and analytics into their applications.

🔐 Authentication

All API requests require authentication using an API key. Include your API key in the request header:

Authorization: Bearer YOUR_API_KEY

Get your API key from the Dashboard → API Keys

Base URL

https://api.megareach.xyz/v1

🔗 Core Endpoints

User Profile

GET /user/profile

Get user profile information

Generate AI Reply

POST /engagement/reply

Generate AI-powered reply for social media content

Token Balance

GET /rewards/balance

Get current $REACH token balance

Create Campaign

POST /campaign/create

Create a new marketing campaign

Analytics Overview

GET /analytics/overview

Get analytics overview and metrics

📝 Example: Generate AI Reply

Request

POST /v1/engagement/reply
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "content": "Great product! How does it work?",
  "context": "Product announcement tweet",
  "tone": "friendly",
  "platform": "twitter"
}

Response

{
  "success": true,
  "data": {
    "reply": "Thank you for your interest! Our product uses advanced AI...",
    "confidence": 0.92,
    "tokens_earned": 5
  }
}

📋 Request Parameters

Generate Reply Parameters

⚡ Rate Limits

Rate limit headers are included in all responses:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

❌ Error Handling

All errors return appropriate HTTP status codes and error messages:

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Try again in 60 seconds.",
    "details": {
      "limit": 100,
      "reset_at": "2024-01-01T12:00:00Z"
    }
  }
}

Common Error Codes

📦 SDKs & Libraries

JavaScript/Node.js

npm install @megareach/sdk

Python

pip install megareach

Go

go get github.com/megareach/go-sdk

PHP

composer require megareach/php-sdk

🔔 Webhooks

Configure webhooks to receive real-time events:

Available Events

Webhook Payload Example

{
  "event": "campaign.completed",
  "timestamp": "2024-01-01T12:00:00Z",
  "data": {
    "campaign_id": "camp_123456",
    "status": "success",
    "metrics": {
      "engagements": 50000,
      "reach": 1000000,
      "conversions": 500
    }
  }
}

🔧 API Best Practices

📚 Additional Resources

🚀 Quick Start with Node.js

const MegaReach = require('@megareach/sdk');

const client = new MegaReach({
  apiKey: 'YOUR_API_KEY'
});

// Generate AI reply
const reply = await client.engagement.generateReply({
  content: 'Amazing product!',
  platform: 'twitter',
  tone: 'friendly'
});

console.log(reply.data.reply);

© 2024 MegaReach. All rights reserved.