Skip to main content
GET
/
api
/
auth
/
profile
Get Profile
curl --request GET \
  --url https://api.example.com/api/auth/profile \
  --header 'Authorization: <authorization>'
{
  "message": "<string>",
  "user": {
    "id": "<string>",
    "email": "<string>",
    "firstName": "<string>",
    "lastName": "<string>"
  },
  "401 Unauthorized": {}
}

Authentication

This endpoint requires a valid JWT token in the Authorization header.
Authorization
string
required
Bearer token for authenticationFormat: Bearer {your_jwt_token}

Response

message
string
Success message confirming profile retrieval
user
object
The authenticated user’s profile information

Example Request

curl -X GET https://api.yourfinanceapp.com/api/auth/profile \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBlODQwMC1lMjliLTQxZDQtYTcxNi00NDY2NTU0NDAwMDAiLCJlbWFpbCI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwicm9sZSI6IlVTRVIiLCJpYXQiOjE3MDk1NjE2MDB9.abc123def456"

Example Response

{
  "message": "This is your profile",
  "user": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "email": "[email protected]",
    "firstName": "John",
    "lastName": "Doe"
  }
}

Error Responses

401 Unauthorized
error
Missing or invalid JWT tokenMissing token:
{
  "statusCode": 401,
  "message": "Unauthorized"
}
Invalid/expired token:
{
  "statusCode": 401,
  "message": "Unauthorized"
}

Additional Information

This endpoint is protected by the JwtAuthGuard which:
  • Validates the JWT token signature
  • Checks token expiration
  • Extracts user information from the token payload
  • Attaches the user data to the request context
The user object returned contains information decoded from the JWT token payload, not fetched from the database. This makes it a lightweight endpoint suitable for verifying authentication status. Use cases:
  • Verify if a stored token is still valid
  • Retrieve basic user information without database queries
  • Check authentication status on app initialization or page refresh

Build docs developers (and LLMs) love