Q: Why my request fails with {"code":-1002,"msg":"You are not authorized to execute this request."}
Answer:
This is a client side error and -1003
stands for UNAUTHORIZED
, which means you don’t have the necessary security specifications to do the request. This error can happen with different products’ endpoints (Spot, Futures, Margin, …) and is usually related with:
- You don’t have the necessary permissions enabled in your account’s API Management webpage (https://www.binance.com/en/my/settings/api-management) → check the used API Key;
- You didn’t attach signature to the request;
- You attached signature but it’s incorrect. Double check how the signature is generated. You can use a different method (for example Postman) to do the same request, verify if it succeeds and then troubleshoot your local code;
- You didn’t send API-key in the X-MBX-APIKEY header, which is mandatory for some endpoints, for more info please check Endpoint security types
- You’ve used an API Key different than the intended one.
- If you trade on some symbols, and seeing this error, you may need to sign agreement first. Please check from UI and see if you can place order.
- leveraged tokens
- Margin
- etc.