LIFX Developer Zone

New fast options for PUT /state & PUT /states endpoints


Our API is designed to ensure consistent transitions for devices from one state to another. For many operations, this involves having an accurate view of the current state of the device before taking any action, so we need to ask it for its state first. Other transitions, in order to be smooth, require intermediate state changes; for example, to switch on and set to blue a light that is off and set to red, we first switch it to blue, wait for that to succeed, then switch it on, to avoid jarring transitions.

As this involves various network hops to the device, this process is slower than many traditional web APIs, which is something that several API users have mentioned. In addition, there are use-cases where this is unnecessary, for example those in which the client has a pretty good idea of the current state and just wants to send one state change message to the device.

To speed things up for such use-cases, we’ve built a fast mode for the two most popular endpoints, PUT /state & PUT /states. By specifying "fast": true as parameters to those endpoints, we do none of checks described above, and just send the targets the end-state messages. Because we don’t wait around for a reply from the device in fast mode, you’ll just get 202 Accepted with no body (for /state or the equivalent /states) if your request was valid.

Try it out and let us know what you think.


/states always returns 207 but in the response it says “accepted” so it’s working. Seems to be about 50% faster. Nice


Thanks, 207 with “accepted” is correct for /states, I’ve updated the post and the API docs for that endpoint to clarify that.