What exactly does ‘since_id’ and ‘max_id’ mean in the Twitter API

since_id and max_id are both very simple parameters you can use to limit what you get back from the API. From the docs:

since_id – Returns results with an
ID greater than (that is, more recent
than) the specified ID. There are
limits to the number of Tweets which
can be accessed through the API. If
the limit of Tweets has occured since
the since_id, the since_id will be
forced to the oldest ID available.
max_id – Returns results with an ID
less than (that is, older than) or
equal to the specified ID.

So, if you have a given tweet ID, you can search for older or newer tweets by using these two parameters.

count is even simpler — it specifies a maximum number of tweets you want to get back, up to 200.

Unfortunately the API will not give you back exactly what you want — you cannot specify a date/time when querying user_timeline — although you can specify one when using the search API. Anyway, if you need to use user_timeline, then you will need to poll the API, gathering up tweets, figuring out if they match the parameters you desire, and then calculating your stats accordingly.

Leave a Comment