Member User Affiliate API Documentation

Complete API reference for Member User Affiliate endpoints

GET /v2/user/affiliate/summary Requires: JwtAccessGuardMemberV2
Get affiliate summary information for the authenticated member, including total members, click count, and credit information.
Request

Headers:

Header Type Required Description
Authorization string Yes Bearer {accessToken}

Body: Empty

Response

200 OK Success

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "affiliateTotalDepositedMemberCount": 5,
    "affiliateTotalMemberCount": 10,
    "affiliateTotalClickCount": 150,
    "affiliateTotalCredit": 5000.00,
    "affiliateCurrentCredit": 2000.00,
    "affiliateUid": "user-uid-123",
    "affiliateCode": "ABC123"
  }
}

400 Bad Request Member not found

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "MEMBER_NOT_FOUND",
    "errorMessage": "member not found"
  }
}

429 Too Many Requests Duplicate request detected

{
  "isSuccess": false,
  "statusCode": 429,
  "message": {
    "errorCode": "DUPLICATE_REQUEST",
    "errorMessage": "Duplicate request. Please try again after a short wait."
  }
}
GET /v2/user/affiliate/members Requires: JwtAccessGuardMemberV2
Get a paginated list of affiliate members (downline members) for the authenticated member. Username and mobile number are partially masked for privacy.
Request

Query Parameters:

Parameter Type Required Description
page number Optional Page number (default: 1)
limit number Optional Number of items per page (default: 10, can also use "row" parameter)
row number Optional Alternative to "limit" parameter
search string Optional Search by mobile number (partial match)

Headers:

Header Type Required Description
Authorization string Yes Bearer {accessToken}

Body: Empty

Response

200 OK Success

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "list": [
      {
        "id": 1234,
        "username": "XXXXXX00001",
        "mobileNumber": "XXXXX5678",
        "registerDate": "2024-01-01T00:00:00.000Z",
        "totalPaidAffiliate": 500.00
      }
    ],
    "meta": {
      "page": 1,
      "limit": 10,
      "total": 25,
      "totalPages": 3
    }
  }
}

400 Bad Request Member not found

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "MEMBER_NOT_FOUND",
    "errorMessage": "member not found"
  }
}

429 Too Many Requests Duplicate request detected

{
  "isSuccess": false,
  "statusCode": 429,
  "message": {
    "errorCode": "DUPLICATE_REQUEST",
    "errorMessage": "Duplicate request. Please try again after a short wait."
  }
}
POST /v2/user/affiliate/withdraw Requires: JwtAccessGuardMemberV2
Withdraw all available affiliate credit to the member's main credit balance. Validates withdrawal conditions including minimum/maximum amounts, partner credit availability, withdrawal time restrictions, and system settings.
Request

Headers:

Header Type Required Description
Authorization string Yes Bearer {accessToken}

Body: Empty

Response

200 OK Success

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "isSuccess": true
  }
}

400 Bad Request Member not found

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "MEMBER_NOT_FOUND",
    "errorMessage": "member not found"
  }
}

400 Bad Request No affiliate credit

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "AFFILIATE_NO_CREDIT",
    "errorMessage": "Cannot withdraw because there is no affiliate credit"
  }
}

400 Bad Request Insufficient partner credit

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "AFFILIATE_INSUFFICIENT_PARTNER_CREDIT",
    "errorMessage": "Cannot withdraw credit at this time (AIC)"
  }
}

400 Bad Request Withdrawal disabled

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "AFFILIATE_WITHDRAW_DISABLED",
    "errorMessage": "Withdrawal temporarily disabled. We apologize for the inconvenience"
  }
}

400 Bad Request Invalid withdrawal amount

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "AFFILIATE_WITHDRAW_INVALID_AMOUNT",
    "errorMessage": "Affiliate withdrawal minimum 100 maximum 10000"
  }
}

400 Bad Request Invalid withdrawal time

{
  "isSuccess": false,
  "statusCode": 400,
  "message": {
    "errorCode": "AFFILIATE_WITHDRAW_INVALID_TIME",
    "errorMessage": "Cannot withdraw outside affiliate withdrawal time"
  }
}

409 Conflict Invalid withdrawal day

{
  "isSuccess": false,
  "statusCode": 409,
  "message": {
    "errorCode": "AFFILIATE_WITHDRAW_INVALID_TIME",
    "errorMessage": "Cannot withdraw outside the withdrawal day for loss recovery"
  }
}

429 Too Many Requests Duplicate request detected

{
  "isSuccess": false,
  "statusCode": 429,
  "message": {
    "errorCode": "DUPLICATE_REQUEST",
    "errorMessage": "Duplicate request. Please try again after a short wait."
  }
}

500 Internal Server Error Something went wrong

{
  "isSuccess": false,
  "statusCode": 500,
  "message": {
    "errorCode": "SOMETHING_WENT_WRONG",
    "errorMessage": "An error occurred"
  }
}
GET /v2/user/affiliate/transaction Requires: JwtAccessGuardMemberV2
Get a paginated list of affiliate withdrawal transactions for the authenticated member. Supports filtering by date range or period.
Request

Query Parameters:

Parameter Type Required Description
page number Optional Page number (default: 1)
limit number Optional Number of items per page (default: 10, can also use "row" parameter)
row number Optional Alternative to "limit" parameter
period string Optional Date period filter: "today", "7d", "30d", "90d"
startDate string Optional Start date filter (ISO date string)
endDate string Optional End date filter (ISO date string)

Headers:

Header Type Required Description
Authorization string Yes Bearer {accessToken}

Body: Empty

Response

200 OK Success

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "list": [
      {
        "id": 1,
        "note": "ถอนค่าแนะนำไปกระเป๋าหลัก โดย member123",
        "transactionGroup": "AFFILIATE",
        "amount": 2000.00,
        "beforeCredit": 2000.00,
        "afterCredit": 0.00,
        "createdAt": "2024-01-15T10:00:00.000Z"
      }
    ],
    "meta": {
      "page": 1,
      "limit": 10,
      "total": 5,
      "totalPages": 1
    }
  }
}

429 Too Many Requests Duplicate request detected

{
  "isSuccess": false,
  "statusCode": 429,
  "message": {
    "errorCode": "DUPLICATE_REQUEST",
    "errorMessage": "Duplicate request. Please try again after a short wait."
  }
}
GET /v2/user/affiliate/description Requires: JwtAccessGuardMemberV2
Get the affiliate program description/content for the member's partner. This typically contains information about the affiliate program, commission rates, and terms.
Request

Headers:

Header Type Required Description
Authorization string Yes Bearer {accessToken}

Body: Empty

Response

200 OK Success

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "content": "Affiliate program description content..."
  }
}

429 Too Many Requests Duplicate request detected

{
  "isSuccess": false,
  "statusCode": 429,
  "message": {
    "errorCode": "DUPLICATE_REQUEST",
    "errorMessage": "Duplicate request. Please try again after a short wait."
  }
}

Member User Affiliate API Documentation © 2024