Profile

Manage your personal profile information and account settings.


The User Model

Properties

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the user

  • Name
    institution_id
    Type
    integer | null
    Description

    Foreign key to the user's affiliated institution

  • Name
    first_name
    Type
    string
    Description

    User's first name

  • Name
    last_name
    Type
    string
    Description

    User's last name

  • Name
    email
    Type
    string
    Description

    User's email address (unique)

  • Name
    phone
    Type
    string | null
    Description

    User's phone number

  • Name
    bio
    Type
    text | null
    Description

    User biography or description

  • Name
    avatar
    Type
    string | null
    Description

    URL to user's profile picture

  • Name
    address
    Type
    string | null
    Description

    User's street address

  • Name
    city
    Type
    string | null
    Description

    User's city

  • Name
    country
    Type
    string
    Description

    User's country (default: "Philippines")

  • Name
    date_of_birth
    Type
    date | null
    Description

    User's date of birth

  • Name
    gender
    Type
    enum | null
    Description

    User's gender: male, female, other, or prefer_not_to_say

  • Name
    status
    Type
    enum
    Description

    Account status: active, suspended, or pending

  • Name
    last_login_at
    Type
    timestamp | null
    Description

    Last login timestamp

  • Name
    created_at
    Type
    timestamp
    Description

    Account creation timestamp

  • Name
    updated_at
    Type
    timestamp
    Description

    Account last update timestamp

Relationships

  • Name
    institution
    Type
    Institution | null
    Description

    The institution the user is affiliated with

  • Name
    donations
    Type
    Donation[]
    Description

    All donations made by the user

  • Name
    paymentMethods
    Type
    PaymentMethod[]
    Description

    Saved payment methods

  • Name
    donationSubscriptions
    Type
    DonationSubscription[]
    Description

    Active recurring donation subscriptions

Computed Properties

  • Name
    name
    Type
    string
    Description

    Full name (first_name + last_name)


GET/api/v1/profile

Get My Profile

Retrieves the authenticated user's profile information including roles and institution details.

Authentication: Required

Request

curl https://batchmates-v2.revlv.com/api/v1/profile \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "data": {
    "id": 5,
    "institution_id": 3,
    "first_name": "Juan",
    "last_name": "Dela Cruz",
    "email": "juan@example.com",
    "phone": "+639171234567",
    "bio": "Proud UP alumnus supporting future scholars",
    "avatar": "https://storage.batchmates-v2.revlv.com/avatars/juan.jpg",
    "address": "123 Main St",
    "city": "Quezon City",
    "country": "Philippines",
    "date_of_birth": "1995-06-15",
    "gender": "male",
    "status": "active",
    "last_login_at": "2024-02-06T08:30:00.000000Z",
    "created_at": "2023-12-01T10:00:00.000000Z",
    "updated_at": "2024-02-06T08:30:00.000000Z",
    "name": "Juan Dela Cruz",
    "institution": {
      "id": 3,
      "name": "University of the Philippines",
      "logo": "https://storage.batchmates-v2.revlv.com/institutions/up.jpg",
      "city": "Quezon City"
    },
    "roles": [
      {
        "id": 1,
        "name": "donor"
      }
    ],
    "permissions": []
  }
}

PUT/api/v1/profile

Update My Profile

Updates your profile information. Supports multipart/form-data for avatar uploads.

Authentication: Required

Request Body

  • Name
    first_name
    Type
    string
    Description

    First name (max 255 characters)

  • Name
    last_name
    Type
    string
    Description

    Last name (max 255 characters)

  • Name
    phone
    Type
    string
    Description

    Phone number (max 20 characters)

  • Name
    bio
    Type
    text
    Description

    User biography (max 500 characters)

  • Name
    avatar
    Type
    file
    Description

    Profile picture (JPEG, PNG, GIF - max 2MB)

  • Name
    address
    Type
    string
    Description

    Street address (max 255 characters)

  • Name
    city
    Type
    string
    Description

    City (max 100 characters)

  • Name
    country
    Type
    string
    Description

    Country (max 100 characters)

  • Name
    date_of_birth
    Type
    date
    Description

    Date of birth (YYYY-MM-DD format, must be before today)

  • Name
    gender
    Type
    string
    Description

    Gender: male, female, other, or prefer_not_to_say

Note: All fields are optional - only send fields you want to update.

Request

{
  "first_name": "Juan",
  "last_name": "Dela Cruz",
  "phone": "+639171234567",
  "bio": "Proud UP alumnus supporting future scholars",
  "city": "Quezon City",
  "date_of_birth": "1995-06-15",
  "gender": "male"
}

Response

{
  "success": true,
  "data": {
    "id": 5,
    "institution_id": 3,
    "first_name": "Juan",
    "last_name": "Dela Cruz",
    "email": "juan@example.com",
    "phone": "+639171234567",
    "bio": "Proud UP alumnus supporting future scholars",
    "avatar": "avatars/juan-2024.jpg",
    "city": "Quezon City",
    "country": "Philippines",
    "date_of_birth": "1995-06-15",
    "gender": "male",
    "status": "active",
    "updated_at": "2024-02-06T09:15:00.000000Z",
    "name": "Juan Dela Cruz",
    "institution": {
      "id": 3,
      "name": "University of the Philippines"
    },
    "roles": [
      {
        "name": "donor"
      }
    ]
  },
  "message": "Profile updated successfully"
}

PUT/api/v1/profile/email

Request Email Change

Initiates an email address change for the currently authenticated user by sending a 6-digit OTP to the new email address. No user ID is needed — the user is identified from the session/token. The email is not changed until the code is verified via Verify Email Change.

Authentication: Required

Request Body

  • Name
    new_email
    Type
    string
    Description

    The new email address (must be unique, must differ from current)

Cooldown

A resend cooldown applies (default 60 seconds). If you call this endpoint again before the cooldown expires, a 429 is returned with seconds_left.

Request

{
  "new_email": "newemail@example.com"
}

Response (200)

{
  "success": true,
  "message": "Verification code sent to your new email address.",
  "can_resend_at": "2024-02-06T09:01:00.000000Z"
}

Error (Same Email)

{
  "success": false,
  "message": "The new email address must be different from your current one."
}

Error (Cooldown)

{
  "success": false,
  "message": "Please wait 42 seconds before requesting a new code.",
  "can_resend_at": "2024-02-06T09:01:00.000000Z",
  "seconds_left": 42
}

POST/api/v1/profile/email/verify

Verify Email Change

Verifies the OTP sent to the new email address and commits the change. On success, email is updated and the updated user object is returned.

Authentication: Required

Request Body

  • Name
    code
    Type
    string
    Description

    The 6-digit verification code sent to the new email

Notes

  • Code expires after 15 minutes
  • You must call Request Email Change first
  • On success the auth context should be refreshed with the returned user data
  • After 5 failed attempts the pending email change is cancelled and the code is invalidated. A new code must be requested.

Request

{
  "code": "847291"
}

Response (200)

{
  "success": true,
  "data": {
    "id": 5,
    "email": "newemail@example.com",
    "name": "Juan Dela Cruz"
  },
  "message": "Email updated successfully."
}

Error (Invalid Code)

{
  "message": "The given data was invalid.",
  "errors": {
    "code": ["Invalid verification code."]
  }
}

Error (Expired Code)

{
  "message": "The given data was invalid.",
  "errors": {
    "code": ["Verification code has expired. Please request a new one."]
  }
}

Error (No Pending Change)

{
  "success": false,
  "message": "No pending email change found. Please request a new code."
}

Error (Too Many Attempts)

{
  "message": "The given data was invalid.",
  "errors": {
    "code": ["Too many attempts. Please request a new code."]
  }
}

PUT/api/v1/profile/password

Update Password

Updates your password. Requires current password for verification.

Authentication: Required

Request Body

  • Name
    current_password
    Type
    string
    Description

    Your current password

  • Name
    password
    Type
    string
    Description

    New password (minimum 8 characters)

  • Name
    password_confirmation
    Type
    string
    Description

    Confirm new password (must match password)

Request

{
  "current_password": "oldpassword123",
  "password": "newpassword456",
  "password_confirmation": "newpassword456"
}

Response

{
  "success": true,
  "message": "Password updated successfully"
}

Error (Incorrect Password)

{
  "success": false,
  "message": "Current password is incorrect"
}

Error (Validation)

{
  "message": "The given data was invalid.",
  "errors": {
    "password": [
      "The password must be at least 8 characters.",
      "The password confirmation does not match."
    ]
  }
}

DELETE/api/v1/profile/avatar

Delete Avatar

Removes your profile picture and deletes the image file from storage.

Authentication: Required

Request

curl -X DELETE https://batchmates-v2.revlv.com/api/v1/profile/avatar \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "message": "Avatar deleted successfully"
}

Profile Picture Upload

To upload a profile picture, use multipart/form-data:

curl -X PUT https://batchmates-v2.revlv.com/api/v1/profile \
  -H "Authorization: Bearer {token}" \
  -F "avatar=@profile-pic.jpg" \
  -F "first_name=Juan"

Accepted formats: JPEG, PNG, GIF
Maximum size: 2MB


Account Status

Your account can have one of three statuses:

  • Name
    active
    Description

    Full access to all features

  • Name
    pending
    Description

    Account awaiting verification or approval

  • Name
    suspended
    Description

    Account temporarily restricted

Note: You cannot change your own account status. Contact support if your account is suspended.


Privacy & Security

What You Can Update

  • Personal information (name, phone, address, bio)
  • Profile picture (upload or delete)
  • Date of birth and gender
  • Password (requires current password)
  • Email address (requires OTP verification to the new address)

What You Cannot Update

  • Account status
  • Institution affiliation (contact institution admin)
  • Roles and permissions

Error Responses

  • Name
    422 Validation Error
    Description

    Invalid input data

  • Name
    403 Unauthorized
    Description

    Attempting to update another user's profile

  • Name
    404 Not Found
    Description

    User not found

Validation Error

{
  "message": "The given data was invalid.",
  "errors": {
    "phone": ["The phone must not be greater than 20 characters."],
    "gender": ["The selected gender is invalid."]
  }
}

Was this page helpful?