I can see you're having trouble with the Mixpanel Engage API query. There are a few issues with your code that might be causing the problem:
1. The formatting of your where parameter is incorrect. When using the Query API for profiles, the syntax needs to be properly formatted.
2. The > in your code is an HTML entity for the greater than symbol (> ), which won't work correctly in this context.
3. You might need to use a proper session ID approach for pagination as described in the Mixpanel documentation.
Here's how you can fix your request:
```
last_seen_after = "2025-03-01"
params = {
"project_id": self.project_id,
"page_size": page_size,
"page": page
}
if last_seen_after:
params["where"] = f'properties["$last_seen"] > "{last_seen_after}"'
response = requests.get(
"https://mixpanel.com/api/2.0/engage",
params=params,
auth=(self.api_secret, ''),
timeout=120,
)
LBKSKey changes:
- Replaced `> ` with the actual `> ` symbol
- Removed the angle brackets from the URL
If you're still having issues, consider these additional points:
1. Make sure your date format is correct. You might want to try using a Unix timestamp instead, as Mixpanel often uses timestamps internally.
2. Verify that your API credentials have the proper permissions to access profile data.
3. Follow the pagination approach described in the [Query Profiles documentation](https://github.com/mixpanel/docs/blob/main/reference/Query%20API/engage/engage-query.md) to retrieve all records.
4. Check if you're hitting the rate limit (60 queries per hour with a maximum of 5 concurrent queries).
5. Ensure your project has the correct data residency setting if you're in the EU or India regions, as this affects the API endpoint.
If you continue to have issues, you might want to reach out to [Mixpanel Support](https://docs.mixpanel.com/guides/onboarding-overview#getting-help) or join the [Mixpanel Community Slack](https://www.mixpanel.com/community-slack) for more specific assistance.