VolvoCars

Main entry point for Volvo Vehicle API operations.

Combines ConnectedVehicle, Energy, and Location APIs into a single client.

Thread Safety: This client is safe for concurrent coroutine execution. A single instance can handle multiple simultaneous requests.

Resource Management: Create one client and reuse it across your application. Call close when done to release underlying HTTP resources. Calling close multiple times is safe.

Authentication: Supports two modes:

  • OAuth2 with automatic refresh (recommended): Provide OAuthConfig with client credentials. The client automatically refreshes expired tokens via the Volvo ID token endpoint. Use OAuthConfig.onTokensRefreshed to persist rotated tokens.

  • Static token: Provide a Bearer token directly. When it expires, create a new client with a fresh token.

// OAuth2 with automatic refresh (recommended)
val client = VolvoCars(
VolvoCarsConfig(
apiKey = "your-vcc-api-key",
oauth = OAuthConfig(
accessToken = storedAccessToken,
refreshToken = storedRefreshToken,
clientId = "your-client-id",
clientSecret = "your-client-secret",
onTokensRefreshed = { access, refresh -> save(access, refresh) }
)
)
)

// Static token (testing / short-lived scripts)
val client = VolvoCars(apiKey = "your-key", token = "your-token")

See also

for detailed configuration options

for OAuth2 token refresh configuration

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract suspend fun getBrakeStatus(vin: String, requestOptions: RequestOptions?): BrakeStatusResponse
Link copied to clipboard
abstract suspend fun getCapabilities(vin: String, requestOptions: RequestOptions?): CapabilitiesResponse
Link copied to clipboard
abstract suspend fun getCommandAccessibility(vin: String, requestOptions: RequestOptions?): CommandAccessibilityResponse
Link copied to clipboard
abstract suspend fun getCommandList(vin: String, requestOptions: RequestOptions?): CommandListResponse
Link copied to clipboard
abstract suspend fun getDiagnostics(vin: String, requestOptions: RequestOptions?): DiagnosticsResponse
Link copied to clipboard
abstract suspend fun getDoorAndLockStatus(vin: String, requestOptions: RequestOptions?): DoorAndLockStatusResponse
Link copied to clipboard
abstract suspend fun getEnergyState(vin: String, requestOptions: RequestOptions?): EnergyStateResponse
Link copied to clipboard
abstract suspend fun getEngineDiagnostics(vin: String, requestOptions: RequestOptions?): EngineDiagnosticsResponse
Link copied to clipboard
abstract suspend fun getEngineStatus(vin: String, requestOptions: RequestOptions?): EngineStatusResponse
Link copied to clipboard
abstract suspend fun getFuelAmount(vin: String, requestOptions: RequestOptions?): FuelAmountResponse
Link copied to clipboard
abstract suspend fun getOdometer(vin: String, requestOptions: RequestOptions?): OdometerResponse
Link copied to clipboard
abstract suspend fun getStatistics(vin: String, requestOptions: RequestOptions?): StatisticsResponse
Link copied to clipboard
abstract suspend fun getTyreStatus(vin: String, requestOptions: RequestOptions?): TyreStatusResponse
Link copied to clipboard
abstract suspend fun getVehicleDetails(vin: String, requestOptions: RequestOptions?): VehicleDetailsResponse
Link copied to clipboard
abstract suspend fun getVehicleList(requestOptions: RequestOptions?): VehicleListResponse
Link copied to clipboard
abstract suspend fun getVehicleLocation(vin: String, requestOptions: RequestOptions?): LocationResponse
Link copied to clipboard
abstract suspend fun getWarnings(vin: String, requestOptions: RequestOptions?): WarningsResponse
Link copied to clipboard
abstract suspend fun getWindowStatus(vin: String, requestOptions: RequestOptions?): WindowStatusResponse
Link copied to clipboard
abstract suspend fun invokeClimatizationStart(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeClimatizationStop(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeEngineStart(vin: String, request: EngineStartRequest, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeEngineStop(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeFlash(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeHonk(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeHonkFlash(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeLock(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeLockReducedGuard(vin: String, requestOptions: RequestOptions?): CommandResponse
Link copied to clipboard
abstract suspend fun invokeUnlock(vin: String, requestOptions: RequestOptions?): UnlockCommandResponse