How to keep chat context alive via API?

When I use web interface of ChatGPT, I see multiple chats on the left hand sidebar. I can connect on any one of these chats and continue where I left yesterday, last week etc.

How can I achieve this through API calls?

From the course video, the only way to do this seems to be using the entire history/list of user-assistant dialogues in the prompt. In that case does 4K token limit apply?

I’d be grateful if someone can elaborate on this.

Please see this