Skip to main content
Creates a new union member with automatic member code generation.

Authorization

Requires authentication with one of the following roles:
  • Admin: Can create members in any union
  • Supervisor: Can create members in unions managed by their credit officers
  • Credit Officer: Can create members in their assigned unions only

Request Body

firstName
string
required
Member’s first name
lastName
string
required
Member’s last name
unionId
string
required
ID of the union this member belongs to
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 (e.g., “Single”, “Married”, “Divorced”)
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
currentOfficerId
string
ID of the credit officer to assign (defaults to the union’s credit officer)

Response

success
boolean
Indicates if the member was created successfully
message
string
Success or error message
data
object
Created union member object

Validation Rules

  • firstName and lastName are required and will be trimmed
  • unionId is required and must reference an existing, active union
  • email must be unique across all union members (case-insensitive)
  • currentOfficerId must match the union’s credit officer if provided
  • Credit officers can only create members for their assigned unions
  • Supervisors can only create members for unions managed by their credit officers
  • Auto-generated code starts at MEM000001 and increments sequentially
curl -X POST "https://api.example.com/api/union-members" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phone": "+234-800-000-0000",
    "unionId": "union_123",
    "profession": "Potter",
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria"
  }'
{
  "success": true,
  "message": "Union member created successfully",
  "data": {
    "id": "clx123abc",
    "code": "MEM000042",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phone": "+234-800-000-0000",
    "address": null,
    "dateOfBirth": null,
    "gender": null,
    "maritalStatus": null,
    "profession": "Potter",
    "company": null,
    "city": "Lagos",
    "state": "Lagos",
    "country": "Nigeria",
    "zipCode": null,
    "note": null,
    "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": "jane.smith@example.com"
    },
    "createdAt": "2024-03-11T15:30:00.000Z"
  }
}

Build docs developers (and LLMs) love