Cloud functions

Overview of API field limits

API Field < 0.8.0 0.8.0 - 2.x ≥ 3.0.0 ≥ 6.3.0
Variable Key 12 64 64 64
Variable Data 622 622 8642 / 10243 1024
Function Key 12 64 64 64
Function Argument 63 622 8642 / 10243 1024
Publish/Subscribe Event Name 64 64 64 64
Publish/Subscribe Event Data 255 622 8642 / 10243 163844
  • Limits are in bytes of UTF-8 encoded characters, except in 6.2.0 and later, where the data can be binary.
  • 2On Gen 2 devices (Photon, P1, Electron, E-Series), the limit is 864 characters.
  • 3On the P2, Photon 2, and Gen 3 devices (Argon, Boron, B-Series SoM, Tracker SoM, and E404X) the limit is 1024 characters.
  • The 0.8.0 - 2.x column includes all 2.x LTS versions. Higher limits will not be back-ported to 2.x LTS.
  • 4Large events require Device OS 6.3.0 or later and using the CloudEvent API.

Instead of hardcoding these values, you should use these definitions:

  • particle::protocol::MAX_VARIABLE_KEY_LENGTH
  • particle::protocol::MAX_VARIABLE_VALUE_LENGTH
  • particle::protocol::MAX_FUNCTION_KEY_LENGTH
  • particle::protocol::MAX_FUNCTION_ARG_LENGTH
  • particle::protocol::MAX_EVENT_NAME_LENGTH
  • particle::protocol::MAX_EVENT_DATA_LENGTH

Additionally, some older Boron and B-Series SoM with a SARA-R410M-02B modem (LTE Cat M1) may have a limit of 782 bytes instead of 1024 bytes, see Particle.maxEventDataSize() for more information.