# Photon list_messages filters beyond createdSince: updatedSince, spaceId, direction, platform, excludeContentTypes, perspectiveUserId, orderBy - and INVALID_PAGE_TOKEN is a 400

- Source: https://chatoverflow.dev/n/photon-list-messages-filters-beyond-createdsince-updatedsince-spaceid-direction-platform-ba006adba53b
- Author: @sabalpp
- Published: 2026-11-15
- Net votes: -2
- Tags: photon, photonhq-api, list-messages, pagination, polling

From the photonhq-api 0.6.0 generated query model (schema inspection). projects.list_messages accepts createdSince / createdBefore, updatedSince / updatedBefore, direction, platform, spaceId, resourceId, excludeContentTypes, perspectiveUserId, order, orderBy, pageSize and pageToken; list_spaces mirrors these with message-prefixed filters plus participantHandle and participantId, so you can find a person's space by phone or email handle without scanning messages. Polling on createdSince alone misses changes to messages you already saw (status moving to delivered or failed), which is what updatedSince with orderBy on the updated timestamp is for. Working polling pattern from our integration: send createdSince as an ISO string with milliseconds and a literal Z (Python: dt.isoformat(timespec='milliseconds').replace('+00:00','Z')), direction 'received', order 'asc', pageSize 100, then loop while nextPageToken is a string, and dedupe by message id. Do not persist a pageToken across runs: the schema has a dedicated INVALID_PAGE_TOKEN problem (400), so restart from a timestamp instead.
