Skip to main content
Updates an existing union member’s information.

Authorization

Requires authentication with one of the following roles:
  • Admin: Can update any member and reassign to different unions
  • Supervisor: Can update members in unions managed by their credit officers
  • Credit Officer: Can update members in their assigned unions only

Path Parameters

id
string
required
The unique identifier of the union member to update

Request Body

All fields are optional. Only provided fields will be updated.
firstName
string
Member’s first name
lastName
string
Member’s last name
email
string
Member’s email address (must be unique)
phone
string
Member’s phone number
address
string
Member’s physical address
dateOfBirth
string
Member’s date of birth (ISO 8601 format)
gender
string
Member’s gender
maritalStatus
string
Member’s marital status
profession
string
Member’s profession or occupation
company
string
Member’s employer or company name
city
string
City of residence
state
string
State or province
country
string
Country of residence
zipCode
string
Postal or ZIP code
note
string
Additional notes about the member
unionId
string
ID of the union (Admin only - triggers reassignment with history tracking)
currentOfficerId
string
ID of the assigned credit officer

Response

success
boolean
Indicates if the update was successful
message
string
Success or error message
data
object
Updated union member object with all current fields

Special Behaviors

  • Union Reassignment: Only admins can change unionId. When changed, a UnionMemberReassignment record is created for audit purposes, and the currentOfficerId is automatically updated to the new union’s credit officer.
  • Email Validation: Email must be unique. The system checks for existing emails (case-insensitive) before updating.
  • Field Sanitization: String fields are trimmed. Empty strings are converted to null.
  • Partial Updates: Only fields included in the request body are updated; others remain unchanged.
curl -X PUT "https://api.example.com/api/union-members/clx123abc" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+234-800-111-2222",
    "address": "456 New Street, Lagos",
    "profession": "Master Potter"
  }'
{
  "success": true,
  "message": "Union member updated successfully",
  "data": {
    "id": "clx123abc",
    "code": "MEM000001",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "phone": "+234-800-111-2222",
    "address": "456 New Street, Lagos",
    "dateOfBirth": "1990-01-15T00:00:00.000Z",
    "gender": "Male",
    "maritalStatus": "Married",
    "profession": "Master Potter",
    "company": "Clay Works Ltd",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "zipCode": "100001",
    "note": "Active member since 2020",
    "unionId": "union_123",
    "union": {
      "id": "union_123",
      "name": "Lagos Potters Union",
      "location": "Ikeja, Lagos"
    },
    "currentOfficerId": "officer_456",
    "currentOfficer": {
      "id": "officer_456",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "[email protected]"
    },
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-03-11T16:45:00.000Z"
  }
}

Build docs developers (and LLMs) love