Skip to main content
GET
/
api
/
users
/
getprofile
Get User Profile
curl --request GET \
  --url https://api.example.com/api/users/getprofile
{
  "success": true,
  "message": "<string>",
  "data": {
    "data._id": "<string>",
    "data.name": "<string>",
    "data.address": "<string>",
    "data.age": 123,
    "data.dob": "<string>",
    "data.phoneNumber": 123,
    "data.authDetails": {
      "data.authDetails.email": "<string>",
      "data.authDetails.isProfileComplete": true
    },
    "data.createdAt": "<string>",
    "data.updatedAt": "<string>"
  }
}
Retrieve the profile information for the authenticated user.

Authentication

This endpoint requires JWT authentication. Include the bearer token in the Authorization header.

Request

This endpoint does not require any request body or query parameters. The user is identified from the JWT token.

Response

success
boolean
Indicates if the operation was successful
message
string
Response message indicating “Profile found” or error details
data
object
The user’s profile object
data._id
string
Unique identifier for the profile
data.name
string
Full name of the user
data.address
string
Residential address
data.age
number
Age of the user
data.dob
string
Date of birth (ISO 8601 format)
data.phoneNumber
number
Contact phone number
data.authDetails
object
Populated authentication details (excluding password and internal fields)
data.authDetails.email
string
User’s email address
data.authDetails.isProfileComplete
boolean
Indicates if the profile setup is complete
data.createdAt
string
Timestamp when the profile was created
data.updatedAt
string
Timestamp when the profile was last updated

Request Example

curl -X GET https://api.yourchurch.com/api/users/getprofile \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response Example

Success Response

{
  "success": true,
  "message": "Profile found",
  "data": {
    "_id": "60d5ec49f1b2c72b8c8e4f3a",
    "name": "John Doe",
    "address": "123 Main Street, Springfield",
    "age": 35,
    "dob": "1989-05-15T00:00:00.000Z",
    "phoneNumber": 5551234567,
    "authDetails": {
      "email": "[email protected]",
      "isProfileComplete": true
    },
    "createdAt": "2024-03-15T10:30:00.000Z",
    "updatedAt": "2024-03-15T10:30:00.000Z"
  }
}

Error Responses

400 - Profile Not Found

{
  "success": false,
  "message": "Profile not found",
  "data": "You do not have any profile"
}

400 - Access Denied (Missing Token)

{
  "success": false,
  "message": "Acceess Denied",
  "data": "Access Token not Found"
}

400 - Access Denied (Missing Authorization Header)

{
  "success": false,
  "message": "Acceess Denied",
  "data": "Authorization missing"
}

500 - Invalid or Expired Token

{
  "success": false,
  "message": "Acccess Denied",
  "data": "jwt expired"
}

500 - Server Error

{
  "success": false,
  "message": "Profile not found",
  "data": "Database connection error"
}

Notes

  • The user is automatically identified from the JWT token’s decoded payload
  • Returns a 400 error if the authenticated user has not yet created a profile
  • The response excludes sensitive authentication fields (password, internal IDs, timestamps from auth record)
  • Use the Create or Update Profile endpoint to create a profile if one doesn’t exist

Build docs developers (and LLMs) love