We are currently not passing the date range to the API endpoint because we were under the impression that GET /list-chat did not support date filtering.
Instead, we are fetching the most recent 1,000 chats and filtering them client-side. The issue appears to be that 'Last Month' records differ from the 1,000 most recent records, so they are never retrieved from the API.
1. How we generate the Date Range (Client-Side): We generate calculations using standard JavaScript
Date
objects.
typescript
// Client-side date calculation for "Last Month"
const today = new Date();
const startOfLastMonth = new Date(today.getFullYear(), today.getMonth() - 1, 1);
startOfLastMonth.setHours(0, 0, 0, 0);
const endOfLastMonth = new Date(today.getFullYear(), today.getMonth(), 0);
endOfLastMonth.setHours(23, 59, 59, 999);
// resulting in timestamps (ms) which we filter against locally
2. The API Call we are making: We are calling the list-chat endpoint with a limit of 1000 and descending sort, but without filter_criteria.start_timestamp.
typescript
// Current API Request Body
{
"sort_order": "descending",
"limit": 1000
}
Can we pass filter_criteria.start_timestamp (with lower_threshold and upper_threshold in milliseconds) to the POST /v2/list-chat endpoint to filter by date server-side? If so, could you confirm the exact JSON structure for that payload?"