When This Event Fires
TheVEHICLE_STATE event fires when Smartcar detects a signal value change for any trigger signal configured in your webhook.
Trigger Configuration
You configure which signals should trigger this event through the Smartcar Dashboard when creating or editing a webhook. For example: Triggers:TractionBattery.StateOfCharge(code:tractionbattery-stateofcharge)Charge.IsCharging(code:charge-ischarging)Location.PreciseLocation(code:location-preciselocation)
TractionBattery.StateOfChargeCharge.IsChargingLocation.PreciseLocationCharge.VoltageOdometer.TraveledDistance
VEHICLE_STATE event is delivered containing all five subscribed signals.
Identifying Which Triggers Fired
The webhook payload includes atriggers field that specifies which trigger signal(s) changed to prompt this delivery. This helps you identify what caused the event without comparing all signal values.
Trigger Types
Signal Change Triggers
Signal Change Triggers
When a monitored trigger signal changes value, the If multiple triggers change simultaneously, all will be included in the array.
triggers array contains the signal(s) that changed.First Delivery Trigger
First Delivery Trigger
When a webhook subscription is first created, a This initial delivery:
FIRST_DELIVERY trigger is sent to provide the initial state of the vehicle.- Occurs after vehicle subscription to a webhook
- Contains all subscribed signals at their current values
- Does not indicate any signal value changes
- Helps establish baseline state for your application
- When a vehicle is unsubscribed and then resubscribed to your webhook
- If your endpoint fails to respond with a 2xx status code, Smartcar will retry delivery with the same
FIRST_DELIVERYtrigger
Payload Structure
Unique identifier for this event. Use this for idempotency to prevent duplicate processing.
Always
"VEHICLE_STATE" for this event type.Smartcar vehicle ID for the vehicle this event relates to.
Container for event data.
Webhook delivery metadata. See Event Reference Overview for complete
meta object schema.Example Payloads
- Signal Change Trigger
- First Delivery
Delivered when a configured trigger signal changes value.
Signal Reference
Thesignals array contains data structured according to the Signals Schema Reference. Each signal type has a specific shape:
Charge Signals
Battery charging status and metrics
Battery Signals
State of charge and battery health
Location Signals
GPS coordinates and location data
Odometer
Distance traveled
Fuel Tank
Fuel level for ICE vehicles
All Signals
Complete signal catalog
Signal-Level Errors
Individual signals within aVEHICLE_STATE payload can contain errors if the vehicle doesn’t support that signal or if retrieval fails. When this occurs, the signal will have a status object with error details instead of a body with data:
Signal with Error
Partial data delivery: When some signals succeed and others fail, you’ll receive a
VEHICLE_STATE event with successful signals containing body data and failed signals containing status errors. This allows you to process available data even when some signals are unavailable.Processing VEHICLE_STATE Events
Basic Handler
Best Practices
Use eventId for deduplication
Use eventId for deduplication
Always check if you’ve already processed an
eventId before updating your database. Retries will have the same eventId but different deliveryId.Check timestamp freshness
Check timestamp freshness
Use
signals[].meta.oemUpdatedAt to determine if incoming data is newer than your stored state. Events can arrive out of order.Handle partial failures gracefully
Handle partial failures gracefully
Some signals may succeed while others fail. Process available data and log errors for unavailable signals.
Differentiate FIRST_DELIVERY from changes
Differentiate FIRST_DELIVERY from changes
Use the
triggers field to identify initial state deliveries vs. actual signal changes.
