API Documentation

Everything you need to integrate OgenSync Connect into your app. Send WhatsApp messages via simple REST API calls.

Quick Navigation

Getting Started

OgenSync Connect provides a simple REST API to send WhatsApp messages. Here's the workflow:

1
Register
Create account & get token
2
Connect
Scan QR to link WhatsApp
3
Send
Call API with your token
4
Track
Monitor via dashboard
Base URL: http://localhost:3000 (or your deployed domain)

Authentication

All API endpoints (except /api/register) require a JWT Bearer token in the Authorization header.

Headers
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

Your token is generated automatically when you register. You can find it in your dashboard or regenerate it anytime.

POST /api/register

Create a new user account. Returns an API token and initial SyncCoin credits.

Request Body
JSON
{
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "919876543210"
}
Parameters
Field Type Required Description
name string Full name of the user
email string Valid email address (unique)
phone string Phone with country code, no + or spaces (e.g. 919876543210)
Success Response 200
JSON
{
  "success": true,
  "message": "Registration successful",
  "data": {
    "userId": "abc123-def456-...",
    "token": "eyJhbGciOiJIUzI1NiIs...",
    "credits": 100
  }
}

Connect WhatsApp (QR Scan)

After registering, you need to link your WhatsApp account by scanning a QR code.

You must connect WhatsApp before sending messages. Use the QR scan page or the API endpoint below.

GET /api/session/qr

Returns a QR code data URL that can be displayed as an image for the user to scan.

Response
{
  "success": true,
  "qr": "data:image/png;base64,iVBO...",
  "status": "qr_ready"
}

POST /api/send-message

Send a WhatsApp message to any phone number. Costs 1 SyncCoin per message.

Request Body
JSON
{
  "to": "919876543210",
  "message": "Hello from OgenSync! 🚀"
}
Parameters
Field Type Required Description
to string Recipient phone number with country code (no + or spaces)
message string Message text to send (max 4096 characters)
Success Response 200
JSON
{
  "success": true,
  "message": "Message sent successfully",
  "data": {
    "to": "919876543210@s.whatsapp.net",
    "creditsRemaining": 99,
    "messageId": "BAE5B8E1..."
  }
}
cURL Example
Bash
curl -X POST http://localhost:3000/api/send-message \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"to": "919876543210", "message": "Hello! 🚀"}'
Node.js Example
JavaScript
const response = await fetch('http://localhost:3000/api/send-message', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: '919876543210',
    message: 'Hello from OgenSync! 🚀',
  }),
});

const data = await response.json();
console.log(data);
// { success: true, data: { creditsRemaining: 99 } }
Python Example
Python
import requests

response = requests.post(
    'http://localhost:3000/api/send-message',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
    json={
        'to': '919876543210',
        'message': 'Hello from OgenSync! 🚀',
    },
)

print(response.json())

GET /api/session/status

Check the current status of your WhatsApp session.

Response
{
  "success": true,
  "data": {
    "connected": true,
    "status": "connected",
    "whatsappNumber": "919876543210"
  }
}

GET /api/credits

Check your current SyncCoin balance and usage stats.

Response
{
  "success": true,
  "data": {
    "credits": 95,
    "creditsUsed": 5,
    "messagesSent": 5
  }
}

Other Endpoints

Method Endpoint Auth Description
POST /api/register Create account
GET /api/session/qr Get QR code for WhatsApp linking
GET /api/session/status Check WhatsApp session status
POST /api/send-message Send a WhatsApp message (1 coin)
POST /api/token/regenerate Generate a new API token
GET /api/credits Check SyncCoin balance
GET /api/activity Get activity history
GET /api/metrics Get usage metrics
GET /ping Health check

Error Handling

All errors follow a consistent format:

Error Response
{
  "success": false,
  "error": "Error message here"
}
Common Error Codes
Status Meaning Common Cause
400 Bad Request Missing or invalid parameters
401 Unauthorized Missing or invalid token
402 Payment Required Insufficient SyncCoin credits
403 Forbidden Account disabled
409 Conflict Email already registered
429 Too Many Requests Rate limit exceeded (wait 60s)
500 Server Error Internal error (contact support)

Rate Limits

API endpoints: 30 requests per minute per IP
Auth endpoints: 5 requests per 15 minutes per IP

SyncCoin Credit System

100
Free coins on signup
1
Coin per message
No expiry on credits

Ready to get started?

Create your free account and start sending WhatsApp messages in minutes