I created an express api and hosted on render. I’m able to make post and get request to the api, but after a while the data in the api becomes empty.
That doesn’t sound like a Render issue, but a code one.
You would need to provide a lot more information/examples for anyone to be able to assist you.
As a wild guess, maybe you’re writing some data to the instance? Instances have an ephemeral filesystem, meaning any files created after the instance is started will be lost when it next restarts (e.g. deploys, free instance spin-down, etc.).