Skip to content

Instantly share code, notes, and snippets.

@ben221199
Last active December 16, 2024 13:10
Show Gist options
  • Save ben221199/8c91096365ddf4c01acd5b64f8423f28 to your computer and use it in GitHub Desktop.
Save ben221199/8c91096365ddf4c01acd5b64f8423f28 to your computer and use it in GitHub Desktop.
Enphase

Enphase API

Version 1 [End of Life]

Base URL: https://api.enphaseenergy.com/api

Endpoints

TODO:

  • /systems
  • /systems/[system_id]/consumption_lifetime
  • /systems/[system_id]/envoys
  • /systems/[system_id]/monthly_production
  • /systems/[system_id]/stats
  • /systems/[system_id]/summary

Version 2 (May 2014) [End of Life]

Base URL: https://api.enphaseenergy.com/api/v2

Authorization

Property Value
URL https://enlighten.enphaseenergy.com/app_user_auth/new
Method GET
Parameters app_id (Application ID; see developer page)
redirect (Redirect URI; optional)

If redirect parameter is not present, it will show you the user_id. If is redirect parameter is present, it will redirect you to the page in that parameter, with a user_id appended to the request parameters.

Authentication

Property Value
Parameters key (API Key; see developer page)
user_id (User ID)

Callback and Datetime Format

Property Value
Parameters callback (Converts response in JavaScript compatible callback function)
datetime_format (Accepts iso8601 or epoch)

Endpoints

TODO:

  • /systems/[system_id]/consumption_lifetime
    • start_date: YYYY-mm-dd format
    • end_date: YYYY-mm-dd format
  • /systems/[system_id]/consumption_stats
    • start_date: YYYY-mm-dd format
    • end_date: YYYY-mm-dd format
  • /systems/[system_id]/energy_lifetime
    • start_date: YYYY-mm-dd format
    • end_date: YYYY-mm-dd format
    • production: all or absent
  • /systems/[system_id]/envoys
  • /systems
    • next
    • limit
    • system_id
    • system_name
    • status or status[]
    • reference
    • installer
    • connection_type
  • /systems/[system_id]/inventory
  • /systems/inverters_summary_by_envoy_or_site
    • site_id
  • /systems/[system_id]/monthly_production (DEPRECATED)
    • start_date YYYY-mm-dd format
  • /systems/[system_id]/production_meter_readings
    • read_at
    • end_at
  • /systems/[system_id]/rgm_stats
    • start_at
    • end_at
  • /systems/[system_id]/stats
    • start_at
    • end_at
  • /systems/[system_id]/summary
    • summary_date
  • /systems/search_system_id
    • serial_num

User ID

Every Enphase user has an integer user ID. The user ID used at the API is different, but contains the same value in its core. It can be derived as follows (where $userID is the integer version):

hex(base64(string($userID)) + "\n")

Version 3

It seems that version 3 never existed.

Version 4 (February 23, 2022)

Base URL: https://api.enphaseenergy.com/api/v4

Authorization

In version 4 of the API, there are two flows:

  • Partner flow
  • Non-Partner flow

Partner flow is only available in the Partner plan, and the Partner plan is only available to registered Enphase installers. The Partner flow makes it possible to use the password grant type. Both employee credentials as customer credentials can be used in this flow. Note that employee credentials using the Non-Partner flow will likely cause a You don't own any system. error.

  1. Authorize application. Skip to step 2 if Partner flow.
Property Value
URL https://api.enphaseenergy.com/oauth/authorize
Method GET
Parameters response_type (OAuth 2 Response Type)
client_id (OAuth 2 Client ID)
redirect_uri (OAuth 2 Redirect URI; optional, but likely required by Enphase)
state (OAuth 2 State; optional)
  1. Get token.
Property Value
URL https://api.enphaseenergy.com/oauth/token
Method POST
Parameters Partner flow:
grant_type (OAuth 2 Grant Type; password for Partner flows)
username (Username)
password (Password)

Non-Partner:
grant_type (OAuth 2 Grant Type; authorization_code for Non-Partner flows)
redirect_uri (OAuth 2 Redirect URI; must be same as the one in step 1)
code (OAuth 2 Code; code received in step 1)
Header Authorization: Basic ${base64(clientID + ":" + clientSecret)}
  1. Refresh token.
Property Value
URL https://api.enphaseenergy.com/oauth/token
Method POST
Parameters grant_type (OAuth 2 Grant Type; refresh_token)
refresh_token (OAuth 2 Refresh Token)
Header Authorization: Basic ${base64(clientID + ":" + clientSecret)}

Authentication

Property Value
Parameters key (API Key; see developer page)
Header Authorization: Bearer ${access_token}
Header Key (API Key; see developer page)

Note: It is possible to choose between Key HTTP header or the key query parameter.

Endpoints

See https://developer-v4.enphase.com/docs.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment