query_sessions
Note: this tool holds data for a limited timeframe — only the last ~7-14 days are available, depending on the container.
Paginated list of visitor sessions for a date range, with filters (source and 10 has_* click-ID presence flags). Each session record includes UTM params, device info, country, event counts, contact-presence flags (no raw PII), and the full event timeline.
DATA RETENTION: the v2 store currently holds only the last ~7-14 days. Older date_from values pass validation but return empty rows. A "warnings" array is added when date_from is outside the retention window.
USE WHEN:
User wants to loop through all sessions for a given date range, inspecting data from each one in detail.
User wants to enumerate sessions matching a filter (e.g. "list sessions from organic with adblock this week").
User explicitly wants raw session records, not aggregates.
DON'T USE for session counts, top sources, or "how many sessions" / conversion-rate questions — use get_report or get_summary (orders of magnitude faster). For a single session by ID, use list_sessions.
Pagination is cursor-based: pass the returned meta.cursor.next_cursor back as cursor on the next call. Stop when has_more is false. Backend caps date range at 30 days.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor from a previous response's meta.cursor.next_cursor. | |
| source | No | Filter by traffic source | |
| date_to | Yes | End date (YYYY-MM-DD) | |
| has_epik | No | Only sessions arriving with a Pinterest epik | |
| per_page | No | Items per page (default 50, max 1000 on v2). v2 SQLite reads are fast enough to prefer larger pages over more cursor round-trips. | |
| date_from | Yes | Start date (YYYY-MM-DD) | |
| has_adfcd | No | Only sessions arriving with an Adform adfcd | |
| has_gclid | No | Only sessions arriving with a Google Ads gclid | |
| has_fbclid | No | Only sessions arriving with a Facebook fbclid | |
| has_lsclid | No | Only sessions arriving with an lsclid | |
| has_scclid | No | Only sessions arriving with a Snapchat scclid | |
| has_ttclid | No | Only sessions arriving with a TikTok ttclid | |
| has_ga4clid | No | Only sessions arriving with a GA4 client ID | |
| has_msclkid | No | Only sessions arriving with a Microsoft msclkid | |
| has_rdt_cid | No | Only sessions arriving with a Reddit rdt_cid | |
| server_name | No | Server name (required when connected to multiple servers). | |
| container_id | Yes | Container ID (starts with "trc_"). | |
| has_li_fat_id | No | Only sessions arriving with a LinkedIn li_fat_id |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meta | Yes | ||
| sessions | Yes | ||
| warnings | No |