Binance Live Trading - APIError(code=-2014): API-key format invalid

Viewed 27

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 ?

enter code here

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.

1 Answers

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

Related