Reading Progress:
0%

Admin API

Administrative REST API for managing your AffiliatePro platform

Admin Only
RESTful Design JSON Responses
Authentication

All endpoints require a valid admin JWT token. Use the raw token — do not include a Bearer prefix.

Authorization: <your-admin-jwt-token>
Obtain a token via the User Login API with admin credentials.
Base URL

All Admin API endpoints are relative to this base URL.

https://demo2.affiliatepro.org/Admin_Api/
Error Codes Reference
200
Success

Request completed successfully

401
Unauthorized

Invalid or missing token

403
Forbidden

Valid token but not admin

422
Unprocessable

Validation failed

Quick Start
1
Login as Admin

Use the User Login API with admin credentials to obtain a JWT token.

2
Add Authorization Header

Include the raw JWT in the Authorization header (no Bearer prefix).

3
Call Endpoints

Send requests to https://demo2.affiliatepro.org/Admin_Api/ + endpoint path.

Currency Settings

Every API endpoint that returns monetary values automatically includes the platform's currency settings. Use these to format amounts correctly in your app instead of hardcoding $.

Field Type Example Description
currency_symbol string $ The default currency symbol from the platform settings
currency_code string USD ISO 4217 currency code
enable_shorten_numbers integer 1 If 1, format large amounts as $3.9k / $1.2M. If 0, show full numbers like $3900.00
Tip: These fields are included in: dashboard, users, user_details, withdrawals, wallet, reports, and the login response. Never hardcode a currency symbol — always read it from the API response.

Admin Dashboard

Retrieve admin dashboard statistics with HTTP GET request.

Returns a comprehensive overview of your platform: total users, affiliates (active non-vendor users), vendors, pending items, today's activity, admin balance with growth, store & vendor sales, commissions (admin + affiliate), click commissions, currency settings (symbol, code, shorten formatting), and recent user registrations. All data uses the same source as the web admin dashboard.

Request

GET https://demo2.affiliatepro.org/Admin_Api/dashboard
Parameter Type Position Description
Authorization string Header Admin JWT token obtained from login API

Response

{"status":true,"data":{"total_users":150,"total_affiliates":120,"total_vendors":30,"pending_users":5,"pending_withdrawals":3,"total_withdrawals_amount":"1250.00","admin_balance":"3900.50","admin_balance_growth":12.5,"store_sales":"8500.00","store_commission":"850.00","store_orders":42,"vendor_sales":"3200.00","vendor_commission":"320.00","vendor_orders":18,"click_commission":"450.00","total_clicks":1250,"today_clicks":45,"today_sales":8,"currency_symbol":"$","currency_code":"USD","enable_shorten_numbers":1,"recent_users":[{"id":"88","firstname":"John","lastname":"Doe","username":"johndoe","email":"john@example.com","type":"user","status":"1","created_at":"2025-06-11 16:44:16"},{"id":"87","firstname":"Jane","lastname":"Smith","username":"janesmith","email":"jane@example.com","type":"user","status":"0","created_at":"2025-06-10 14:22:08"}]}}
Admin - Users Management

Manage all users/affiliates on your platform. List users with pagination and filters, view detailed user information, and update user status (approve, block, set to pending).

Users List

Retrieve a paginated list of users with optional search and status filters.

GET https://demo2.affiliatepro.org/Admin_Api/users
Parameters
Parameter Type Position Description
Authorization string Header Admin JWT token
start_from integer Query Pagination offset (default: 0)
limit integer Query Number of results per page (default: 20)
search string Query Search by username, email, firstname, or lastname
status string Query all, active, pending, or blocked (default: all)
Response
{"status":true,"data":{"users":[{"id":"88","firstname":"John","lastname":"Doe","username":"johndoe","email":"john@example.com","status":"1","is_vendor":"0","balance":"150.00","total_clicks":230,"total_sales":15}],"total_count":150,"has_more":true,"currency_symbol":"$","currency_code":"USD","enable_shorten_numbers":1}}
User Details

Retrieve detailed information for a specific user including balance, clicks, and sales.

GET https://demo2.affiliatepro.org/Admin_Api/user_details
Parameters
Parameter Type Position Description
Authorization string Header Admin JWT token
user_id integer Query The ID of the user to retrieve (required)
Response
{"status":true,"data":{"id":"88","firstname":"John","lastname":"Doe","status":"1","is_vendor":"0","balance":"150.00","total_clicks":230,"total_sales":15,"total_revenue":"450.00","total_referrals":3,"recent_clicks":[],"recent_sales":[],"currency_symbol":"$","currency_code":"USD","enable_shorten_numbers":1}}
Toggle User Status

Toggle a user's account status between enabled (status=1) and disabled (status=0). Works exactly like the / button on the web admin Users List page. A disabled user cannot login.

POST https://demo2.affiliatepro.org/Admin_Api/update_user_status
Body Parameters
Parameter Type Required Description
Authorization string true Admin JWT token (Header)
user_id integer true The ID of the user to toggle
Toggle behavior: If user status=1 (enabled), it becomes 0 (disabled). If status=0, it becomes 1. The response includes the new_status value.
Response
{"status":true,"message":"User status disabled successfully","new_status":0}
Admin - Profile Management

Manage the admin user's own profile. Get full profile details including country information and available countries list, and update profile fields including avatar upload.

Get Admin Profile

Retrieve the authenticated admin's full profile details. Also returns a list of all available countries for use in country selection dropdowns.

GET https://demo2.affiliatepro.org/Admin_Api/profile
Parameters
Parameter Type Position Description
Authorization string Header Admin JWT token
No additional parameters required. The admin user is identified from the JWT token.
Response
{
  "status": true,
  "message": "Admin profile loaded successfully",
  "data": {
    "firstname": "John",
    "lastname": "Doe",
    "email": "admin@example.com",
    "username": "admin",
    "PhoneNumber": "+1 201-555-0123",
    "city": "New York",
    "pincode": "10001",
    "country_id": "231",
    "country_code": "US",
    "country_name": "United States",
    "country_flag": "https://yoursite.com/assets/vertical/assets/images/flags/us.png",
    "profile_avatar": "https://yoursite.com/assets/images/users/avatar.jpg",
    "role": "admin",
    "countries": [
      {"id": "1", "name": "Afghanistan"},
      {"id": "2", "name": "Albania"},
      "..."
    ]
  }
}
Response Fields
Field Type Description
firstname string Admin first name
lastname string Admin last name
email string Admin email address
username string Admin username
PhoneNumber string Phone number
city string City name
pincode string Postal / ZIP code
country_id string Selected country ID
country_code string ISO country code (e.g. US, GB)
country_name string Full country name
country_flag string URL to country flag image
profile_avatar string URL to profile avatar image
role string User role (always admin)
countries array List of all available countries (each with id and name)
Update Admin Profile

Update the authenticated admin's profile information. Supports text fields and avatar image upload. Only provided fields will be updated.

POST https://demo2.affiliatepro.org/Admin_Api/update_profile
multipart/form-data
Body Parameters
Parameter Type Required Description
Authorization string true Admin JWT token (Header)
firstname string true First name
lastname string true Last name
email string true Email address
phone string false Phone number
country_id integer false Country ID from the countries list
city string false City name
pincode string false Postal / ZIP code
password string false New password (leave empty to keep current)
avatar file false Profile image (png, gif, jpeg, jpg — max 2MB)
Response
{
  "status": true,
  "message": "Profile updated successfully",
  "data": {
    "firstname": "John",
    "lastname": "Doe",
    "email": "admin@example.com",
    "username": "admin",
    "PhoneNumber": "+1 201-555-0123",
    "city": "New York",
    "pincode": "10001",
    "country_id": "231",
    "country_code": "US",
    "country_name": "United States",
    "country_flag": "https://yoursite.com/assets/vertical/assets/images/flags/us.png",
    "profile_avatar": "https://yoursite.com/assets/images/users/avatar.jpg",
    "role": "admin"
  }
}
Note: When sending avatar, use multipart/form-data content type. Fields firstname, lastname, and email are required; all other fields are optional.
Admin

Withdrawals

Manage withdrawal requests from affiliates. View pending/paid/rejected requests and approve or reject them.

Withdrawal Requests List

Retrieve a paginated list of withdrawal requests with status filter.

GET https://demo2.affiliatepro.org/Admin_Api/withdrawals
Parameters
ParameterTypePositionDescription
AuthorizationstringHeaderAdmin JWT token
start_fromintegerQueryPagination offset (default: 0)
limitintegerQueryResults per page (default: 20)
statusstringQueryunpaid, paid, or rejected (default: unpaid)
Response
{
  "status": true,
  "data": {
    "requests": [
      {
        "id": "3",
        "tran_ids": "17",
        "amount": "37.5",
        "status": "0",
        "user_id": "4",
        "payment_method": "bank_transfer",
        "status_label": "Received",
        "payment_details": {
          "bank_name": "My Bank",
          "account_number": "123456789",
          "account_name": "John Doe"
        },
        "created_at": "2026-02-23 08:43:20",
        "username": "johndoe",
        "email": "john@example.com",
        "firstname": "John",
        "lastname": "Doe"
      }
    ],
    "total_count": 2,
    "start_from": 0,
    "limit": 20,
    "has_more": false,
    "currency_symbol": "$",
    "currency_code": "USD",
    "enable_shorten_numbers": 1
  }
}
Status Codes
CodeLabelDescription
0ReceivedPending / waiting for admin action
1PaidPayment completed
2ProcessingPayment in progress
3CancelledRequest cancelled
4DeclinedRequest declined by admin
Update Withdrawal Status

Approve or reject a withdrawal request by its ID. Optionally include an admin note.

POST https://demo2.affiliatepro.org/Admin_Api/update_withdrawal_status
Parameters
ParameterTypeRequiredDescription
AuthorizationstringtrueAdmin JWT token (Header)
request_idintegertrueThe ID of the withdrawal request
statusstringtruepaid or rejected
admin_notestringfalseOptional note from admin
Response
{"status":true,"message":"Withdrawal request approved successfully"}
Admin

Reports & Analytics

Retrieve analytics data for your platform within a date range. Includes clicks by day, sales by day, and top-performing affiliates.

If no date range is provided, defaults to the current month (first day of month to today).

Reports
GET https://demo2.affiliatepro.org/Admin_Api/reports
Parameters
ParameterTypePositionDescription
AuthorizationstringHeaderAdmin JWT token
date_fromstringQueryStart date in YYYY-MM-DD format (default: first day of current month)
date_tostringQueryEnd date in YYYY-MM-DD format (default: today)
Response
{"status":true,"data":{"date_from":"2025-06-01","date_to":"2025-06-15","clicks_by_day":[{"date":"2025-06-01","count":"12"},{"date":"2025-06-02","count":"18"},{"date":"2025-06-03","count":"25"}],"sales_by_day":[{"date":"2025-06-01","count":"3","total":"450.00"},{"date":"2025-06-02","count":"5","total":"780.00"},{"date":"2025-06-03","count":"2","total":"200.00"}],"top_affiliates":[{"id":"88","firstname":"John","lastname":"Doe","username":"johndoe","total_sales":"15","total_revenue":"3500.00"},{"id":"65","firstname":"Jane","lastname":"Smith","username":"janesmith","total_sales":"12","total_revenue":"2800.00"}],"currency_symbol":"$","currency_code":"USD","enable_shorten_numbers":1}}
Admin

Wallet Overview

Retrieve the admin wallet overview including balance, sale totals, click totals, commissions across all channels, and recent transactions.

Wallet
GET https://demo2.affiliatepro.org/Admin_Api/wallet
Parameters
ParameterTypePositionDescription
AuthorizationstringHeaderAdmin JWT token
Response
{"status":true,"data":{"admin_balance":"12500.00","sale_localstore_total":"8500.00","sale_localstore_vendor_total":"3200.00","order_external_total":"4500.00","click_action_total":120,"click_action_commission":"360.00","click_localstore_total":450,"click_integration_total":280,"click_form_total":95,"click_localstore_commission":"225.00","click_integration_commission":"140.00","click_form_commission":"47.50","transactions":[{"id":"234","user_id":"88","amount":"150.00","type":"sale","status":"paid","created_date":"2025-06-11 14:30:00","firstname":"John","lastname":"Doe"},{"id":"233","user_id":"65","amount":"75.00","type":"click","status":"unpaid","created_date":"2025-06-10 09:15:00","firstname":"Jane","lastname":"Smith"}],"currency_symbol":"$","currency_code":"USD","enable_shorten_numbers":1}}
Response Fields
FieldTypeDescription
admin_balancestringTotal admin balance
sale_localstore_totalstringTotal local store sales amount
sale_localstore_vendor_totalstringTotal local store vendor sales amount
order_external_totalstringTotal external order amount (integration campaigns)
click_action_totalintegerTotal action/lead clicks
click_action_commissionstringTotal commission from action clicks
click_localstore_totalintegerTotal local store clicks
click_integration_totalintegerTotal integration/external clicks
click_form_totalintegerTotal form/lead clicks
click_localstore_commissionstringTotal commission from local store clicks
click_integration_commissionstringTotal commission from integration clicks
click_form_commissionstringTotal commission from form clicks
transactionsarrayRecent wallet transactions (up to 50, includes user details)

Live Implementation Examples

Working demos connected to your Admin API - login and see real data

Step 1: Connect to your API
Dashboard Stats Cards
Waiting for connection
Total Admin Balance

--

--% this week

--

Total Users

--

Affiliates

--

Vendors

--

Pending Users

--

Store Sales -- orders

--

Vendor Sales -- orders

--

Store Commissions (admin + affiliate)

--

Click Commission -- clicks

--

Today's Clicks

--

Today's Sales

--

Pending Payouts

--

Total Withdrawals
Users Management
Waiting for connection
NameEmailBalanceClicksSalesTypeStatusAction
Connect to API first
Withdrawal Requests
UserAmountMethodDateActions
Connect to API first
Reports & Analytics
Wallet Overview
Admin Balance

--

External Orders

--

Store Sales

--

Integration Clicks --
Store Clicks --
Action Clicks --
Form Clicks --
Recent Transactions
UserAmountTypeStatusDate
Connect to API first
Admin Profile
Waiting for connection
--
--
Username --
Phone --
Country --
City --
Pincode --
Edit Profile