Upload Device Data
Guide to uploading device data via API with examples and key requirements.
Request Schema
The API endpoint expects the following JSON payload in the request body:
{
"value": <number | string | boolean>, // The measurement reading (e.g. temperature, humidity)
"status": "<string>", // A status code or message (e.g. "OK", "ERROR")
"timestamp": <integer> // UNIX timestamp in seconds (e.g. 1752696307)
}
Important:
Thetimestamp
field must be a UNIX timestamp in seconds, not milliseconds.
URL Parameter Scheme
The API requires two query parameters in the URL:
Parameter | Type | Description | Example |
---|---|---|---|
org_id | string | The organization ID | v7pi4g3tYB8mu719ovIu |
sensor_id | string | The unique sensor identifier | BEaC9ZZDBntV9s3EnYQJ |
Code Block
import requests
import json
url = "https://api.salkaro.com/v1/upload?org_id={org_id}&sensor_id={sensor_id}"
payload = json.dumps({
"value": 28,
"status": "OK",
"timestamp": 1752696307
})
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY"
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Responses
The API may return the following:
HTTP Status Code | Response Body | Description |
---|---|---|
202 Accepted | { "status": "accepted" } | Data was successfully ingested. |
400 Bad Request | plain text | Malformed JSON, missing fields, or invalid values. |
401 Unauthorized | plain text | Missing or invalid Authorization header or API key. |
402 Payment Required | plain text | Quota exceeded for the requested retention tier. |
405 Method Not Allowed | plain text | HTTP method other than POST was used. |
429 Too Many Requests | plain text | Rate limit exceeded for this (apiKey, sensorId) pair. |
500 Internal Server Error | plain text | Server‑side error (e.g., database write failure). |