Mazda EU API Shutdown Breaks Integration: App Update 9.0.3
It appears there's a significant issue affecting Mazda owners in Europe who rely on the mazda_cs integration for Home Assistant. Following the release of MyMazda app update 9.0.3, the old EU API (v1) has been shut down, rendering the integration non-functional. This article dives into the details of the problem, its impact, and potential solutions.
Understanding the Issue
Key problems arise from the shutdown of Mazda's EU API v1, which the mazda_cs integration uses. After updating the MyMazda app to version 9.0.3, users are encountering a complete breakdown in connectivity. The core issue lies in the API endpoint that retrieves the encryption key, a crucial step for login and authentication. Instead of the expected JSON response, the server now returns an HTTP 502 error with an HTML page, signaling a major disruption in service. This unexpected change has left many users unable to access their vehicle data through Home Assistant.
Symptoms of the Breakdown
When the integration attempts to log in, specifically during the encryption key retrieval process, it fails. The problematic URL, https://rz97suam.mazda.com/appapi/v1/system/encryptionKey?appId=MazdaApp&locale=de-DE&deviceId=<device_id>&sdkVersion=11.4.0000, now returns an HTML error page instead of the expected JSON data. This critical failure point prevents the integration from proceeding, effectively blocking access to all connected services. The error manifests as a ContentTypeError in Home Assistant logs, clearly indicating an issue with the content type received from the server.
Examining the Error Logs
The logs from Home Assistant provide a clear picture of the problem. The error message aiohttp.client_exceptions.ContentTypeError: 502, message='Attempt to decode JSON with unexpected mimetype: text/html' highlights the mismatch between the expected JSON format and the received HTML content. This error occurs because the API endpoint, which previously served JSON, is now returning an HTML page, typically a 502 Bad Gateway error. The logs also show that this issue persists across different SDK versions, indicating that the problem is not related to a specific app version but rather to a fundamental change in the API itself. Analyzing these logs is crucial for understanding the root cause and devising a solution.
Steps to Reproduce the Issue
Reproducing this issue is straightforward for any user of the mazda_cs integration in the EU region. First, ensure that the mazda_cs integration is installed in Home Assistant. Set the region to "MME" (Mazda Motor Europe). Then, restart Home Assistant. The integration will fail to set up, resulting in the errors described above. This consistent reproducibility across multiple users confirms that the problem is widespread and directly linked to the API shutdown. Following these steps can help users verify the issue and contribute to the troubleshooting process.
Root Cause Analysis
A thorough analysis reveals that the issue is isolated to the EU region (MME), with the US (MNAO) and Japan (MJO) regions remaining unaffected. This suggests a regional change in Mazda's API infrastructure. Evidence strongly indicates that Mazda has migrated from API v1 to API v2 for European users. This migration is supported by several observations: the release of MyMazda app version 9.0.3, the introduction of a new SDK version (11.4.0000), the discovery of new API endpoints through app traffic analysis, and the deprecation of the system/encryptionKey endpoint. The 502 Bad Gateway error is a common indicator of a disabled legacy API, further solidifying this conclusion.
The Shift to API v2
Mazda's move from API v1 to API v2 signifies a substantial change in their backend infrastructure. This migration likely involves new base paths, encryption flows, authentication/token logic, headers, signature methods, SDK versions, User-Agent strings, and payload formats. The current mazda_cs integration, which relies on the now-defunct API v1 endpoints like /appapi/v1/system/encryptionKey and /appapi/v1/user/login, is rendered completely useless for EU users. Understanding the scope of these changes is essential for planning the integration's update.
Impact and Required Updates
The current situation leaves the mazda_cs integration entirely non-functional for Mazda owners in the EU. To restore functionality, the integration must be updated to support the new API v2. This is a significant undertaking that requires a comprehensive understanding of the new API's workings. The necessary updates involve several key areas:
Key Areas for Integration Update
- New API Base Paths: The base URL for API requests has likely changed, requiring a modification in the integration's configuration.
- New Encryption Flow: The method for encrypting and decrypting data may have been altered, necessitating a new encryption implementation.
- New Authentication/Token Logic: The authentication process and token management are likely different in API v2, requiring a complete overhaul of the authentication module.
- New Headers & Signature Methods: The headers required for API requests and the methods for signing those requests may have changed, demanding updates to the request construction logic.
- New SDK Version: The integration needs to be compatible with the new SDK version used by the MyMazda app.
- New User-Agent & Payload Formats: The format of the User-Agent string and the structure of the data sent and received by the API may have been updated, requiring corresponding changes in the integration.
Suggested Actions and Community Involvement
Given the severity of the issue, several immediate actions are recommended to mitigate the impact and facilitate the integration's update. First and foremost, a warning should be added to the mazda_cs integration's documentation, clearly stating that MME (EU region) is temporarily unsupported due to the Mazda API v1 shutdown. This will prevent new users from attempting to set up the integration and manage expectations for existing users. Transparency and clear communication are crucial during this transition.
Call for Collaboration
The next step is to begin the migration to API v2. This is a collaborative effort that benefits from community involvement. Individuals with expertise in reverse engineering APIs, capturing mobile app traffic, and testing new endpoints are encouraged to contribute. Specifically, capturing mobile app API traffic using tools like MITM proxies can provide valuable insights into the new API's structure and behavior. Sharing sanitized HAR captures (HTTP Archive) and verifying login/auth flows can significantly accelerate the development process. Community involvement is key to a timely and effective resolution.
Environment Details and Further Assistance
The issue has been observed across various environments, including Home Assistant OS 16.3 (2025.11) with the latest version of custom_components/mazda_cs. The region affected is MME, and users are experiencing the issue with MyMazda App version 9.0.3 on iOS 18.2, which reports an SDK version of 11.4.0000. Documenting these details helps in tracking the issue and ensuring that the solution addresses the affected environments.
Offering Support
Maintaining an integration like mazda_cs is a challenging task, and the unexpected shutdown of the legacy API has created a significant hurdle. The community appreciates the efforts of the integration maintainers and is ready to support them in any way possible. Offering assistance with capturing packet captures, testing early implementations of API v2, and providing any other relevant information can greatly aid the migration process. Collective effort will ensure the integration's long-term viability.
Conclusion
The shutdown of Mazda's EU API v1 has undeniably broken the mazda_cs integration for European users. This abrupt change necessitates a migration to API v2, a task that requires significant effort and community collaboration. By understanding the root cause, identifying the required updates, and actively participating in the development process, the community can work together to restore functionality and ensure the integration's continued success. Remember to check out Home Assistant Community for more information and resources.