📖 API Reference v1.0

FamAPI Documentation

Welcome to the official FamAPI developer documentation. FamAPI lets you automate FamPay UPI payment collection using Gmail-based email verification. Generate QR codes, create payment links, and get real-time payment status.

⚠️ All API requests require a valid JWT Bearer token (except register/login). Get your token via /api/auth/login.

Base URL

Base URL
https://py.freepanel.in/api/{endpoint}

Authentication

After login, include your JWT token in the Authorization header for all protected endpoints:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Auth Endpoints

POST /api/auth/register

Create a new user account.

Request Body

{
  "username": "myuser",
  "email": "me@example.com",
  "password": "strongpassword"
}

Response

{
  "success": true,
  "message": "Registered successfully"
}
POST /api/auth/login

Login and receive a JWT token.

Request Body

{
  "username": "myuser",
  "password": "strongpassword"
}

Response

{
  "success": true,
  "token": "eyJhbGci...",
  "user": { "id": 1, "username": "myuser", "role": "user" }
}

User Endpoints

GET /api/user/stats

Get your payment statistics and API key info. 🔐 Auth required

Response

{
  "success": true,
  "api_key": { "api_key": "fmpay_...", "status": "active", "expires_at": "..." },
  "stats": {
    "all_time": { "count": 12, "revenue": 1500.00 },
    "today": { "count": 2, "revenue": 200.00 }
  }
}
GET /api/user/orders

Get your last 50 orders. 🔐 Auth required

POST /api/user/keys/generate

Connect your Gmail + FamPay UPI to generate your API key. 🔐 Auth required

Request Body

{
  "gmail_user": "you@gmail.com",
  "gmail_pass": "xxxx xxxx xxxx xxxx",
  "fampay_upi": "yourname@fam"
}
💡 Use a Gmail App Password, NOT your regular password. Enable 2FA first, then generate an App Password at myaccount.google.com/apppasswords

Response

{
  "success": true,
  "message": "Key generated successfully",
  "api_key": "fmpay_abc123..."
}
POST /api/user/keys/delete

Delete your current API key and credentials. 🔐 Auth required

Payment Links

Payment Endpoints

GET /api/qr

Generate a UPI QR code payment session directly using your API key.

Query Parameters

ParamTypeRequiredDescription
api_keystringRequiredYour FamAPI key
upistringRequiredYour UPI ID
amountnumberRequiredAmount in INR

Example Request

GET /api/qr?api_key=fmpay_abc&upi=you@fam&amount=99

Response

{
  "status": "success",
  "data": {
    "order_id": "FAMPAY20240101120000AA",
    "qr_url": "https://quickchart.io/qr?...",
    "upi_id": "you@fam",
    "amount": "99",
    "expires_at_ist": "01-01-2024 12:10:00"
  }
}
GET /api/verify_order

Check if a payment order has been paid. Poll this every few seconds after showing QR.

Query Parameters

ParamRequiredDescription
order_idRequiredThe order_id from QR generation
slugOptionalFor payment link orders

Pending Response

{ "status": "pending", "message": "Waiting for payment..." }

Success Response

{
  "status": "success",
  "data": {
    "order_id": "FAMPAY...",
    "transaction_id": "TXN123",
    "amount": 99,
    "utr": "UTR12345",
    "sender_name": "Rahul Kumar",
    "payment_time_ist": "29-07-2024 13:45:00"
  }
}

Admin Endpoints

GET /api/admin/users

List all users and their API key status. 🔐 Admin only

POST /api/admin/user/update

Update a user's API key status or extend their subscription. 🔐 Admin only

Request Body

{
  "user_id": 3,
  "status": "active",
  "add_days": 30
}