Gmail API history id = 0 is Invalid

I may not be asking this question in the right place, but does anyone know why I was trying to use gmail.users.history.list with start history id of 0 it returns 404 saying this id is invalid? I thought a history id of 0 means we are getting the history from the beginning of the gmail account? How else can I get all history from a gmail account?

Hey,

Hope you’re keeping well.

A history ID of 0 isn’t valid in the Gmail API — history IDs are generated dynamically based on mailbox changes and only remain valid for a limited time. To get the complete history, you first need to call gmail.users.messages.list or gmail.users.threads.list to pull all current data, then store the latest history ID from messages.get or threads.get responses. From that point forward, you can use gmail.users.history.list with that stored ID to retrieve incremental changes. There’s no API method to retrieve full history from account creation, so you’ll need to build your own baseline and track changes going forward.

Thanks and regards,
Taz