List Admin Users
Page number for pagination.
Items per page (max 100).
Filter by user status. One of active, deactivated.
Example Request
curl -X GET "https://olp-api.nipuntheekshana.com/v1/admin/users?page=1&limit=10" \
-H "Authorization: Bearer <admin_token>"
Example Response (200)
{
"data": [
{
"id": "admin_user_001",
"email": "admin@openpay.com",
"name": "John Admin",
"role": {
"id": "role_001",
"name": "super_admin"
},
"status": "active",
"lastLoginAt": "2026-03-25T16:00:00Z",
"createdAt": "2025-12-01T00:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 5,
"totalPages": 1
}
}
Create Admin User
Email address for the new admin user. Must be unique.
Full name of the admin user.
Password for the account. Minimum 8 characters, must include uppercase, lowercase, and a number.
The role to assign to the user.
Example Request
curl -X POST "https://olp-api.nipuntheekshana.com/v1/admin/users" \
-H "Authorization: Bearer <admin_token>" \
-H "Content-Type: application/json" \
-d '{
"email": "support@openpay.com",
"name": "Jane Support",
"password": "SecureP@ss456",
"roleId": "role_002"
}'
Example Response (201)
{
"id": "admin_user_002",
"email": "support@openpay.com",
"name": "Jane Support",
"role": {
"id": "role_002",
"name": "support_agent"
},
"status": "active",
"createdAt": "2026-03-26T10:00:00Z"
}
Update Admin User
The unique admin user identifier.
New password for the account.
Example Request
curl -X PUT "https://olp-api.nipuntheekshana.com/v1/admin/users/admin_user_002" \
-H "Authorization: Bearer <admin_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Support Lead",
"roleId": "role_003"
}'
Example Response (200)
{
"id": "admin_user_002",
"email": "support@openpay.com",
"name": "Jane Support Lead",
"role": {
"id": "role_003",
"name": "support_lead"
},
"status": "active",
"createdAt": "2026-03-26T10:00:00Z",
"updatedAt": "2026-03-26T11:00:00Z"
}
Deactivate Admin User
Deactivate an admin user account. The user will no longer be able to log in.
The unique admin user identifier.
Example Request
curl -X POST "https://olp-api.nipuntheekshana.com/v1/admin/users/admin_user_002/deactivate" \
-H "Authorization: Bearer <admin_token>"
Example Response (200)
{
"id": "admin_user_002",
"status": "deactivated",
"message": "Admin user deactivated successfully"
}
List Roles
Retrieve all available roles and their permissions.
Example Request
curl -X GET "https://olp-api.nipuntheekshana.com/v1/admin/roles" \
-H "Authorization: Bearer <admin_token>"
Example Response (200)
{
"data": [
{
"id": "role_001",
"name": "super_admin",
"description": "Full access to all platform features",
"permissions": [
"merchants.view",
"merchants.approve",
"merchants.reject",
"merchants.freeze",
"merchants.terminate",
"withdrawals.view",
"withdrawals.manage",
"settings.view",
"settings.update",
"users.view",
"users.manage",
"roles.view",
"roles.manage",
"audit_logs.view"
],
"createdAt": "2025-12-01T00:00:00Z",
"updatedAt": "2025-12-01T00:00:00Z"
},
{
"id": "role_002",
"name": "support_agent",
"description": "View merchants and handle basic support tasks",
"permissions": [
"merchants.view",
"withdrawals.view",
"audit_logs.view"
],
"createdAt": "2025-12-01T00:00:00Z",
"updatedAt": "2026-01-15T00:00:00Z"
}
]
}
Create Role
Unique role name (e.g., finance_manager). Must be lowercase with underscores.
Human-readable description of the role.
List of permission strings to assign to the role.
Example Request
curl -X POST "https://olp-api.nipuntheekshana.com/v1/admin/roles" \
-H "Authorization: Bearer <admin_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "finance_manager",
"description": "Manage withdrawals and view financial reports",
"permissions": [
"merchants.view",
"withdrawals.view",
"withdrawals.manage",
"audit_logs.view"
]
}'
Example Response (201)
{
"id": "role_003",
"name": "finance_manager",
"description": "Manage withdrawals and view financial reports",
"permissions": [
"merchants.view",
"withdrawals.view",
"withdrawals.manage",
"audit_logs.view"
],
"createdAt": "2026-03-26T10:00:00Z",
"updatedAt": "2026-03-26T10:00:00Z"
}
Update Role
The unique role identifier.
Updated list of permissions. This replaces the entire permissions list.
Example Request
curl -X PUT "https://olp-api.nipuntheekshana.com/v1/admin/roles/role_003" \
-H "Authorization: Bearer <admin_token>" \
-H "Content-Type: application/json" \
-d '{
"permissions": [
"merchants.view",
"withdrawals.view",
"withdrawals.manage",
"settings.view",
"audit_logs.view"
]
}'
Example Response (200)
{
"id": "role_003",
"name": "finance_manager",
"description": "Manage withdrawals and view financial reports",
"permissions": [
"merchants.view",
"withdrawals.view",
"withdrawals.manage",
"settings.view",
"audit_logs.view"
],
"createdAt": "2026-03-26T10:00:00Z",
"updatedAt": "2026-03-26T12:00:00Z"
}
Error Responses
{
"error": {
"code": "CONFLICT",
"message": "A role with this name already exists"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "User not found"
}
}