Channel Data Control

API Keys

When you read or write data to your channel using the ThingSpeak™ API or MATLAB® code, you need the appropriate read and write permissions. The 16-digit API key allows you to read from a private channel and write to a channel. You do not need an API key to read from a public ThingSpeak channel. Account level API keys are described in User Accounts and Channels.

Write API Key

Use the Write API key to update a channel. If your Write API key is compromised, you can generate a new key. If you use MATLAB Analysis or MATLAB Visualization, the API info is displayed in the Help pane on the right.

To find your Write API key:

  • Click Channels > My Channels.

  • Select the channel to update.

  • Select API Keys tab.

Read API Key

The Read API key enables your application to read data from the API. You can generate multiple Read API keys for different applications.

To get a Read API key:

  • Click Channels > My Channels.

  • Select the channel to update.

  • Select API Keys tab.

  • Click Generate New Read API Key.

API Endpoints

HTTP API Address

For non secure communication to ThingSpeak using HTTP, use the address:

https://api.thingspeak.com

For secure communication to ThingSpeak using HTTPS, use the address:

https://api.thingspeak.com

MQTT API Address

To communicate with the ThingSpeak MQTT broker at the port 1883, use the address:

mqtt.thingspeak.com

Cross-Domain XML

To post using cross-domain XML, use the address:

http://api.thingspeak.com/crossdomain.xml

Channel Access in MATLAB

To read data from a private channel in MATLAB, use the thingSpeakRead function:

thingSpeakRead(channelID,'ReadKey','Your.Read.API.Key.String');
To write data from MATLAB, use the thingSpeakWrite function:
thingSpeakWrite(channelId,data,'WriteKey','Your.Write.API.Key.String');

API Rate Limits

A user with a free license can update a ThingSpeak channel every 15 seconds, and a paid user can update every 1 second. Updating more frequently results in an error. The time between read requests is not limited by ThingSpeak for any users. See Frequently Asked Questions and How to Buy for the most updated license information. To change settings to meet your application requirements locally, download the source code from GitHub .

API Caching

You can cache data when you transmit it via XML or JSON. Feeds returning more than 100 entries are cached for 5 minutes. This limit improves application performance. The last call or feeds specifying "results=100" or fewer are not cached, enabling production of live applications.

Related Topics