Data API is being very slow

Hi

I have a collection of 10 million files.
I access it using REST API through MongoDbs DATA API

We are using serverless cluster.

The response is very slow.
10-12 seconds to get paginated data

When i run query directly in Mogodb compass , we get response very quickly in compass

But when using rest , we get same data after 10-12 seconds

The response payload total size is less than 10kb , so it shouldnt take this long.

can anyone help please