> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Enphase

> Client-mode REST API connector for a curated Enphase v4 slice: list systems and read a system summary

Technical Preview

# Enphase

Client-mode REST API connector for a curated Enphase v4 slice: list systems and read a system summary.

* Hub category: **Energy**.
* Base: `https://api.enphaseenergy.com`

## Template reference

Generated from the shipped broker template `enphase` (`-routeCode ENPHASE`). It lists every event the template defines.

### Auth

Auth headers used by the template: `Authorization: Bearer {value.json.api_token}`.

### Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Enphase connector | no |
| `BaseUrl` | string | Enphase base URL without trailing slash (e.g. [https://api.enphaseenergy.com](https://api.enphaseenergy.com)) | yes |

`BASE_ADDRESS` default: `https://api.enphaseenergy.com`.

### Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `Listsystems` | GET | `/api/v4/systems?key={value.json.api_key}` | `energy/enphase/systems/list` | `energy/enphase/systems/list/response` | `api_key`, `api_token` |
| `Getsummary` | GET | `/api/v4/systems/{value.json.system_id}/summary?key={value.json.api_key}` | `energy/enphase/systems/summary` | `energy/enphase/systems/summary/response` | `api_key`, `api_token`, `system_id` |

### Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode ENPHASE"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE EnphaseRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.enphaseenergy.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT Listsystems
        WITH SOURCE_TOPIC "energy/enphase/systems/list"
        WITH DESTINATION_TOPIC "energy/enphase/systems/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v4/systems?key={value.json.api_key}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
    ADD EVENT Getsummary
        WITH SOURCE_TOPIC "energy/enphase/systems/summary"
        WITH DESTINATION_TOPIC "energy/enphase/systems/summary/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/api/v4/systems/{value.json.system_id}/summary?key={value.json.api_key}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_token}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

### Usage example

Call `Listsystems` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'energy/enphase/systems/list/response' &
mosquitto_pub -t 'energy/enphase/systems/list' -m '{"api_key": "<api_key>", "api_token": "<api_token>"}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.