GuidesEventsStream Position Pagination
Edit this page

Stream Position Pagination

Stream Position Pagination

Paginating the event stream works through the use of the stream_position parameter.

First, send a request to the GET /events API without a stream_position query parameter.

curl https://api.box.com/2.0/events \
  -H "authorization: Bearer ACCESS_TOKEN"

The API will return all available events beginning with the oldest. The response will also include a next_stream_position value that can be used to make the next API call for the next place in the stream.

curl https://api.box.com/2.0/events?stream_position=388720462721 \
  -H "authorization: Bearer ACCESS_TOKEN"

The stream_position can also be set to now to return the most recent stream position.

curl https://api.box.com/2.0/events?stream_position=now \
  -H "authorization: Bearer ACCESS_TOKEN"

In this case, the API returns an empty list and a next_stream_position that can be used for the next call.