How can I successfully make an API request to any endpoint?

Hey there,
I am trying to get the data from a random endpoint and show in the Shopify liquid file.
I am using fetch of JS and trying to get the data inside a liquid file. However, I am getting a 401 error.

Can anyone teach me if there is any way to make an API request to any endpoint such as twitterAPI/instagramAPI?

Your help would be highly appreciated.

Thank You!

Your post isn’t quite clear so lets focus on this part:

I am trying to get the data from a random endpoint and show in the Shopify liquid file.

What is the random endpoint you are calling from your JavaScript file. Or better still, what is the code block?

When you tried it, did you see an error in the console and if so what was it?