Instagram deprecated their legacy APIs in support for Basic Display API during the late 2019
In Basic Display API you are supposed to use the following API endpoint to get the media id. You will need to supply a valid access token.
https://graph.instagram.com/me/media?fields=id,caption&access_token={access-token}
You can read here on how to configure test account and generate access token on Facebook developer portal.
Here is another article which also describes about how to get access token.