# Vehicles

Endpoints for interacting with vehicles.

## List vehicles

 - [GET /vehicles](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles.md): List all the vehicles that the authorization token has access to.

## Create unintegrated vehicle

 - [POST /vehicles](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicles.md): If a vehicle cannot be integrated with our system, an "unintegrated" vehicle must be created instead to represent it and record important details like battery size.

To add a vehicle that can be integrated, see the Onboarding documentation.

## Retrieve a vehicle

 - [GET /vehicles/{vehicle_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id.md): Retrieve a single, specific vehicle's details.

## Update a vehicle

 - [PATCH /vehicles/{vehicle_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/patch-vehicles.md): Update a vehicle.

## Remove a vehicle

 - [DELETE /vehicles/{vehicle_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/delete-vehicles.md): Remove a vehicle by disconnecting it from the ev.energy system.

## List vehicle trims

 - [GET /vehicle_trims](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_trims.md): List all the vehicle trims known by the ev.energy system.

Trim refers to a set of features that can be applied to a particular model of vehicle: https://en.wikipedia.org/wiki/Car_model#Trim_level.

Pass ?ordering=name (or -name) to sort results alphabetically by name. Without an ordering parameter, results are returned in their default creation order.

## Create a custom vehicle trim

 - [POST /vehicle_trims](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicle_trims.md): Creates a new trim for the specified model that can be used if
we are missing a trim. These trims will not be available in the
list trims api call

## Retrieve a vehicle trim

 - [GET /vehicle_trims/{vehicle_trim_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_trims-vehicle_trim_id.md): Retrieve details for a single, specific vehicle trim.

Trim refers to a set of features that can be applied to a particular model of vehicle: https://en.wikipedia.org/wiki/Car_model#Trim_level.

## List vehicle models

 - [GET /vehicle_models](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_models.md): List all the vehicle models known by the ev.energy system.

Use the available_for_user_id query parameter to narrow the list to only those supported for a specific user's program and tier.

Pass ?ordering=name (or -name) to sort results alphabetically by name. Without an ordering parameter, results are returned in their default creation order.

## Create vehicle model

 - [POST /vehicle_models](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicle_models.md): Create a new vehicle model in the ev.energy system.

Newly created models are hidden by default and must be reviewed before becoming visible.

## Retrieve a vehicle model

 - [GET /vehicle_models/{vehicle_model_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_models-vehicle_model_id.md): Retrieve details for a single, specific vehicle model.

## List vehicle makes

 - [GET /vehicle_makes](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_makes.md): List all the vehicle makes known by the ev.energy system.

Use the available_for_user_id query parameter to narrow the list to only those supported for a specific user's program and tier.

Pass ?ordering=name (or -name) to sort results alphabetically by name. Without an ordering parameter, results are returned in their default creation order.

## Retrieve a vehicle make

 - [GET /vehicle_makes/{vehicle_make_id}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_makes-vehicle_make_id.md): Retrieve details for a single, specific vehicle make.

## List status logs for a vehicle

 - [GET /vehicles/{vehicle_id}/status_logs](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-status_logs.md): List the historical status logs for a specific Vehicle. Used to find out the state of the Vehicle at each point it reported in to ev.energy.

## Retrieve a specific status log for a vehicle

 - [GET /vehicles/{vehicle_id}/status_logs/{sampled_at}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-status_logs-timestamp.md): A single status log for a particular vehicle is uniquely identified by the timestamp it was logged at.

## List API error logs for a vehicle

 - [GET /vehicles/{vehicle_id}/error_logs](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-error_logs.md): List the historical API error logs for a specific Vehicle. These logs capture errors that occurred when attempting to communicate with the vehicle's telematics API.

## Retrieve a specific API error log for a vehicle

 - [GET /vehicles/{vehicle_id}/error_logs/{logged_at}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-error_logs-timestamp.md): A single API error log for a particular vehicle is uniquely identified by the timestamp it was logged at.

## List location logs for a vehicle

 - [GET /vehicles/{vehicle_id}/location_logs](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-location_logs.md): List the historical location log timestamps for a specific Vehicle. Returns metadata about when location data was recorded, without exposing the actual location coordinates.

## Retrieve a specific location log for a vehicle

 - [GET /vehicles/{vehicle_id}/location_logs/{sampled_at}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-location_logs-timestamp.md): A single location log for a particular vehicle is uniquely identified by the timestamp it was sampled at. Returns metadata only, without exposing the actual location coordinates.

## List command logs for a vehicle

 - [GET /vehicles/{vehicle_id}/command_logs](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-command_logs.md): List the historical command logs for a specific Vehicle. These logs record commands that were sent to the vehicle.

## Retrieve a specific command log for a vehicle

 - [GET /vehicles/{vehicle_id}/command_logs/{logged_at}](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-command_logs-timestamp.md): A single command log for a particular vehicle is uniquely identified by the timestamp it was logged at.

## Get VPP modes for a vehicle

 - [GET /vehicles/{vehicle_id}/vpp_modes](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicles-vehicle_id-vpp_modes.md): Returns the VPP (Virtual Power Plant) control modes supported by this vehicle.

## Initiate vehicle onboarding

 - [GET /vehicle_onboarding](https://developers.ev.energy/ev.energy-api-v2/vehicles/get-vehicle_onboarding.md): Initiate the onboarding process for a new vehicle in your user's browser (or an embedded web view in an app).

If none of make_id, model_id or trim_id are passed as query parameters, the user will be shown a user interface to pick their vehicle make.

## Native clients (response_type=json)

Native mobile clients that need to launch a provider SDK (e.g. Smartcar Connect for BMW/MINI) instead of opening a WebView can pass response_type=json to receive a JSON payload instead of a 302 redirect. In that case at least one of make_id, model_id or trim_id is required (otherwise the endpoint responds with 400).

## Final redirect

After the user completes the web flow, the browser is redirected to the onboarding_redirect_url configured on your application. The redirect URL will carry one or more query parameters identifying the onboarded vehicles:

- vehicle_uid — the v2 UID of each onboarded vehicle (preferred). Use this to call GET /v2/vehicles/{vehicle_uid} for further details.
- vehicle_id — the legacy integer primary key of each onboarded vehicle. Prefer vehicle_uid.

When multiple vehicles are onboarded in a single flow, both query parameters appear once per vehicle in matching order. For example: https://your-redirect/?vehicle_id=1&vehicle_id=2&vehicle_uid=vhcl01...&vehicle_uid=vhcl02....

## Complete vehicle onboarding

 - [POST /vehicle_onboarding/complete](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicle_onboarding-complete.md): Exchanges a provider auth_code for a list of vehicles, completing an onboarding flow that was initiated via GET /v2/vehicle_onboarding/?response_type=json. Used primarily by native mobile clients integrating with the Smartcar Connect SDK (the SDK returns the auth_code directly to the app).

No OAuth bearer token is required, mirroring the init endpoint. The authorization_request_uid returned by the init call is what binds this request to the legitimate onboarding flow — it is treated as a single-use token.

## Send vehicle onboarding link

 - [POST /vehicle_onboarding/onboarding_link](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicle_onboarding-onboarding_link.md): Generates a vehicle onboarding deep link for the authenticated user and sends a Braze event containing the email, make name and onboarding URL.

Requires an OAuth token with vehicle:write scope.

## Create reconnection URL

 - [POST /vehicles/{vehicle_id}/reconnect](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicles-vehicle_id-reconnect.md): Create a reconnection request URL for the Vehicle.

## Disconnect a vehicle's integration

 - [POST /vehicles/{vehicle_id}/disconnect](https://developers.ev.energy/ev.energy-api-v2/vehicles/post-vehicles-vehicle_id-disconnect.md): Disconnect the vehicle's integration. Revokes provider OAuth tokens
and invalidates the underlying account, leaving the vehicle in an
INACTIVE state. Any open charging sessions on cars sharing the
account are closed. The vehicle's provider association is retained
so the user can re-link by POSTing to
/vehicles/{vehicle_id}/reconnect.

This action is idempotent — calling it on an unintegrated vehicle
is a no-op and still returns 200.

## Get VPP modes for a vehicle

 - [GET /vehicles/{vehicle_id}/vpp_modes](https://developers.ev.energy/ev.energy-api-v2/vpp/get-vehicles-vehicle_id-vpp_modes.md): Returns the VPP (Virtual Power Plant) control modes supported by this vehicle.

