All Collections
FAQs and Troubleshooting
Where can I find the Variable ID?
Where can I find the Variable ID?

Learn how to use Variable IDs and API Labels.

David Sepúlveda avatar
Written by David Sepúlveda
Updated over a week ago

You can interact with Ubidots API either using Variable IDs or API labels:

Variable IDs

These are unique variable identifiers you need to specify in your request so our API knows where to put your data. You can find the ID by clicking on the "i" button in the variable box:

This sample request sends data to a Variable using its ID:

curl -X POST -H "Content-Type: application/json" -d '{"value": "10"}' https://industrial.api.ubidots.com/api/v1.6/variables/58f43a9e76254254ab679476/values?token={YOUR-TOKEN}

API Labels

Labels are Human-friendly identifiers for your devices and variables. In the request below we'll use the device API label "weather-station" and the variables API labels "temperature" and "luminosity":

curl -X POST -H "Content-Type: application/json" -d '{"temperature": 10, "luminosity": "42"}' https://industrial.api.ubidots.com/api/v1.6/devices/weather-station?token={YOUR-TOKEN}

The benefits of using labels are:

  • If you have thousands of devices, you can flash the same firmware to all. Just make sure you use a unique ID for the device API label (for example the MAC address or Serial number of the device).

  • It's more descriptive, so your code is easier to understand.

  • You can update several variables in a single request. For example:  {"temperature": 10, "luminosity": "42"}

Did this answer your question?