Developers

Build on iotBind

Simple APIs designed for microcontrollers: one URL, a device key and a few parameters.

HTTP / HTTPS

Send and read data with GET or POST requests and JSON replies.

MQTT

Publish and subscribe through your MQTT.one broker for instant commands.

Webhooks

Receive signed notifications on your own server when something happens.

Quick start

  1. 1

    Create an account

    Register for free and confirm your email address.

  2. 2

    Add a device

    Add a switch, sensor, tank or tracker, then open its key icon to copy the unique ID and secret key.

  3. 3

    Send your first request

    Use the examples below in your sketch or test them in your browser.

Basics

The base address of API version 1 is http://api.iotbind.com/v1 (HTTPS is supported). Every request carries these parameters, either in the query string (GET) or as form fields (POST):

ParameterDescription
method"get" or "post": how the parameters are sent. Always required.
keyThe secret API key of the device. Always required.
uidThe unique ID of the device. Always required.

Keep the device key secret. If it leaks, generate a new one from the device key icon: the old key stops working at once.

Switches

Turn a switch on or off, store up to three values, or read its current state.

GET | POST http://api.iotbind.com/v1/switch.php

ParameterDescription
cmd Optional command: onoffgetping
data1 Optional text or number to store.
data2 Optional text or number to store.
data3 Optional text or number to store.
Send data
http://api.iotbind.com/v1/switch.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=on&data1=24.5&data2=OK
Reply: {"MESSAGE":"UPDATED"}
Read the device
http://api.iotbind.com/v1/switch.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
  "uid": "UNIQUE_ID", "name": "Living room", "type": "RGB Light", "cmd": "on",
  "data1": "24.5", "data1_unit": "C", "data2": "OK", "data2_unit": "", "data3": "", "data3_unit": ""
}

The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}

Sensors

Store up to three readings, or read the latest values.

GET | POST http://api.iotbind.com/v1/sensor.php

ParameterDescription
cmd Optional command: getping
data1 Optional text or number to store.
data2 Optional text or number to store.
data3 Optional text or number to store.
Send data
http://api.iotbind.com/v1/sensor.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&data1=23.4&data2=41&data3=1012
Reply: {"MESSAGE":"UPDATED"}
Read the device
http://api.iotbind.com/v1/sensor.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
  "uid": "UNIQUE_ID", "name": "Greenhouse", "type": "Temperature",
  "data1": "23.4", "data1_unit": "C", "data2": "41", "data2_unit": "%", "data3": "1012", "data3_unit": "hPa"
}

The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}

Liquid tanks

Store the tank level and temperature, switch its pump, or read its state.

GET | POST http://api.iotbind.com/v1/tank.php

ParameterDescription
cmd Optional command (switches the tank pump): onoffgetping
level Tank level (number).
temperature Optional tank temperature (number).
Send data
http://api.iotbind.com/v1/tank.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=on&level=67&temperature=21
Reply: {"MESSAGE":"UPDATED"}
Read the device
http://api.iotbind.com/v1/tank.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
  "uid": "UNIQUE_ID", "name": "Roof tank", "type": "Water Level", "cmd": "on",
  "level": "67", "level_unit": "%", "temperature": "21", "temperature_unit": "C"
}

The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}

GPS tracking

Store a position with up to four extra values, or read the latest position.

GET | POST http://api.iotbind.com/v1/tracking.php

ParameterDescription
cmd Optional command: getping
latitude Latitude (number).
longitude Longitude (number).
data1 Optional text or number to store.
data2 Optional text or number to store.
data3 Optional text or number to store.
data4 Optional text or number to store.
Send data
http://api.iotbind.com/v1/tracking.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&latitude=24.7136&longitude=46.6753&data1=62
Reply: {"MESSAGE":"UPDATED"}
Read the device
http://api.iotbind.com/v1/tracking.php?method=get&key=DEVICE_KEY&uid=UNIQUE_ID&cmd=get
{
  "uid": "UNIQUE_ID", "name": "Car", "type": "GPS tracking",
  "latitude": "24.7136", "longitude": "46.6753", "data1": "62", "data1_unit": "km/h"
}

The same parameters work as POST form fields with method=post · To report that the device is connected, send cmd=ping → {"MESSAGE":"PING OK"}

MQTT

iotBind works with the MQTT.one service: the platform publishes to your topics when a device changes, and your devices publish JSON messages to iotBind.

  1. Create an MQTT.one account and add the topics you need.
  2. In the platform, open "MQTT service" and link your MQTT.one account.
  3. In the device settings, turn on "MQTT publish messages" and choose its topic.
  4. Connect your board to the broker with your MQTT.one details, using the client ID iotbind-<UNIQUE_ID>.
  5. Publish JSON messages to the iotbind topic shown in your account.
Message to the iotbind/switch/ topic
{ "key": "DEVICE_KEY", "uid": "UNIQUE_ID", "cmd": "off", "data1": "24.5" }

MQTT requires a plan with the MQTT feature and an account at MQTT.one

Error codes

400Bad request: the address, parameters or body are not valid.
401Unauthorized: the device key or unique ID is wrong.
404Not found: the requested resource does not exist.
429Too many requests: slow down, or check your plan limits.

Your next project deserves a cloud

Create a free account in a minute and connect your first device today.