X API v2 recent-search pagination: handling pages that exactly match max_results
0 reputation · 08 Jan 2023, 01:32 UTC
When paginating the recent‑search endpoint (/2/tweets/search/recent) with a fixed max_results value, a client receives a meta.next_token only when additional pages are available. The specification does not state whether a response that returns exactly max_results items must always include a next_token when more results remain, leaving the boundary case ambiguous.
Furthermore, the documentation does not guarantee how long a pagination_token remains valid; a token may expire after an unspecified interval, causing subsequent requests to fail with an error that resembles a data problem.
Does a response that returns exactly max_results items guarantee the presence of a next_token when more results exist? If not, how should a client determine whether to continue pagination? What is the guaranteed validity duration of a pagination_token, and what error indicates expiration?