---
updatedAt: 2025-06-02T21:21:38.000Z
agentTools:
  projectIndex: https://api.developer.lifx.com/llms.txt
---

# Set States

Set multiple states across multiple selectors.

This endpoint allows you to set different states on multiple selectors in a single request.

Each hash in `states` is comprised of a `state` hash as per [Set State](https://api.developer.lifx.com/docs/set-state), except with the inclusion of `selector` which you would normally specify in the URL in a [Set State](https://api.developer.lifx.com/docs/set-state) request.

You can optionally use the `defaults` hash to specify the base hash that each `state` hash is built from.

The API will attempt to execute each operation at the same time but does not make any guarantees.

<HTMLBlock>{`
<div>
</div>
<style>
div.try-it-out {
  display: none
}
</style>
`}</HTMLBlock>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "api-settings",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.lifx.com/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/lights/states": {
      "put": {
        "summary": "Set States",
        "description": "Set multiple states across multiple selectors.",
        "operationId": "set-states",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "states"
                ],
                "properties": {
                  "states": {
                    "type": "array",
                    "description": "Array of `state` hashes as per [Set State](https://api.developer.lifx.com/docs/set-state). No more than 50 entries.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "defaults": {
                    "type": "object",
                    "description": "Default values to use when not specified in each `states[]` object.",
                    "properties": {}
                  },
                  "fast": {
                    "type": "boolean",
                    "description": "Execute the query [fast](https://api.developer.lifx.com/docs/set-state#fast-mode), without initial state checks and wait for no results.",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "2XX",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"results\": [\n    {\n      \"operation\": {\n        \"selector\": \"label:Lamp\",\n        \"color\": \"#440099\",\n      },\n      // When fast is specified in the request.\n      \"accepted\": true\n    },\n    {\n      \"operation\": {\n        \"selector\": \"label:Bedroom\",\n        \"color\": \"kelvin:2700\",\n      },\n\t\t \"results\": [\n        {\n          \"id\": \"d073d0000000\",\n          \"status\": \"offline\",\n          \"label\": \"Dining Room\"\n        }\n      ]\n    }\n  ]\n}     "
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "operation": {
                            "type": "object",
                            "properties": {
                              "selector": {
                                "type": "string",
                                "example": "[selector 1]"
                              },
                              "power": {
                                "type": "string",
                                "example": "on"
                              },
                              "duration": {
                                "type": "integer",
                                "example": 5,
                                "default": 0
                              }
                            }
                          },
                          "results": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "example": "dxxxxxxxxxx"
                                },
                                "label": {
                                  "type": "string",
                                  "example": "Light 1"
                                },
                                "status": {
                                  "type": "string",
                                  "example": "ok"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```