Increase your income with Hive. Invite your friends and earn real cryptocurrency!

API login

I see the login requires a 2FA token, which is a bit hard (impossible?) to implement programmatically. I want to create a server which monitors my rigs by gathering stats every minute and then sending an email and text if there is an issue. I can’t be entering a 2FA code every minute - how is this supposed to work?


API Login issue - I strggle the same.

Ive user BASH API from Hive API v2
Basicllly it generates login curl like:

curl -s -w '\n%{http_code}' -H 'Content-Type: application/json' -X POST -d '{"login":"--login---","password":"---api-token---"}'

and it throws 403:

    "message": "Security code is required",
    "code": 403003

Since token is fresh, reobrained with entered 2FA … what else can I do on my side? Or what Im doing wrong? Thanks for help.

Ive assume that login = my user account login, and pass = generated api key.

Did you manage to solve it? I have the same problem in implementing in PHP class. The sample function is completely inoperable, returning the security code is required or blocks access to the login api for 30 minutes.

I just created an API token and it works fine. I’m using C#, not sure about PHP.

Could you upload your C# code? Might help us see where the problem is at. I tried php and js and I’m still getting the Security Code is required error

Hi , have you been able to solve the issue ‘security code is required’ as the response?

Кто то решил проблему с

{ “message”: “Security code is required”, “code”: 403003 }


If you guys are having problems with 2FA you need to add this to the header:

X-Security-Code: XXXXXX

bash script example:

# 1. Login
response=`curl -s -w "\n%{http_code}" \
	 -H "Content-Type: application/json" \
     -H "X-Security-Code: XXXXXX" \
	 -X POST \
	 -d "{\"login\":\"$login\",\"password\":\"$password\"}" \

The security code always changes what can i do about it?

I’ve try something like this, and thanks god it works :

curl.exe -X 'POST' `
  '' `
  -H 'accept: application/json' `
  -H 'Content-Type: application/json' `
  -d @"
  \"login\": \"your email login\",
  \"password\": \"your password\",
  \"twofa_code\": \"your 6 digits 2FA code which generated in hiveon system\",
  \"remember\": true

NOTE: 2FA code must be activated before, and get it from authenticator apps like google authenticator or etc

and the result is :

  "access_token": "string of your own token that you've created before",
  "token_type": "bearer",
  "expires_in": some integer

hope it help

The point is, that you login once and save the auth token from then on: so do first what tripflex wrote: add this to your hadder -H “X-Security-Code: XXXXXX”

XXXXX is your 2FA for that point of time, just for the login

And add this:

accessToken=`echo "$response" | jq --raw-output '.access_token'`
echo $accessToken

Now you will echo your accesstoken. This one you should use in subsequent calls. Remove for that the loggin request it is not needed anymore. Create a new script without the login request.

set your acesstoke by copieng it from the login output of your first script into this one.

then always use it, you will not need 2FA from that point on.

response=`curl -s -w "\n%{http_code}" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer $accessToken" \
[ $? -ne 0 ] && (>&2 echo 'Curl error') && exit 1
statusCode=`echo "$response" | tail -1`
response=`echo "$response" | sed '$d'`
[[ $statusCode -lt 200 || $statusCode -ge 300 ]] && { echo "$response" | jq 1>&2; } && exit 1
# Display farms
echo "$response" | jq