AppMage

User Profile

This endpoint group provides methods for authenticated users to manage their own profile information, including retrieving, updating, and securing their account.

Endpoints

POST /api/rpc (Method: UserProfileRpc.getUserProfile)

  • Description: Gets the profile of the currently logged-in user.

  • Request Body:

    {
      "method": "UserProfileRpc.getUserProfile",
      "params": {}
    }
  • Parameters:

    Name Type Required Description
    This method takes no parameters.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": true,
        "isVerified": true,
        "phoneNumber": "string",
        "isPhoneVerified": true,
        "onboardingCompleted": true,
        "profilePicture": "string",
        "jobTitle": "string",
        "department": "string",
        "oauthProfiles": [
          {
            "provider": "string",
            "id": "string"
          }
        ],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.getUserProfile",
        "params": {}
      }'

POST /api/rpc (Method: UserProfileRpc.updateUserProfile)

  • Description: Updates the profile of the currently logged-in user.

  • Request Body:

    {
      "method": "UserProfileRpc.updateUserProfile",
      "params": {
        "firstName": "string",
        "lastName": "string",
        "jobTitle": "string",
        "department": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    firstName String No The user's first name.
    lastName String No The user's last name.
    jobTitle String No The user's job title.
    department String No The user's department.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": true,
        "isVerified": true,
        "phoneNumber": "string",
        "isPhoneVerified": true,
        "onboardingCompleted": true,
        "profilePicture": "string",
        "jobTitle": "string",
        "department": "string",
        "oauthProfiles": [
          {
            "provider": "string",
            "id": "string"
          }
        ],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.updateUserProfile",
        "params": {
          "firstName": "John",
          "lastName": "Doe"
        }
      }'

POST /api/rpc (Method: UserProfileRpc.changePassword)

  • Description: Changes the password for the currently logged-in user.

  • Request Body:

    {
      "method": "UserProfileRpc.changePassword",
      "params": {
        "currentPassword": "string",
        "newPassword": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    currentPassword String Yes The user's current password.
    newPassword String Yes The user's new password. Must be at least 8 characters.
  • Response:

    {
      "success": true,
      "data": true
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.changePassword",
        "params": {
          "currentPassword": "oldPassword123",
          "newPassword": "newStrongPassword456"
        }
      }'

POST /api/rpc (Method: UserProfileRpc.getUploadKeyForProfilePicture)

  • Description: Gets a secure upload key for the user to upload a new profile picture.

  • Request Body:

    {
      "method": "UserProfileRpc.getUploadKeyForProfilePicture",
      "params": {}
    }
  • Parameters:

    Name Type Required Description
    This method takes no parameters.
  • Response:

    {
      "success": true,
      "data": {
        "uploadKey": "string",
        "uploadUrl": "string"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.getUploadKeyForProfilePicture",
        "params": {}
      }'

POST /api/rpc (Method: UserProfileRpc.updateProfilePicture)

  • Description: Updates the user's profile picture path after a successful upload.

  • Request Body:

    {
      "method": "UserProfileRpc.updateProfilePicture",
      "params": {
        "uploadKey": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    uploadKey String Yes The upload key from the successful upload.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "email": "string",
        "subscriptionId": "string",
        "serviceCode": "string",
        "username": "string",
        "firstName": "string",
        "lastName": "string",
        "role": "string",
        "isActive": true,
        "isVerified": true,
        "phoneNumber": "string",
        "isPhoneVerified": true,
        "onboardingCompleted": true,
        "profilePicture": "string",
        "jobTitle": "string",
        "department": "string",
        "oauthProfiles": [
          {
            "provider": "string",
            "id": "string"
          }
        ],
        "createdAt": "Date",
        "updatedAt": "Date"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.updateProfilePicture",
        "params": {
          "uploadKey": "some-upload-key-from-getUploadKey"
        }
      }'

POST /api/rpc (Method: UserProfileRpc.verifyUserChannel)

  • Description: Verifies a user's communication channel (email or phone) using an OTP.

  • Request Body:

    {
      "method": "UserProfileRpc.verifyUserChannel",
      "params": {
        "otpRequestId": "string",
        "code": "string",
        "identifier": "string",
        "channelType": "email"
      }
    }
  • Parameters:

    Name Type Required Description
    otpRequestId String Yes The ID of the OTP request.
    code String Yes The one-time password code to verify.
    identifier String Yes The identifier of the channel (e.g., email address or phone number).
    channelType String Yes The type of channel to verify. Must be one of email, phone.
  • Response:

    {
      "success": true,
      "data": {
        "success": true,
        "message": "string"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "UserProfileRpc.verifyUserChannel",
        "params": {
          "otpRequestId": "some-otp-request-id",
          "code": "123456",
          "identifier": "[email protected]",
          "channelType": "email"
        }
      }'