{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"1649fb61-ed3a-44db-9983-0fc8c26aa09f","name":"OpenAPI Developer Document","description":"## What is U home OpenAPI\n\nThe **U Home OpenAPI** provides a seamless and efficient way for your application to integrate with **Ultraloq** smart locks and **U-tec** smart home devices, including smart plugs, switches, and lights. By utilizing the U Home OpenAPI, developers can build applications that interact directly with Ultraloq and U-tec devices, monitor and manage device statuses in real time, process event notifications, and execute control commands, providing a fully connected and intelligent smart home solution.\n\n### System Architecture\n\nThe following illustrations will show how your application interacts with U Home devices:\n\n<img src=\"https://content.pstmn.io/85a1796d-315e-411f-af01-d5c9cc108226/aW1hZ2UucG5n\" width=\"1766\">\n\n## Get Start With U home OpenAPI\n\n### Development Workflow\n\n<img src=\"https://content.pstmn.io/936ac502-a7c5-41a4-bae2-6a060ac54ca3/aW1hZ2UucG5n\" width=\"1762\">\n\n### API Integration Components\n\nThe U Home OpenAPI integration framework is composed of three key components:\n\n- **OAuth2 Authentication Service:** Facilitates secure cloud-based access and authorization.\n    \n- **Device Interaction Interfaces:** Enable seamless interaction with devices for control and management.\n    \n- **Event and Status Notification Service**: Delivers real-time updates on device status and event-driven notifications for efficient monitoring and response.\n    \n\n### OAuth2 Authentication Service\n\n> OAuth 2.0 is the industry-standard protocol for authorization. OAuth 2.0 focuses on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices. \n  \n\nIn the most typical scenario , your service does not get an access token directly; it must first get an authorization code and then exchange that for an access token (and, optionally, a refresh token so that it can request a new access token when the old access token expires). The following figure shows the relationship between the key components of account linking, which are described later in this topic. For an example of how users experience the account linking flow.\n\n<img src=\"https://content.pstmn.io/48226381-2006-46dc-b598-2662727dd16b/aW1hZ2UucG5n\" width=\"1904\">\n\n#### Authorization URI\n\n> [https://oauth.u-tec.com/authorize?response_type=code&amp;client_id={Client](https://auth.u-tec.com/authorize?response_type=code&client_id=%7BClient) ID}&client_secret={client Secret}&scope=openapi&redirect_uri={Redirect URI}&state={state} \n  \n\n#### Callback Redirect URI\n\n> https://{Redirect URI}?authorization_code={code}&state={state} \n  \n\n#### Access token URI\n\n> [https://oauth.u-tec.com/token?grant_type=authorization_code&amp;client_id={Client](https://oauth.u-tec.com/token?grant_type=authorization_code&client_id=%7BClient) ID}&client_secret={Client Secret}&code={code} \n  \n\n#### **Refresh token URI**\n\n> [https://oauth.u-tec.com/token?grant_type=refresh_token&amp;client_id={Client](https://oauth.u-tec.com/token?grant_type=refresh_token&client_id=%7BClient) ID}&client_secret={Client Secret}&refresh_token={Refresh Token} \n  \n\n## OpenAPI Interface Framework\n\n<img src=\"https://content.pstmn.io/ad3b477e-d86c-4696-ae56-146fde6b72ce/aW1hZ2UucG5n\" width=\"1424\">\n\n### OpenAPI Request URL\n\n> [https://api.u-tec.com/action](https://api.u-tec.com/action) \n  \n\n### API Authentication\n\n**Method 1:** Include the access token issued by the OAuth2.0 server in the Authorization header of the HTTP request to interact with the OpenAPI service and perform actions.\n\n``` bash\nPOST /action HTTP/1.1\nHost: api.u-tec.com\nContent-Type: application/json\nAuthorization: Bearer <OAuth2_Access_Token>\n\n ```\n\n**Method 2:** Alternatively, the access token can be included in the request body as part of the request payload.\n\n``` json\n{\n   \"header\": {\n     ......\n   },\n   \"authentication\":{ \n     \"type\": \"Bearer\",\n     \"token\": \"<Oauth2_Access_Token>\"\n   },\n   \"payload\": {\n      ......\n   },\n}\n\n ```\n\n> You can choose either of the above methods; however, if both methods are used, the first method (using the Authorization header) takes precedence. \n  \n\n### Request Body\n\n``` json\n{\n   \"header\": {\n      \"namespace\": \"Uhome.User\",\n      \"name\": \"Get\",\n      \"messageId\": \"Unique identifier, preferably a version 4 UUID\",\n      \"payloadVersion\": \"1\"\n   },\n   \"payload\": {\n      ......\n   }\n}\n\n ```\n\n> **messageId**: A universally unique identifier (UUID) version 4, such as \\`d290f1ee-6c54-4b01-90e6-d701748f0851\\`. This is a 36-character string made up of 32 hexadecimal digits and 4 hyphens. The string is divided into 5 parts, with character counts as follows: 8-4-4-4-12. \n  \n\n### Response Body\n\n``` json\n{\n   \"header\": {\n      \"namespace\": \"Uhome.User\",\n      \"name\": \"Get\",\n      \"messageId\": \"Matches the one in the request header.\"\n      \"payloadVersion\": \"1\"\n   },\n   \"payload\": {\n      \"user\": {\n         \"id\": \"abc-ddd-eee-ff\",\n         \"lastName\": \"Jiang\",\n         \"FirstName\": \"Jacobs\"\n      }\n   }\n}\n\n ```\n\n### Response Error\n\n``` json\n{\n   \"header\": {\n      \"namespace\": \"Uhome.User\",\n      \"name\": \"Get\",\n       \"messageId\": \"Matches the one in the request header.\"\n      \"payloadVersion\": \"1\"\n   },\n   \"payload\": {\n      \"error\": {\n         \"code\": \"INVALID_TOKEN\",\n         \"message\": \"Message didn't include the authorization token or the\n token is invalid, expired, or malformed.\"\n      }\n   }\n}\n\n ```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"42799536","team":6841832,"collectionId":"1649fb61-ed3a-44db-9983-0fc8c26aa09f","publishedId":"2sAYk8v3Eb","public":true,"publicUrl":"https://doc.api.u-tec.com","privateUrl":"https://go.postman.co/documentation/42799536-1649fb61-ed3a-44db-9983-0fc8c26aa09f","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"documentationLayout":"classic-single-column","customisation":{"metaTags":[{"name":"description","value":""},{"name":"title","value":""}],"appearance":{"default":"system_default","themes":[{"name":"dark","logo":null,"colors":{"top-bar":"212121","right-sidebar":"303030","highlight":"FF6C37"}},{"name":"light","logo":null,"colors":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"}}]}},"version":"8.10.1","publishDate":"2025-03-13T00:52:08.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{"title":"","description":""},"logos":{"logoLight":null,"logoDark":null}},"statusCode":200},"environments":[{"name":"U home Beta","id":"80c659d1-f7de-4366-91fa-41e9521c1ecb","owner":"42799536","values":[{"key":"oauth2Url","value":"https://oauth2.u-tec.com","enabled":true,"type":"default"},{"key":"clientId","value":"b37dfc2d81ca779f90ec6611af0e8303","enabled":true,"type":"default"},{"key":"clientSecret","value":"6b594bff545c6608bea0c51dbf9d1406","enabled":true,"type":"default"},{"key":"redirectUri","value":"http://localhost:5173/login","enabled":true,"type":"default"},{"key":"apiUrl","value":"https://api.u-tec.com/action","enabled":true,"type":"default"}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/925214cc6e8a3eb68b065d2e1064630de3f8d21e83d1fe48a417d7a77f5be9f2","favicon":"https://u-tec.com/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"U home Beta","value":"42799536-80c659d1-f7de-4366-91fa-41e9521c1ecb"}],"canonicalUrl":"https://doc.api.u-tec.com/view/metadata/2sAYk8v3Eb"}