{"info":{"_postman_id":"3f5bd439-7a1c-40d1-89c2-159392dcfb7a","name":"OSRAM Lightify Public API","description":"Welcome to the Lightify Public API documentation.\n\nThe documentation below describes the endpoints and API calls on the Lightify cloud that are used to operate Lightify devices.\n\nIn order to call the API endpoints you will need a set of valid client_id and secret_id.\n\nNorth America (NA) developers go to \nhttps://na-developers.lightify-api.com \n\nEurope, Middle East and Africa (EMEA) developers go to\nhttps://emea-developers.lightify-api.com\n\nYou will need a Lightify account in the region (NA or EMEA) to register as a developer.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"1. Authorization code grant flow","item":[{"name":"Authorize user & obtain a code","event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["state=\"STATE-\"+Math.floor(Math.random()*100000); // generate a random number between 0 and 10000 and add STATE in front of it","console.log(state);","pm.environment.set(\"state\", state);"]}},{"listen":"test","script":{"type":"text/javascript","exec":["tests[\"status: \"+ responseCode.code]=responseCode.code===200;","","",""]}}],"id":"a9a68e4d-fa02-47fe-9ee8-f65d73c131a2","request":{"auth":{"type":"oauth2","oauth2":{"accessToken":"{{vault:authorization-secret}}","tokenType":"Bearer"}},"method":"GET","header":[],"url":{"raw":"https://{{address}}{{oauthBasePath}}/authorize?client_id={{client_id}}&state={{state}}&redirect_uri={{redirect_uri}}&response_type=code","protocol":"https","host":["{{address}}{{oauthBasePath}}"],"path":["authorize"],"query":[{"key":"client_id","value":"{{client_id}}"},{"key":"state","value":"{{state}}"},{"key":"redirect_uri","value":"{{redirect_uri}}"},{"key":"response_type","value":"code"}]},"description":"As an application developer you need to use a browser or webView to send the end user to this URL.\n\nThe __client_id__ is obtained via the developer interface.\n\nThe value of the parameter __state__ should be randomized to keep track of the end user authorizing and allow the correct association of codes and tokens. This collection uses a parameter value of STATE-xxxxx where xxxxx is a number. The random number is generated in the pre-request script.\n\nThe redirect uri __must__ match one of the redirect uris entered when creating a client in the developer portal otherwise the call will fail.\n\nIf the application is going to scrape the code, the redirect_uri should be a trusted website and the code is obtained from the redirection call."},"response":[],"_postman_id":"a9a68e4d-fa02-47fe-9ee8-f65d73c131a2"},{"name":"Exchange the code for an access token","event":[{"listen":"test","script":{"type":"text/javascript","exec":["console.log (responseBody);","","var jsonData = JSON.parse(responseBody);","","postman.setEnvironmentVariable(\"access_token\",jsonData.access_token);","postman.setEnvironmentVariable(\"refresh_token\",jsonData.refresh_token);","postman.setEnvironmentVariable(\"token_type\",jsonData.token_type);","",""]}}],"id":"bbbd9350-baad-4e6b-b2b5-49fdac7f3af1","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"client_id","value":"{{client_id}}","type":"text"},{"key":"client_secret","value":"{{client_secret}}","type":"text"},{"key":"code","value":"{{code}}","type":"text"},{"key":"grant_type","value":"authorization_code","type":"text"},{"key":"redirect_uri","value":"{{redirect_uri}}","type":"text"}]},"url":"https://{{address}}{{oauthBasePath}}/access_token","description":"Your web application should call this API when the redirect URI is called with a code.\n\nMirror the value of code and add the client_id and secret_id.\n\nThe code is valid only for 5 minutes.\n\nThe redirect_uri should match the uri used in the authorize call."},"response":[],"_postman_id":"bbbd9350-baad-4e6b-b2b5-49fdac7f3af1"},{"name":"Refresh the tokens","event":[{"listen":"test","script":{"type":"text/javascript","exec":["//console.log (responseBody);","","var jsonData = JSON.parse(responseBody);","","postman.setEnvironmentVariable(\"access_token\",jsonData.access_token);","postman.setEnvironmentVariable(\"refresh_token\",jsonData.refresh_token);","postman.setEnvironmentVariable(\"token_type\",jsonData.token_type);"]}}],"id":"4900abdc-79af-4e9f-8f39-1419a1738bab","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"client_id","value":"{{client_id}}","type":"text"},{"key":"client_secret","value":"{{client_secret}}","type":"text"},{"key":"refresh_token","value":"{{refresh_token}}","type":"text"},{"key":"grant_type","value":"refresh_token","type":"text"}]},"url":"https://{{address}}{{oauthBasePath}}/access_token","description":"Refresh an access token using the last refresh token obtained from the API.\n\nRefreshing a token invalidates the current access token and the current refresh token.\n\nA new set of access and refresh tokens is obtained and must be used in all future calls."},"response":[],"_postman_id":"4900abdc-79af-4e9f-8f39-1419a1738bab"},{"name":"Revoke a token","event":[{"listen":"test","script":{"type":"text/javascript","exec":["// now clear the token so that it is no longer available for use","","tests[\"status: \"+ responseCode.code]=responseCode.code===200;","if (responseCode.code === 200) {","    postman.clearEnvironmentVariable(\"access_token\");","    postman.clearEnvironmentVariable(\"refresh_token\");","    postman.clearEnvironmentVariable(\"token_type\");","}"]}}],"id":"a3e623a8-f612-4f1b-9261-6ae03b5bd98f","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"client_id","value":"{{client_id}}","type":"text"},{"key":"client_secret","value":"{{client_secret}}","type":"text"},{"key":"token","value":"{{access_token}}","type":"text"},{"key":"token_type_hint","value":"access_token","type":"text"}]},"url":"https://{{address}}{{oauthBasePath}}/revoke_token","description":"Revoke an access token using a valid access token.\n\nBoth the access token and the refresh token will be revoked and cannot be used further.\n\nThe end-user must re-authenticate for the applicaiton to obtain a new access token.\n\nIf the access token has expired you may revoke the tokens using the refresh token instead and passing __token_type_hint__ as \"refresh_token\""},"response":[],"_postman_id":"a3e623a8-f612-4f1b-9261-6ae03b5bd98f"}],"id":"f439426f-e83a-4164-b911-27e5c3c104cb","description":"All applications will need to follow a 3 legged Oauth flow know as authorization code grant and is RFC 6749 compliant. See [https://tools.ietf.org/html/rfc6749#page-24](https://tools.ietf.org/html/rfc6749#page-24).\n\nEach Lightify end user will need to authorize the application to operate on his/her behalf by agreeing to the application terms and entering their username (email) and password and selecting \"Approve\".\n\nThe APIs below show the flow that an application must implement to obtain a token for the end user to refresh the token and to revoke the token.","_postman_id":"f439426f-e83a-4164-b911-27e5c3c104cb"},{"name":"2. Devices","item":[{"name":"List Devices","id":"c11cc177-2af0-457b-b4d9-487a410abc66","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/devices/","description":"Get the list of devices and device properties for the current user.  This will return a list of JSON objects that represent the devices attached to your gateway.\n\nOne object in the returned list will have type `GATEWAY` and represents the gateway itself.  The gateway device includes a `firmwareVersion` attribute which shows the Wifi and Zigby firmware versions, respectively."},"response":[{"id":"c293aeed-efcf-43ea-b90e-25e5cd990184","name":"List Devices","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"url":"https://{{address}}{{apiBasePath}}/devices/"},"status":"OK","code":200,"_postman_previewlanguage":"Text","header":[],"cookie":[],"responseTime":"0","body":"{\n  \"devices\": [\n    {\n      \"id\": \"123456\",\n      \"name\": \"OSR027BCF90\",\n      \"type\": \"GATEWAY\",\n      \"deviceModel\": \"LightifyHub\",\n      \"firmwareVersion\": \"1.3.1.0, 2.1.0\",\n      \"online\": true\n    },\n    {\n      \"id\": \"123456-d01\",\n      \"name\": \"living room\",\n      \"type\": \"LIGHT\",\n      \"online\": true,\n      \"onOff\": \"on\",\n      \"brightness\": 23,\n      \"colorTemperature\": 2200,\n      \"colorRGBW\": {\n        \"red\": 255,\n        \"green\": 126,\n        \"blue\": 0,\n        \"white\": 0\n      },\n      \"deviceModel\": \"Lightify Flex RGBW\",\n      \"firmwareVersion\": \"01020492\"\n    },\n    {\n      \"id\": \"123456-d03\",\n      \"name\": \"bathroom\",\n      \"type\": \"OUTLET\",\n      \"online\": false,\n      \"onOff\": \"off\",\n      \"brightness\": 100,\n      \"deviceModel\": \"Lightify Switch\",\n      \"firmwareVersion\": \"01020492\"\n    }\n  ],\n  \"cursor\": \"34fe45a3\"\n}"}],"_postman_id":"c11cc177-2af0-457b-b4d9-487a410abc66"},{"name":"Get Device","id":"6539a626-3851-44bd-b1dd-dacee32fb1f1","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Get the status of a device."},"response":[{"id":"d21044ec-5b22-43e2-863b-bd57b02636f6","name":"Get Device","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"{{scheme}}://{{address}}{{port}}{{apiBasePath}}/devices/123456-d03"},"status":"OK","code":200,"_postman_previewlanguage":"Text","header":[],"cookie":[],"responseTime":"0","body":"{\n  \"id\": \"123456-d03\",\n  \"name\": \"bathroom\",\n  \"type\": \"OUTLET\",\n  \"online\": false,\n  \"onOff\": \"off\",\n  \"brightness\": 100,\n  \"deviceModel\": \"Lightify Switch\",\n  \"firmwareVersion\": \"01020492\"\n}"}],"_postman_id":"6539a626-3851-44bd-b1dd-dacee32fb1f1"},{"name":"Light / Plug on","id":"794defa2-2fb1-4125-a310-879b2e4f6614","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{ \"onOff\" : \"on\" }"},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Turn a light or plug on or off."},"response":[],"_postman_id":"794defa2-2fb1-4125-a310-879b2e4f6614"},{"name":"Change Brightness","id":"efc7e3a8-5e1f-4863-97be-f482c554c7e1","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"brightness\": 50\n}"},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Change the brightness to a specific value."},"response":[],"_postman_id":"efc7e3a8-5e1f-4863-97be-f482c554c7e1"},{"name":"Change Color","id":"a97a8a10-41f0-4ff7-8531-6d94b3d4c1ff","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"color\": \"red\"\n}"},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Set a light to a specific named color\nSupported colors:\n    red\n    green\n    blue\n    yellow\n    purple\n    orange\n    pink"},"response":[],"_postman_id":"a97a8a10-41f0-4ff7-8531-6d94b3d4c1ff"},{"name":"Change Color Temperature","id":"6c018e98-da7a-4d94-98f0-50253f232f2b","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"colorTemperature\": 2700\n}"},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Set a light to a specific named color temperature"},"response":[],"_postman_id":"6c018e98-da7a-4d94-98f0-50253f232f2b"},{"name":"Change to RGBW Color","id":"2ece7529-d22f-4aff-ad05-d53084d075b4","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"colorRGBW\": {\n    \"red\": 255,\n    \"green\": 126,\n    \"blue\": 0,\n    \"white\": 0\n  }\n}"},"url":"https://{{address}}{{apiBasePath}}/devices/{{deviceId}}","description":"Set a light to a specific RGBW value"},"response":[],"_postman_id":"2ece7529-d22f-4aff-ad05-d53084d075b4"}],"id":"ee68ba3b-fa4d-4957-b031-4349c98416ff","description":"collection for managing devices, getting and setting their properties","_postman_id":"ee68ba3b-fa4d-4957-b031-4349c98416ff"},{"name":"3. Groups","item":[{"name":"List Groups","id":"e9051d04-82f6-4521-ace8-f7340fac3114","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/groups/","description":"List all of the available Groups on the device."},"response":[{"id":"8d20c9d6-f51a-4066-8261-6d3f8a03423c","name":"List Groups","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"{{scheme}}://{{address}}{{port}}{{apiBasePath}}/groups/"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":"0","body":"{\n    \"groups\": [\n        {\n            \"id\": \"123456-g01\",\n            \"name\": \"Main Entry\",\n            \"devices\": [\n                \"123456-d03\",\n                \"123456-d07\",\n                \"123456-d22\"\n            ],\n            \"scenes\": [\n                \"123456-s01\",\n                \"123456-s02\"\n            ],\n            \"gatewayId\": \"123456\"\n        },\n        {\n            \"id\": \"123456-g02\",\n            \"name\": \"Kitchen\",\n            \"devices\": [\n                \"123456-d01\",\n                \"123456-d02\",\n                \"123456-d04\"\n            ],\n            \"scenes\": [\n                \"123456-s03\"\n            ],\n            \"gatewayId\": \"123456\"\n        }\n    ]\n}"}],"_postman_id":"e9051d04-82f6-4521-ace8-f7340fac3114"},{"name":"Get Group","id":"be9b3d00-91cd-4c9a-b502-e336877571b6","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/groups/{{group_id}}","description":"Get a specific group by ID"},"response":[{"id":"f76d7540-7574-4c8e-97e2-2d1acd1ab5ce","name":"Get Group","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}","description":"OAuth2 Access Token"}],"body":{"mode":"formdata","formdata":[]},"url":"{{scheme}}://{{address}}{{port}}{{apiBasePath}}/groups/{{groupId}}"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":"0","body":"{\n    \"id\": \"123456-g02\",\n    \"name\": \"Kitchen\",\n    \"devices\": [\n        \"123456-d01\",\n        \"123456-d02\",\n        \"123456-d04\"\n    ],\n    \"scenes\": [\n        \"123456-s03\"\n    ],\n    \"gatewayId\": \"123456\"\n}"}],"_postman_id":"be9b3d00-91cd-4c9a-b502-e336877571b6"},{"name":"Set Group property","id":"35e5aa48-9430-451a-80be-9625a06400cb","request":{"method":"PATCH","header":[{"key":"Authorization","value":"Bearer {{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"brightness\": 50,\n  \"color\": \"red\"\n}"},"url":"https://{{address}}{{apiBasePath}}/groups/{{group_id}}","description":"change one or more properties of a group.  Devices that don't support the new properties will be ignored."},"response":[],"_postman_id":"35e5aa48-9430-451a-80be-9625a06400cb"}],"id":"9871781e-9947-415f-9346-6158dceed5d1","description":"The /groups endpoint allows applications to list the groups configured in the end user Lightify account\nIt also allows getting the details of each group via \n/groups/:groupId","_postman_id":"9871781e-9947-415f-9346-6158dceed5d1"},{"name":"4. Scenes","item":[{"name":"List Scenes","id":"5da70d75-0f5f-4c6a-8bc8-7227c71a942f","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/scenes/","description":"List all the scenes available, regardless of the parent groups."},"response":[{"id":"8ca82e62-876a-4d8a-b773-591a3f567cd9","name":"List Scenes","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"{{scheme}}://{{address}}{{port}}{{apiBasePath}}/scenes/"},"status":"OK","code":200,"_postman_previewlanguage":"Text","header":[],"cookie":[],"responseTime":"0","body":"{\n  \"scenes\": [\n    {\n      \"id\": \"123456-s01\",\n      \"name\": \"away\",\n      \"groups\": [\n        \"123456-g01\"\n      ],\n      \"gatewayId\": \"123456\"\n    },\n    {\n      \"id\": \"123456-s02\",\n      \"name\": \"home\",\n      \"groups\": [\n        \"123456-g03\"\n      ],\n      \"gatewayId\": \"1233456\"\n    }\n  ]\n}"}],"_postman_id":"5da70d75-0f5f-4c6a-8bc8-7227c71a942f"},{"name":"Get Scene","id":"d1347455-3102-455a-b247-131677ab6441","request":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://{{address}}{{apiBasePath}}/scenes/{{scene_id}}","description":"Get a particular scene by it's Id.  A scene contains it's parent Group."},"response":[{"id":"c6a2cca2-4eb4-46ec-915c-f28a24c2b8fe","name":"Get Scene by Id","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"{{scheme}}://{{address}}{{port}}{{apiBasePath}}/scenes/{{scene_id}}"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[],"cookie":[],"responseTime":"0","body":"{\n  \"id\": \"123456-s01\",\n  \"name\": \"away\",\n  \"groups\": [\n    \"123456-g01\"\n  ],\n  \"gatewayId\": \"123456\"\n}\n"}],"_postman_id":"d1347455-3102-455a-b247-131677ab6441"},{"name":"Apply Scene","id":"3e81ad40-5885-4f7d-992d-04b8fd035c0b","request":{"method":"PATCH","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer {{access_token}}"}],"body":{"mode":"raw","raw":"{\n  \"action\": \"apply\"\n}"},"url":"https://{{address}}{{apiBasePath}}/scenes/{{scene_id}}","description":"Recall a specific scene on the gateway."},"response":[{"id":"9dc353d5-a792-40ff-a14d-226590e87aa1","name":"Apply Scene","originalRequest":{"method":"PATCH","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer {{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"action\": \"apply\"\n}"},"url":"{{scheme}}://{{address}}{{apiBasePath}}/scenes/{{scene_id}}"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive","name":"Connection","description":""},{"key":"Content-Length","value":"72","name":"Content-Length","description":""},{"key":"Content-Type","value":"application/json; charset=utf-8","name":"Content-Type","description":""},{"key":"Date","value":"Tue, 14 Nov 2017 23:49:27 GMT","name":"Date","description":""},{"key":"ETag","value":"W/\"48-Ha1xEoWblj5TS1OLGZ0WtlSGVuA\"","name":"ETag","description":""},{"key":"Server","value":"nginx","name":"Server","description":""},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains","name":"Strict-Transport-Security","description":""}],"cookie":[],"responseTime":"964","body":"{\n    \"id\": \"123456-s01\",\n    \"name\": \"entryway\",\n    \"type\": \"LIGHT\",\n    \"action\": \"apply\"\n}"}],"_postman_id":"3e81ad40-5885-4f7d-992d-04b8fd035c0b"}],"id":"d0237010-be9a-4994-a9bb-88aefa272c8a","_postman_id":"d0237010-be9a-4994-a9bb-88aefa272c8a"}]}