I want to make an API client to pull some temperatures into an application via the Ruuvi cloud API. Unfortunately, I am running into unexepected errors when calling the /register and /verify endpoints, just to receive the bearer token.
When calling /register, I receive an HTTP 500 internal server error: Very Unknown error occurred.
When I use the website to generate a token, the register endpoint generates an HTTP code 401 Unauthorized request. The code is very straightforward, so I don’t see what could be wrong with it. Is the API running correctly?
Hello,
Can you share the exact queries you’re using? Especially on /register, if you get 500 error we need to fix something on input validation.
For example:
curl --location 'https://network.ruuvi.com/register' \
--header 'Content-Type: application/json' \
--data-raw '{"email":"otso@ruuvi.com"}'
{ "result": "success", "data": { "email": "otso@ruuvi.com" } }
And I get code G8VC to my email. Then
curl --location 'https://network.ruuvi.com/verify?token=G8VC'
{ "result": "success", "data": { "email": "otso@ruuvi.com", "accessToken": "753135/XXXX", "newUser": false } }
After that I can use the received access token to authenticate my requests:
curl --location 'https://network.ruuvi.com/sensors-dense?sharedToMe=true&measurements=true&alerts=true&sharedToOthers=true&mode=sparse' \
--header 'Authorization: ••••••'
{
"result": "success",
"data": {
"sensors": [
{
"owner": "otso@ruuvi.com",
"sensor": "C2:07:FC:16:45:3B",
"name": "Saarvahtra Office 453B",
"picture": "https://prod-sensor-profile-pictures.s3.eu-central-1.amazonaws.com/ed9a7169-65e4-4aac-853b-858d061a615e.jpg",
"public": false,
"canShare": true,
"offsetTemperature": 0,
"offsetHumidity": 0,
"offsetPressure": 0,
"customProfile": false,
"subscription": {
"subscriptionName": "Business Starter",
"maxClaims": 50,
"maxShares": 80,
"maxSharesPerSensor": 10,
"maxHistoryDays": 1096,
"maxResolutionMinutes": 1,
"emailAlertAllowed": true,
"pushAlertAllowed": true,
"telegramAlertAllowed": true,
"delayedAlertAllowed": true,
"pdfExportAllowed": true,
"offlineAlertAllowed": true,
"isActive": true,
"endAt": "2026-07-24T10:35:42.000Z"
},
"measurements": [
{
"coordinates": "N/A",
"data": "0201061BFF99040511CB5D25CBB4FFF4FFE403EC6FB6B85DFDC207FC16453B",
"gwmac": "F9:15:8F:92:D8:69",
"timestamp": 1726486598,
"rssi": -57
}
],
"alerts": [
{
"type": "offline",
"min": 0,
"max": 900,
"counter": 0,
"delay": 0,
"enabled": true,
"description": "",
"triggered": false,
"triggeredAt": "2024-08-19T21:23:08.000Z"
}
],
"sharedTo": []
},
. . .
It was caused by incorrect headers. Leaving out the content-type - application/json will yield the internal server error
2 Likes