Bybit API Python Invalid API key

3.1k views Asked by At

I was trying to create a Bybit Trading bot and when I started testing it it stopped working and it keeps throwing the same error(10003) Invalid API key. I have checked it several times and it was correct. Do you know what can be the reason for that?

4

There are 4 answers

0
Georgy Yuriev On

You need to create API key on https://testnet.bybit.com/. Notice subdomain.

Testnet has its own account and API management

1
Vaibhav Dhingra On

While generating the API key, there is an option at the bottom for whitelisted IP addresses which would be allowed to access the server with the generated API keys. It is possible that you might not have whitelisted your IP address.

1
Arnaud On

For anyone wondering,

You just have to use the 'https://api.bybit.com' endpoint instead of the 'https://api-testnet.bybit.com'.

The authentification code would then look like this:

session_auth = inverse_perpetual.HTTP(
    endpoint="https://api.bybit.com",
    api_key="you api key",
    api_secret="your secret key"
)
0
leoxama On

I got the same error when using testnet=True with API_key and API_secret from the main bybit website. testnet does not refer to the bybit Demo account.

If you plan to enable testnet, you have to use https://testnet.bybit.com/ APIs.