MATIH Platform is in active MVP development. Documentation reflects current implementation status.
6. Identity & Access Management
User Management
User CRUD

User CRUD Operations

Production - UserController - POST, GET, PUT, DELETE /api/v1/users

User CRUD operations allow administrators to create, read, update, and delete user accounts within their tenant. Self-service endpoints allow authenticated users to view and update their own profile.


6.4.1Create User

curl -X POST http://localhost:8081/api/v1/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "email": "new.user@company.com",
    "password": "InitialP@ss123",
    "firstName": "New",
    "lastName": "User",
    "displayName": "New User",
    "phoneNumber": "+1234567890",
    "roleIds": [1, 3]
  }'

Request Schema

FieldTypeRequiredValidationDescription
emailStringYes@NotBlank, @Email, max 255User email
passwordStringYes@NotBlank, 8-128 charsInitial password
firstNameStringNoMax 100First name
lastNameStringNoMax 100Last name
displayNameStringNoMax 200Display name
phoneNumberStringNoMax 20Phone number
roleIdsSet<Long>NoRole IDs to assign

Response (201 Created)

{
  "id": 42,
  "tenantId": "550e8400-e29b-41d4-a716-446655440000",
  "email": "new.user@company.com",
  "firstName": "New",
  "lastName": "User",
  "displayName": "New User",
  "phoneNumber": "+1234567890",
  "enabled": true,
  "locked": false,
  "emailVerified": false,
  "mfaEnabled": false,
  "roles": [
    { "id": 1, "name": "user" },
    { "id": 3, "name": "analyst" }
  ],
  "createdAt": "2026-02-12T10:00:00Z",
  "updatedAt": "2026-02-12T10:00:00Z"
}

6.4.2Get User

# Get by ID (admin)
curl -X GET http://localhost:8081/api/v1/users/42 \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"
 
# Get current user (any authenticated user)
curl -X GET http://localhost:8081/api/v1/users/me \
  -H "Authorization: Bearer <access-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"

6.4.3List Users

Supports pagination and text search across name and email fields:

curl -X GET "http://localhost:8081/api/v1/users?search=jane&page=0&size=20" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"

Query Parameters

ParameterTypeDefaultDescription
searchStringnullSearch query for name or email
pageint0Page number (zero-based)
sizeint20Page size
sortStringSort field and direction

6.4.4Update User

curl -X PUT http://localhost:8081/api/v1/users/42 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "firstName": "Updated",
    "lastName": "Name",
    "phoneNumber": "+0987654321"
  }'

6.4.5Delete User

Soft-deletes the user account. The record remains in the database with deleted=true.

curl -X DELETE http://localhost:8081/api/v1/users/42 \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"

Returns 204 No Content.


Error Codes

CodeHTTP StatusDescription
RESOURCE_NOT_FOUND404User not found
RESOURCE_DUPLICATE409Email already exists in tenant
VALIDATION_ERROR400Invalid input
ACCESS_DENIED403Not ADMIN or PLATFORM_ADMIN