Prerequisites: Creating Your Application

Before implementing the Smartcar API for real-time vehicle diagnostics, ensure you have:

  • Created a Smartcar account and registered your application to obtain your client_id and client_secret.
  • Set up the Smartcar Connect flow to authenticate and authorize users.

For more details, refer to the Getting Started Guide.

Smartcar API Endpoints for Vehicle Diagnostics

Use the following Smartcar API endpoints (and optionally, webhooks) to pinpoint issues, check vehicle health, and keep track of maintenance schedules based on odometer data.

1. Retrieve Diagnostic Trouble Codes (DTCs)

Once a vehicle is authorized via Smartcar’s Connect flow, you can use the vehicle’s access token to retrieve DTCs from the following endpoint:

DTCs
curl "https://api.smartcar.com/v2.0/vehicles/{vehicleId}/diagnostics/dtcs" \
   -H "Authorization: Bearer {token}" \
   -X "GET"
Example Response
{
    "activeCodes": [
        {
            "code": "P302D",
            "timestamp": "2024-09-05T14:48:00.000Z"
        },
        {
            "code": "xxxxx",
            "timestamp": null
        },

        ... 
    ]
}
  • DTCs: Provide specific error codes and descriptions of active faults for faster troubleshooting.
  • Service Scheduling: Automate scheduling or send push notifications to alert customers of potential issues.

2. Monitor Vehicle Health

Stay informed of the overall vehicle condition by using the system status endpoint to retrieve real-time data about critical components like the engine and battery.

System Status
curl "https://api.smartcar.com/v2.0/vehicles/{vehicleId}/system_status" \
    -H "Authorization: Bearer {token}" \
    -X "GET"
Example Response
{
      "systems": [
          {
              // System ID from Smartcar unified system definition list
              "systemId": "SYSTEM_TPMS",
              "status": "ALERT",
              "description": "Left rear tire sensor battery low"
          },
          {
              "systemId": "SYSTEM_AIRBAG",
              "status": "OK",
              "description": null
          },
          {
              "systemId": "SYSTEM_MIL",
              "status": "OK",
              "description": null
          },
          ...
      ]
}
  • Engine Status: Detect early signs of malfunction (e.g., overheating, low oil pressure).
  • Battery Health: Monitor battery voltage, proactively suggesting replacements or checks.

3. Track Odometer Readings

Use the odometer endpoint to maintain timely service intervals (oil changes, inspections, etc.) based on the actual mileage driven.

Odometer
curl "https://api.smartcar.com/v2.0/vehicles/{vehicleId}/odometer" \
    -H "Authorization: Bearer {token}" \
    -X "GET"
Example Response
{
    "distance": 104.32
}
  • Maintenance Scheduling: Automatically notify drivers or fleet managers when mileage thresholds are reached.
  • Fleet Management: Consolidate odometer data across multiple vehicles to streamline service for an entire fleet.

Webhooks (Optional)

To receive real-time notifications (e.g., when new DTCs appear), consider setting up webhooks:

  1. Create a Webhook: Configure a secure endpoint on your server to handle POST requests from Smartcar.
  2. Register the Webhook: Specify which events (such as DTC) you want to subscribe to.
  3. Instant Alerts: When an event triggers, Smartcar sends a payload to your endpoint, enabling immediate responses (like sending notifications or scheduling service).

See the Smartcar Webhooks Documentation for more information.

Putting It All Together

  1. Retrieve DTCs: Quickly detect and diagnose specific issues.
  2. Monitor Vehicle Health: Stay current on engine, battery, and other key systems.
  3. Track Odometer: Automate maintenance scheduling based on real-time mileage.
  4. Use Webhooks (Optional): Get instant notifications to further reduce downtime. By combining these capabilities, you can deliver proactive and data-driven services—leading to fewer unexpected breakdowns, optimized service operations, and higher customer satisfaction.

FAQs

Was this page helpful?