---
title: "Difference Between API and UI Date-Based Filtering – LastModifiedOn vs ModifiedOn"
description: "Problem Statement: Customers observed a mismatch between leads fetched via API and leads displayed in the UI when filtering by modified date. Specifically: Leads retrieved using the Get Lead By Date Range (Leads.RecentlyModified) API did not exactly ..."
url: "https://supportb.kinsta.cloud/docs/difference-between-api-and-ui-date-based-filtering-lastmodifiedon-vs-modifiedon/"
updated: "2026-02-17"
category: Account Details_Master Folder
---

# Difference Between API and UI Date-Based Filtering – LastModifiedOn vs ModifiedOn

### **Problem Statement:**

Customers observed a mismatch between leads fetched via API and leads displayed in the UI when filtering by modified date.

Specifically:

- Leads retrieved using the **Get Lead By Date Range (Leads.RecentlyModified) API** did not exactly match the leads shown in the UI when applying the **Modified Date filter** or **Advanced Search**.
- Some leads appeared in the API response but were not visible in the UI results for the same date range.

This created confusion regarding data consistency between API and UI results.

### **Root Cause:**

The difference occurs because the API and UI use different date fields for filtering:

1. **API – Leads.RecentlyModified**
   - Works based on the **LastModifiedOn** field.
   - `LastModifiedOn` represents the most recent update made to a lead across all backend tables.
   - If *any* related field (even outside the main lead table) is updated, the `LastModifiedOn` value is updated.
2. **UI Filters (ModifiedOn / Advanced Search)**
   - Work based on the **ModifiedOn** field.
   - `ModifiedOn` tracks updates only for fields stored in the main lead table.
   - If updates are made to non-main table fields, `ModifiedOn` does not change.
     ### **Impact:**
     Due to this functional difference:
     - Leads may appear in the API response (based on `LastModifiedOn`)
     - But may not appear in the UI filter results (based on `ModifiedOn`)
     This behavior is expected and system-driven.
     ### **Solution / Recommended Approach:**
     To retrieve lead records that exactly match what is visible in the UI:
     - Use the **Retrieve Leads by Search Parameter API** instead of the RecentlyModified API.
       Payload of this API for reference:
       {
              "SearchParameters": {
                  "DefinitionType": 1,
                  "AdvancedSearchTextNew": "{"GrpConOp":"And","Conditions":\[{"Type":"Lead","ConOp":"or","RowCondition":\[{"SubConOp":"And","LSO":"ModifiedOn","LSO_Type":"DateTime","Operator":"between","RSO":"2025-07-29 TO 2025-07-29","RSO_IsMailMerged":false},{"RSO":""},{"RSO":""}\]}\],"QueryTimeZone":"India Standard Time"}",
                  "LeadOnlyConditions": "{"GrpConOp":"And","Conditions":\[\]}",
                  "RetrieveColumns": "ProspectID,FirstName,LastName,EmailAddress"
              },
              "Columns": {
                  "Include_CSV": "ProspectID,FirstName,LastName,EmailAddress"
              },
              "Sorting": {
                  "ColumnName": "ModifiedOn",
                  "Direction": 1
              },
              "Paging": {
                  "PageIndex": 1,
                  "PageSize": 100
              }
          }
