How to call App Store Server API sandbox environment

I call transaction information for several apps. And I don't have environment information.

So I'm calling the sandbox environment as an official guide. However, unlike the official guide, certain apps sometimes succeed by calling an endpoint using a production URL to receive an error code 401 and calling an endpoint using a sandbox environment.

  1. Why does this difference occur unlike the official guide?

Because of this difference, sometimes it's a production environment and JWT hasn't expired, but I get a 401 error and call the sandbox environment. 2. Please let me know the solution.