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

Hive API v2

If you guys are having problems with 2FA make sure you add it to the header using:

X-Security-Code: XXXXXX

For example here’s the bash script:

# 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\"}" \
	 "$baseUrl/auth/login"`

Hi, I’ve got the error 403 forbidden to every command I try in the api specification link.

here is what I got to every command I tried :

<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

here is the curl (bash) snippet:

curl -X 'GET' \
  'https://api2.hiveos.farm/api/v2/farms/[my_farm_ID]/stats' \
  -H 'accept: application/json' \
  -H 'Authorization: [my_token]'

Am I doing something wrong ?
Is the apikey the same as the Authentication Tokens which is in the account section of the hiveOs website ?

thanks you.

Hey did you manage to get it working? having same issue

Same issue since yesterday for me. Already wrote to the support team, no answer.

I am getting the same thing. The only api endpoint that is responding for me to the /farms

Last successful call was on 2022-02-04 19:45:50.903 UTC

Anyone using 2fa with the API? I am not and was wondering if this is the issue.

No I’m not using 2FA. I’m using "Authorization: Bearer " + apiToken as always did. It’s not working in swaggerhub too.

Curl verbose is returning no data:
< HTTP/2 200
< date: Sat, 05 Feb 2022 11:09:47 GMT
< content-type: application/json
< content-length: 0
< vary: Authorization
< cache-control: no-cache, private
< x-backend: belle3
< x-router-personality: p2
< cf-cache-status: DYNAMIC
< expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
< server: cloudflare
< cf-ray: 6d8bb036aab059a1-MXP
<

  • Connection #0 to host api2.hiveos.farm left intact

Ive got this issue too. Since yesterday api not working.

Hello guys,

I’m trying to interact with the API in Python but I couldn’t authenticate. Is there anybody who got it working with python? Here is my code, now It’s just a scratch for getting auth and get farm data:

import requests

url =“https://api2.hiveos.farm/api/v2/auth/login
headers = {
“login”: “myemail”,
“password”: “mylogin for hiveos”,
“twofa_code”: " Turned this off so I leave it blank",
“remember”: “true”,

“Authorization”:“Bearer”“my api token wich i generated in my hiveos settings”
}
response = requests.request(“GET”, url, headers=headers)
#json_data = response.json() Here i got code 405

url1 =“https://api2.hiveos.farm/api/v2/farms/3266808/stats

response1 = requests.request(“GET”, url1,)
json_data1 = response1.json()

print(json_data1)here i got code 405

{‘message’: ‘Unauthenticated.’}

Thanks for the replys!

Hi! do you solve it?

Hi, I still have the problem.

hello

i think you don’t have to add this headers :
“login”: “myemail”,
“password”: “mylogin for hiveos”,
“twofa_code”: " Turned this off so I leave it blank",
“remember”: “true”,

just use the token
“Authorization”:“Bearer”“my api token wich i generated in my hiveos settings”

and it should be better to try on another endpoint , like : /farms

because the endpoint login is use for a form login like (web interface)

tell me if it works :wink:
(sorry for my english :rofl:)

hello here,

someone already succeeded to apply a profile overclock by ID ? and how ?

thanks in advance

i think it desnt work. still getting:

“message”:“The given data was invalid.”,“errors”:{“login”:[“The login field is required.”],“password”:[“The password field is required.”]}

have you gotten it to work?

Which endpoint are you testing on ?

https://api2.hiveos.farm/api/v2/farms/413682/stats

How do you call the API ? Curl ?
I can send you an example

curl --location --request GET 'https://api2.hiveos.farm/api/v2/farms/12345/workers/1234567' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer yourAPItoken'

I can login with the API, but I have an issue with the code when I try to stop an specific worker. Who can spot my mistake?

		function stopMinning() {
			return fetch(`${baseUrl}/farms/${farm}/workers/${workerId1}/command`, {
				method: 'POST',
				headers: {
					'Content-Type': 'application/json',
					'accept': 'application/json',
					'Authorization': `Bearer ${token}`,
				},
				body: JSON.stringify(
					{
						"command": "stop"
					}
                                )
			}).then(r => {
				if (!r.ok) {
					r.json().then(data => {
						console.error(data.message || 'Response error');
					});
					return Promise.reject(r);
				}
				else {
					return r.json();
				}
			});
		}

it works now, The correct body is

body: JSON.stringify({
					'command': 'miner',
					'data': {'action': 'stop'}

				})
1 Like

Thanks that solved it!