ThingSpeak update returns 0: rate limit, API key and field numbers

A return of 0 means the update was not accepted. The free plan limits how often you can write.

What the message means

The service rejects updates that come too fast, with a wrong key or to a field that does not exist.

Fix it in this order

  1. Wait at least 15 seconds between updates, or the interval your plan allows.
  2. Use the write API key, not the read key.
  3. Use field numbers that exist in your channel.
  4. Check the HTTP status code and the reply body.
  5. Check Wi-Fi is connected before the call.
  6. Check the current limits on the service page, since plans change.

Why it happens

The update call replies with the new entry number when it accepts a write, and mirrored copies of the ThingSpeak documentation say a reply of 0 means the update failed. It does not say why.

MathWorks states that a free account can update a channel every 15 seconds and a paid account as fast as once per second, and that updating faster causes an error; the limit varies with the licence type. A wrong write key or a field number that does not exist also fails, so check the status code and the plan limit on MathWorks’ page before changing code.

If you see this, do this

You seeDo this
Returns 0 at onceKey or field.
Works then stopsRate limit.

HTTP error codes, Wi-Fi will not connect.

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

Why this happens

The ThingSpeak update call answers with a plain number. A positive number is the entry id of the new reading and 0 means the update was not accepted. The server does not say why, so the cause has to be found from the usual list: the update came too soon after the previous one, the key is not the channel’s write key, or the field does not exist or is not enabled in the channel settings.

Free accounts are limited by update interval; the documented minimum is 15 seconds between updates to a channel. A loop that sends every second or every few seconds will get 0 for most requests. Several devices writing to the same channel with the same key share that limit.

How to confirm the cause

  • Print both the HTTP status code and the response body. HTTP 200 with body 0 means the request arrived and was refused as an update.
  • Open the channel’s API Keys page and compare the write key character by character with the one in your code; the read key will not work for writing.
  • Open the channel settings and check that the field you are sending (field1 to field8) is enabled.
  • Slow the loop to 20 seconds or more and see whether the first update after a pause succeeds.
  • Check that the value is a plain number or text with no stray characters or spaces.

Worked example

An ESP32 update that prints what came back and waits long enough between calls.

HTTPClient http;
String url = String("http://api.thingspeak.com/update?api_key=")
           + KEY + "&field1=" + String(temp);
http.begin(url);
int code = http.GET();
String body = http.getString();     // "0" means not stored
Serial.println(code);
Serial.println(body);
http.end();
delay(20000);                       // stay above the 15 s limit

Common mistakes

  • Sending in a fast loop while testing.
  • Copying the read key or the channel id instead of the write key.
  • Sending to field9 or a field that has no name set in the channel.
  • Having two devices share one channel and key, so together they exceed the limit.
  • Showing the real key in a public code listing.

If this did not fix it

  • Wi-Fi drops or a negative HTTP code, which is a connection fault before ThingSpeak is reached.
  • A free-account limit on total messages; check the figures shown on your account page.
  • An HTTPS-only setup on your side with a plain HTTP request, or the reverse.
  • The time between boots is too short, so each restart counts as a new quick update.