Enode API
Download
Download
The Enode API is designed to make smart charging applications easy to develop. We provide an abstraction layer that reduces the complexity when extracting vehicle data and sending commands to vehicles from a variety of manufacturers.
The API has a RESTful architecture and utilizes OAuth2 authorization.
We are always available to handle any issues or just answer your questions. Feel free to reach out on
Registration for API access
In order to use the API you will need a client_id and client_secret. Please contact us if you are interested in using our API in production, and we will provide these credentials.
Authorization
Vehicle / hardware access via the Enode API is granted to your application by the User in a standard OAuth Authorization Code flow.
The authorization scheme documented here is the recommended approach for most situations. However, it is also possible to user other OAuth flows, non-confidential clients, and temporary users. Please feel free to contact us if you have any questions about your use-case or the integration of your existing infrastructure.
Preparation: Configure your OAuth client
Because Enode API implements the OAuth 2.0 spec completely and without modifications, you can avoid rolling your own OAuth client implementation and instead use a well-supported and battle-tested implementation. This is strongly recommended. Information on available OAuth clients for many languages is available
To configure your chosen OAuth client, you will need these details:
- Your
client_id - Your
client_secret - Authorization URL:
https://link.test.enode.io/oauth2/auth - Token URL:
https://link.test.enode.io/oauth2/token
Preparation: Obtain a client access token via OAuth Client Credentials Grant
Your OAuth client will have a method for using the OAuth 2.0 Client Credentials Grant to obtain an access token.
This access token belongs to your client and is used for administrative actions, such as the next step.
This token should be cached by your server and reused until it expires, at which point your server should request a new one.
Step 1. Generate an Enode Link session for your User and launch the OAuth flow
When your User indicates that they want to connect their hardware to your app, your server must call to generate an Enode Link session for your User. The User ID can be any string that uniquely identifies the User, but it is recommended that you use the primary key by which you identify the User within your application.
Example Request:
Example Response:
The returned linkState must be stored by your server, attached to the session of the authenticated user for which it was generated.
Your OAuth client will provide a method to construct an authorization URL for your user. That method will require these details:
- Redirect URI - The URI to which your user should be redirected when the Oauth flow completes
- Scope - The OAuth scope(s) you wish to request access to (see list of valid values )
- State - The value of
linkStatefrom the request above
To launch the OAuth flow, send your user to the authorization URL constructed by your OAuth client. This can be done in an embedded webview within a native iOS/Android app, or in the system's default browser.
Step 2. User grants consent
In the Link UI webapp the user will follow 3 steps:
- Choose their hardware from a list of supported manufacturers (EVs and charging boxes). For certain EV makes it will be necessary to also select a charge box.
- For each selection, the user will be presented with the login screen for that particular hardware. The user must successfully log in.
- A summary of the requested scopes will be presented to the user. The user must choose whether to grant access to your application.
Step 3. OAuth flow concludes with a callback
When the user has completed their interactions, they will be redirected to the Redirect URI you provided in Step 1, with various metadata appended as query parameters.
Your OAuth client will have a method to parse and validate that metadata, and fetch the granted access and refresh tokens.
Among that metadata will be a state value - you must verify that it is equal to the linkState value persisted in Step 1, as .
With the access token in hand, you can now access resources on behalf of the user.
Errors And Problems
OAuth Authorization Request
When the User has completed the process of allowing/denying access in Enode Link, they will be redirected to your configured redirect URI. If something has gone wrong, query parameters error and error_description will be set as documented in of the OAuth 2.0 spec:
Example:
Errors when accessing a User's resources
When using an access_token to access a User's resources, the following HTTP Status Codes in the 4XX range may be encountered:
In all cases, an body is returned to aid in debugging.
Example:
// Node.js + openid-client exampleconst enodeIssuer = await Issuer.discover('https://link.test.enode.io');const client = new enodeIssuer.Client({ client_id: 'xyz', client_secret: 'shhhhh', redirect_uris: ['http://localhost:5000/callback'], response_types: ['code'],});// Node.js + openid-client exampleconst clientAccessToken = await client.grant({grant_type: "client_credentials"});POST /users/{userId}/link HTTP/1.1Authorization: Bearer {access_token}{ "forceLanguage": "nb-NO", "vendor": "Tesla",}{ "linkState": "ZjE2MzMxMGFiYmU4MzcxOTU1ZmRjMTU5NGU2ZmE4YTU3NjViMzIwY2YzNG",}// Node.js + openid-client + express example
// Construct an OAuth authorization URLconst authorizationUrl = client.authorizationUrl({ scope: "offline_access all", state: linkState});
// Redirect user to authorization URLres.redirect(authorizationUrl);// Node.js + openid-client + express example
// Fetch linkState from user sessionconst linkState = get(req, 'session.linkState');
// Parse relevant parameters from request URLconst params = client.callbackParams(req);
// Exchange authorization code for access and refresh tokens// In this example, openid-client does the linkState validation check for usconst tokenSet = await client.oauthCallback('http://localhost:5000/callback', params, {state: linkState})https://website.example/oauth_callback?state=e0a86fe5&error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request.HTTP/1.1 400 Bad RequestContent-Type: application/problem+json{ "type": "https://docs.enode.io/problems/payload-validation-error", "title": "Payload validation failed", "detail": "\"authorizationRequest.scope\" is required",}- Homepage
- https://api.apis.guru/v2/specs/enode.io/1.3.10.json
- Provider
- enode.io
- OpenAPI version
- 3.0.0
- Spec (JSON)
- https://api.apis.guru/v2/specs/enode.io/1.3.10/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/enode.io/1.3.10/openapi.yaml
Tools (30)
Extracted live via the executor SDK.
-
chargers.controlChargerChargingInstruct the charger to start or stop charging
-
chargers.getChargerGet Charger
-
chargers.getChargersList Chargers
-
chargingLocations.deleteCharginglocationsCharginglocationidDelete a Charging Location
-
chargingLocations.getCharginglocationsReturns a list of Charging Locations registered to the User
-
chargingLocations.getCharginglocationsCharginglocationidGet Charging Location
-
chargingLocations.postCharginglocationsCreate Charging Location
-
chargingLocations.putCharginglocationsCharginglocationidUpdates a charging location with new configuration
-
me.disconnectVendorDisconnect a single Vendor from the User's account.
All stored data about their Vendor account will be deleted, and any vehicles that were provided by that Vendor will disappear from the system.
-
me.getMeReturns metadata about the authenticated User, including a list of vendors for which the user has provided credentials.
-
serviceHealth.getHealthReadyGets the combined health status of the service and all functionalities and dependencies.
-
serviceHealth.getHealthVendorsList the supported vendors and their current status.
-
statistics.getStatisticsChargingReturns a normalized timeseries of statistics about power consumption and price for the User.
-
userManagement.deleteUsersUseridDeletes a User and all of their data permanently, and invalidates any associated sessions, authorization codes, and access/refresh tokens
-
userManagement.deleteUsersUseridAuthorizationDeletes the User's stored vendor authorizations and credentials, invalidates any associated sessions, authorization codes, and access/refresh tokens.
All other User data is retained, and if the User is sent through the Link User flow in the future their account will be just as they left it.
No webhook events will be generated for a deauthorized user.
-
userManagement.postUsersUseridLinkCreates an Enode Link session attached to the provided User ID. If this User does not exist, it will be created. The returned
linkStategives the user short-lived access to Enode Link. -
vehicles.getVehicleChargestateGet Vehicle Charge State
-
vehicles.getVehiclesList Vehicles
-
vehicles.getVehiclesVehicleidGet Vehicle
-
vehicles.getVehiclesVehicleidInformationGet Vehicle Information
-
vehicles.getVehiclesVehicleidLocationGet Vehicle Location
-
vehicles.getVehiclesVehicleidOdometerGet Vehicle Odometer
-
vehicles.getVehiclesVehicleidSmartchargingpolicyGet Vehicle Smart Charging Policy
-
vehicles.postVehiclesVehicleidChargingInstruct the vehicle to start or stop charging.
Precedence over smart charging
If the vehicle is at a charging location where smart charging is activated:
- a request to
startcharging will override smart charging and charging will stay on until fully charged. - a request to
stopcharging will override smart charging and charging will be kept off for the duration of the current smart charging cycle.
The smart charging settings are not altered by these actions.
- a request to
-
vehicles.postVehiclesVehicleidWatchTemporarily triggers high-rate updates of the vehicle's properties, and this state expires automatically. This gives you a way to tell us that user may be interacting with your application and are expecting as-fast-as-possible updates on the status of their vehicle in your UI.
Any data changes resulting from this high-rate updating are reflected everywhere, whether you pull data from the
Vehiclesendpoint, or recieve it via theThe specifics of the expiration times, watch behaviors, and change thresholds are tuned by us to make sure that they work as expected, without causing undue interruption to the vehicle. For many vendors, it is not appropriate to let the high-rate monitoring last indefinitely, as it will keep systems within the car awake that should be allowed to fall into low-power/standby modes.
-
vehicles.putVehiclesVehicleidSmartchargingpolicyUpdates the Smart Charging settings for a vehicle
-
webhooks.postWebhooksFirehoseTestTrigger a test payload to be sent to your configured Firehose Webhook url.
-
webhooks.putWebhooksFirehoseUpdate Firehose Webhook
-
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools