A modern .NET 10 client library for interacting with Toyota's MyToyota Connected Services API. This project provides a fluent, async-first interface to access comprehensive vehicle data including location, status, climate control, remote commands, and more.
- Features
- Installation
- Quick Start
- Dependency Injection
- Documentation
- Contributing
- License
- Disclaimer
- Async-First: All operations are fully asynchronous with cancellation token support
- Fluent Configuration: Easy, chainable builder pattern for client setup
- Dependency Injection: First-class
IServiceCollectionintegration viaAddToyotaClient() - Type-Safe: Strong typing for all API contracts and responses
- Comprehensive API: Access to vehicles, location, climate control, remote commands, trip history, and more
- Token Caching: Automatic token caching to minimize login overhead
- Error Handling: Precise exceptions for different failure scenarios
- Performance: Built with .NET 10 and C# 14 for optimal performance
Install the NuGet package:
dotnet add package Posseth.Toyota.ClientOr via Package Manager:
Install-Package Posseth.Toyota.Client
using Posseth.Toyota.Client;
// Create and configure the client
var client = new MyToyotaClient()
.UseCredentials("your-username", "your-password")
.UseTimeout(30)
.UseTokenCaching(true);
// Authenticate
var loginSuccess = await client.LoginAsync();
if (!loginSuccess)
throw new InvalidOperationException("Login failed");
// Get your vehicles
var vehicles = await client.GetVehiclesAsync();
foreach (var vehicle in vehicles?.Data ?? [])
{
Console.WriteLine($"VIN: {vehicle.Vin}, Name: {vehicle.Nickname}");
}
// Get vehicle status
var location = await client.GetLocationAsync("JTHJP5C27D5012345");
Console.WriteLine($"Location: {location?.Data?.Latitude}, {location?.Data?.Longitude}");
// Control your vehicle
var result = await client.StartClimateControlAsync("JTHJP5C27D5012345");
if (result?.IsSuccess == true)
Console.WriteLine("Climate control started");Posseth.Toyota.Client ships with built-in support for the .NET Options pattern and Microsoft.Extensions.DependencyInjection.
// Program.cs
using Posseth.Toyota.Client.Extensions;
builder.Services.AddToyotaClient(options =>
{
options.Username = builder.Configuration["Toyota:Username"]!;
options.Password = builder.Configuration["Toyota:Password"]!;
options.TimeoutSeconds = 30;
options.Logger = msg => Console.WriteLine(msg); // optional
});Add a section to your appsettings.json:
{
"ToyotaClient": {
"Username": "your@email.com",
"Password": "your-password",
"TimeoutSeconds": 30,
"UseTokenCaching": true
}
}Then register:
// Program.cs
using Posseth.Toyota.Client;
using Posseth.Toyota.Client.Extensions;
builder.Services.AddToyotaClient(
builder.Configuration.GetSection(ToyotaClientOptions.SectionName));Once registered, inject IMyToyotaClient anywhere in your application:
public class VehicleService(IMyToyotaClient client)
{
public async Task<string?> GetFirstVinAsync(CancellationToken ct = default)
{
await client.LoginAsync(ct);
var vehicles = await client.GetVehiclesAsync(ct);
return vehicles?.Data?.FirstOrDefault()?.Vin;
}
}Security tip: Never store credentials in
appsettings.jsonfor production.
Use Secret Manager in development
and Azure Key Vault or environment variables in production.
For a full walkthrough see docs/GETTING_STARTED.md.
- Getting Started - Installation, configuration, DI setup, and common tasks
- API Reference - Complete API documentation with examples
- Architecture - Design overview and component details
Posseth.Toyota.Client/
βββ src/
β βββ Posseth.Toyota.Client/ # Main client library
β βββ Extensions/ # DI extension methods
β βββ Interfaces/ # Public API contracts
β βββ Models/ # API response/request models
β βββ Services/ # Core business logic
β βββ Exceptions/ # Custom exception types
β βββ ToyotaClientOptions.cs # DI / Options-pattern configuration
βββ samples/
β βββ Posseth.Toyota.Demo.ConsoleApp/ # Example usage
βββ tests/
β βββ Posseth.Toyota.Client.Tests/ # Unit and integration tests
βββ assets/
β βββ logo.svg # Project logo
βββ docs/ # Documentation
- .NET 10+ or later
- C# 14 (or later)
- Toyota Connected Services Account
To run the test suite:
# Unit tests
dotnet test
# With coverage (requires dotnet-coverage)
dotnet-coverage collect -f cobertura -o coverage.cobertura.xml dotnet testIntegration tests require valid Toyota credentials:
export TOYOTA_USERNAME=your-username
export TOYOTA_PASSWORD=your-password
dotnet test- Get all associated vehicles
- Get vehicle association details
- Battery level and charging status
- Real-time EV status data
- Get climate settings and status
- Start/stop climate control
- Refresh climate status
- Lock/unlock vehicle
- Start/stop engine
- Control lights
- Open trunk
- Hazard lights
- Current location
- Lock status (doors, trunk, windows)
- Health diagnostics
- Telemetry data
- Service history
- Driving statistics and eco-scores
- Trip history with optional route data
- Trip summaries
- Trip statistics
- Recent vehicle notifications
- Never hardcode credentials - Use environment variables or configuration files
- Token caching is enabled by default but can be disabled if needed
- Secure storage - Consider using Azure Key Vault or similar for sensitive data in production
- See SECURITY.md for more details
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright Β© 2026 Michel Posseth (MPCoreDeveloper)
This project is based on Abraham.MyToyotaClient, which is licensed under the Apache License 2.0. We acknowledge and thank the original author for their work.
This is an unofficial client library and is not affiliated with, endorsed by, or associated with Toyota Motor Corporation or any of its subsidiaries.
Use at your own risk. The authors assume no responsibility for any misuse, damage, or issues arising from the use of this library. Ensure you comply with Toyota's Terms of Service and respect their API usage policies.
- π Report Issues
- π‘ Request Features
- π View Documentation
- π§ Check Discussions