API Reference

Detailed REST API reference for the User Service microservice.

Overview

The arya-banking-user-service exposes a set of RESTful APIs for managing user profiles, registration lifecycle, and security metadata.

Base URL for local development: http://localhost:8086

Swagger UI

Interactive API documentation is available directly on the service:

Text code-highlight
http://localhost:8086/swagger-ui/index.html

Or aggregated via the API Gateway at http://localhost:8085/swagger-ui.html (select "User Service" from the dropdown).


User Registration (/api/users)

Register User (Step 1)

POST /api/users/register

Creates a new user in MongoDB and synchronizes the identity with Keycloak.

Request Body (RegisterDto)

ParameterTypeRequiredRegex / ValidationDescription
firstNameStringYes^[A-Za-z]+$User's first name (letters only)
lastNameStringYes^[A-Za-z]+$User's last name (letters only)
emailIdStringYesEmail RegexUnique email address
passwordStringYesComplex RegexMin 15 chars, 1 Uppercase, 1 Lowercase, 1 Digit, 1 Special
primaryContactNumberStringYes^[6-9][0-9]{9}$10-digit Indian mobile number

Example Request:

Json code-highlight
{
  "firstName": "John",
  "lastName": "Doe",
  "emailId": "john.doe@example.com",
  "password": "Password@12345678",
  "primaryContactNumber": "9876543210"
}

Example Response (201 Created):

Json code-highlight
{
  "userId": "ARYA3F9A12",
  "responseMessage": "User Registered Successfully",
  "responseCode": "USER_CREATED_201"
}

Update User Profile (Step 2)

PUT /api/users/{userId}

Updates contact numbers and physical addresses.

Path Parameters

  • userId: The unique application ID (e.g., ARYA3F9A12).

Request Body (UserUpdateDto)

ParameterTypeRequiredDescription
isLockUserbooleanNoSet to true to block the user.
updateContactDtoObjectNoNew contact number details.
updateAddressDtoObjectNoNew physical address details.

Example Address Update:

Json code-highlight
{
  "updateAddressDto": {
    "addressLine1": "123 Main St",
    "city": "Mumbai",
    "state": "Maharashtra",
    "pinCode": "400001",
    "addressType": "PERMANENT"
  }
}

Get User Details

GET /api/users/{userId}

Returns the full user profile including contacts and addresses.

Example Response (200 OK):

Json code-highlight
{
  "userId": "ARYA3F9A12",
  "firstName": "John",
  "emailId": "john.doe@example.com",
  "status": "ACTIVE",
  "addresses": [
    {
      "city": "Mumbai",
      "addressType": "PERMANENT"
    }
  ]
}

Security Details (/api/security-details)

Update Security Questions (Step 3)

PUT /api/security-details/{userId}

Updates user multi-factor security questions.

Request Body (UpdateSecurityDetailsDto)

ParameterTypeRequiredDescription
securityQuestionsListYesArray of Q&A objects.

Example Request:

Json code-highlight
{
  "securityQuestions": [
    {
      "question": "What is your pet's name?",
      "answer": "Buddy"
    }
  ]
}

Internal Service API (/internal/api/security-details)

These endpoints are restricted to ROLE_INTERNAL_SERVICE and are intended for service-to-service communication only.

Signal Login Failure

PUT /internal/api/security-details/{userId}?loginFailed=true

Called by the Auth Service to manage account locking policies.

Query Parameters

  • loginFailed: Boolean. If true, increments the failure counter.

Response (200 OK):

Json code-highlight
{
  "userId": "ARYA3F9A12",
  "responseCode": "SUCCESS",
  "response": "Security details updated successfully"
}
If loginFailedAttempts matches 5, the response will include "DISABLE_USER": "true" and the user status will be set to BLOCKED.