In general, 401 Unauthorized indicates you are either using the wrong credentials or don’t have them set. You should review our documentation (Authentication | API Documentation) and ensure you are using the correct credentials.
Remember that you will have different Sandbox and Production credentials.