1

I am having an issue requesting my account information after importing the data with my api_key from Binance. I am writing a script that allows to fetch live 'MATICUSDT' data with (Python Binance Websocket). The script runs totally fine when creating a historicalklines dataframe but will not return the account info.

Error: BinanceAPIException: APIError(code=-2014): API-key format invalid.

Can anyone help ?

import sqlalchemy 
import pandas as pd 
from binance.client import Client 


api_key ='#' 
api_secret ='#' 

client = Client (api_key, api_secret) 

client.get_account() 

BinanceAPIException: APIError(code=-2014): API-key format invalid.
  • Has been recently discussed at stackoverflow [here](https://stackoverflow.com/questions/71356316/why-cant-i-get-my-account-info-binance-api) – Alex Sep 12 '22 at 02:17

1 Answers1

0

APIError(code=-2014): API-key format invalid.

This error is only thrown when the server can't identify the API Key, because it has bad format or is incorrect. If you're certain the API key and Secret key are correct, see if you're not passing additional elements in the keys, i.e:

api_key ="'key_with_single_quotes'"
api_secret ="'key_with_single_quotes'"

You can also try this example to get account information on the official binance-connector-python library.

Or check this similar question: https://dev.binance.vision/t/apierror-code-2014-api-key-format-invalid/2817/12

Binance
  • 69
  • 6