{"id":1356,"date":"2026-03-27T21:02:18","date_gmt":"2026-03-27T20:02:18","guid":{"rendered":"https:\/\/www.homeserver.lu\/?p=1356"},"modified":"2026-03-27T21:02:50","modified_gmt":"2026-03-27T20:02:50","slug":"renew-enphase-jwt-token","status":"publish","type":"post","link":"https:\/\/www.homeserver.lu\/?p=1356","title":{"rendered":"Renew enphase JWT token"},"content":{"rendered":"\n<p>I am fetching my PV data over web calls; my openhab system (webcalls and enphase binding) requests these data from the local enphase gateway. In order for this to work, you need a JWT token from your enphase account. This token is valid exactly 1 year.<\/p>\n\n\n\n<p>Step 1: open a Terminal and get a session ID from Enlighten:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>SESSION=$(curl -s -X POST https:\/\/enlighten.enphaseenergy.com\/login\/login.json? \\\n  -F &quot;user[email]=my@email.com&quot; \\\n  -F &quot;user[password]=YOUR_ENLIGHTEN_PASSWORD&quot; | jq -r &#39;.session_id&#39;)\necho &quot;Session: $SESSION&quot;<\/code><\/pre><\/div>\n\n\n\n<p>This returns a session ID like for example: <em>bd998gh582w15h598b124a65745zz3wl<\/em>.<em> <\/em><\/p>\n\n\n\n<p>Step 2: Exchange session for a JWT. For this you need your Envoy serial number. Get it with this command:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -sk https:\/\/IP.OF.LOCAL.ENVOY\/info | grep -o &#39;&lt;sn&gt;[^&lt;]*&lt;\/sn&gt;&#39;<\/code><\/pre><\/div>\n\n\n\n<p>This will return your Envoy serial number <em>&lt;sn&gt;123456789012&lt;s\/n&gt;<\/em>.<\/p>\n\n\n\n<p>Step 3: Get your JWT token:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>ENVOY_SERIAL=&quot;your_serial_here&quot;\nTOKEN=$(curl -s -X POST https:\/\/entrez.enphaseenergy.com\/tokens \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &quot;{\\&quot;session_id\\&quot;: \\&quot;$SESSION\\&quot;, \\&quot;serial_num\\&quot;: \\&quot;$ENVOY_SERIAL\\&quot;, \\&quot;username\\&quot;: \\&quot;my@email.com\\&quot;}&quot;)\necho &quot;Token: $TOKEN&quot;<\/code><\/pre><\/div>\n\n\n\n<p>Step 4: Verify that it works by querying your Envoy:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \\\n  https:\/\/IP.OF.LOCAL.ENVOY\/production.json?details=1 | jq &#39;.production[0].wNow&#39;<\/code><\/pre><\/div>\n\n\n\n<p>It should return a wattage.<br>Now replace the password in openhab by the JWT token value.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am fetching my PV data over web calls; my openhab system (webcalls and enphase binding) requests these data from the local enphase gateway. In order for this to work, you need a JWT token from your enphase account. This token is valid exactly 1 year. Step 1: open a Terminal and get a session [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[48],"tags":[],"class_list":["post-1356","post","type-post","status-publish","format-standard","hentry","category-photovoltaic"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1356"}],"version-history":[{"count":3,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1356\/revisions"}],"predecessor-version":[{"id":1359,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=\/wp\/v2\/posts\/1356\/revisions\/1359"}],"wp:attachment":[{"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homeserver.lu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}