Users

Get and update your user profile, change your password, and check completion status

Retrieve and update your user profile, change your password, and check your profile completion status.

Endpoints

MethodEndpointDescription
GET/v1/users/meGet your current user profile
PATCH/v1/users/meUpdate your profile
POST/v1/users/change-passwordChange your password
GET/v1/users/me/completionCheck profile completion percentage
🔑

All endpoints on this page require authentication. Include your access token in the Authorization header or pass your API key in the X-API-Key header. See Authentication for details.


Get Current User

Retrieve the profile of the currently authenticated user.

curl https://e-invoicing.earnipay.com/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "User profile retrieved successfully.",
  "data": {
    "id": "usr_abc123",
    "email": "[email protected]",
    "firstName": "Ada",
    "lastName": "Okafor",
    "phone": "+2348012345678",
    "isEmailVerified": true,
    "defaultBusinessId": "biz_xyz789",
    "createdAt": "2025-11-15T10:30:00.000Z",
    "updatedAt": "2026-03-01T14:22:00.000Z"
  }
}

Update Profile

Update your first name, last name, or phone number. Send only the fields you want to change.

curl -X PATCH https://e-invoicing.earnipay.com/v1/users/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "Adaeze",
    "phone": "+2348098765432"
  }'
ParameterTypeRequiredDescription
firstNamestringNoYour first name
lastNamestringNoYour last name
phonestringNoPhone number (include country code)
{
  "statusCode": 200,
  "message": "Profile updated successfully.",
  "data": {
    "id": "usr_abc123",
    "email": "[email protected]",
    "firstName": "Adaeze",
    "lastName": "Okafor",
    "phone": "+2348098765432",
    "isEmailVerified": true,
    "defaultBusinessId": "biz_xyz789",
    "createdAt": "2025-11-15T10:30:00.000Z",
    "updatedAt": "2026-03-11T09:15:00.000Z"
  }
}

Change Password

Change your password while logged in. Provide your current password for verification and your new password.

curl -X POST https://e-invoicing.earnipay.com/v1/users/change-password \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "currentPassword": "oldPassword123",
    "newPassword": "newSecurePassword456"
  }'
ParameterTypeRequiredDescription
currentPasswordstringYesYour current password
newPasswordstringYesNew password (minimum 8 characters)
{
  "statusCode": 200,
  "message": "Password changed successfully."
}
⚠️

Changing your password does not invalidate existing access tokens. To fully sign out of all sessions, call POST /v1/auth/logout with each refresh token after changing your password.


Profile Completion

Check how complete your profile is. Use this to prompt users to fill in missing information like phone number or business setup.

curl https://e-invoicing.earnipay.com/v1/users/me/completion \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
{
  "statusCode": 200,
  "message": "Profile completion status retrieved.",
  "data": {
    "completionPercentage": 75,
    "completedSteps": [
      "email_verified",
      "name_added",
      "business_created"
    ],
    "remainingSteps": [
      "phone_added"
    ]
  }
}

Use the remainingSteps array to guide users through completing their profile. A fully completed profile (100%) typically includes: verified email, name, phone number, and at least one business created.


Error Handling

Status CodeErrorDescription
400Bad RequestInvalid parameters (e.g., new password too short)
401UnauthorizedMissing or expired access token
403ForbiddenCurrent password is incorrect (change password)
{
  "statusCode": 403,
  "message": "Current password is incorrect.",
  "error": "Forbidden"
}