Files
opu/docs/analysis/API.md
T
yann64andClaude Opus 5.5 e5af8ea27d
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
docs: fix JSON escaping example
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 23:50:40 +01:00

8.2 KiB

Majestic API (PSA / Stellantis) as used by "Peugeot Update" 1.6.1

Sources: the TypeScript sources shipped in resources/app.asar (src/environments, src/app/services/{vehicle,update}.service.ts, electron/{rangeDownload,downloadManagement}.ts) and the log file %APPDATA%\Peugeot Update\log.log.

There is no user authentication: no OAuth, no cookie, no token. Only a fixed application client_id is passed in the query string.

Constant Value (Peugeot build)
apiAvailableUpdates https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate
apiDevices https://api.groupe-psa.com/applications/majesticf/v1/devices/
clientId ?client_id=20a4cf7c-f5fb-41d5-9175-a6e23b9880e5
regExpVin ^V[FR]{1}3[A-Z0-9]{14}$

The group's other brands (Citroën, DS, Opel…) probably use the same backend with a different client_id, so OpenPU makes these values configurable.

1. Head units of a vehicle: GET devices/{VIN}

GET https://api.groupe-psa.com/applications/majesticf/v1/devices/{VIN}?client_id=…

200 response:

{ "vin": "VR3XXXXXXXXXXXXXX", "requestDate": "…", "devices": [ { "ecuType": "RCC_EU_…" } ] }
  • 404 means the VIN is unknown (treated as "no such vehicle", not as a network error).
  • Any other HTTP error is a server error; status 0 is a network error.

ecuType classification

prefix = ecuType.split('_')[0], compared case-insensitively:

Prefix Type Guide link (wave)
RCC rcc path_guide_rcc
AIO aio path_guide_aio
NAC nac last segment WAVE1..4 → path_guide_wave_1..4, otherwise path_guide_wave_default
CRONY… (first 5 characters) crony_nav / crony_nonav CRONY2_EU_VAR{1..4}_WAVE1 → path_guide_crony_{1..4}

Only devices with a known prefix are kept. A guide link requires exactly one valid device. With at least one valid device but no link, the vehicle "exists" with an empty type.

2. Available updates: POST getAvailableUpdate

POST https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate?client_id=…
Content-Type: application/json

{ "vin": "VF3…", "softwareTypes": [ { "softwareType": "rcc-firmware" }, { "softwareType": "map-eur" } ] }

Software types

Constant softwareType
SOFT_FW_OVIP (NAC) ovip-int-firmware-version
SOFT_FW_RCC rcc-firmware
SOFT_FW_AIO aio-firmware
SOFT_CRONY_NAV crony2-software-nav
SOFT_CRONY_NONAV crony2-software-nonav
SOFT_CARTO map-eur
SOFT_CARTO_CRONY crony2-map-western_europe

Adding a vehicle (checkVehicle): all 7 types are requested, in parallel with devices/{VIN}. For Crony, the type is crony_nonav when the answer has a crony2-software-nonav entry with an update[0].updateId, crony_nav otherwise.

Looking for updates (getUpdates): 2 types depending on the vehicle type.

Vehicle type Firmware Map
nac ovip-int-firmware-version map-eur
rcc rcc-firmware map-eur
aio (and default) aio-firmware map-eur
crony_nav crony2-software-nav crony2-map-western_europe
crony_nonav crony2-software-nonav — (null sent)

Response

{
  "requestResult": "OK",
  "installerURL": "…",
  "vin": "…",
  "software": [
    {
      "softwareType": "rcc-firmware",
      "updateRequestResult": "OK",
      "currentSoftwareVersion": "…",
      "update": [
        {
          "updateId": "005…",            // 18 digits, as a string
          "updateSize": "8390000000",    // string, bytes
          "updateVersion": "…",
          "updateDate": "…",
          "updateURL": "https://majestic-web.mpsa.com/mjf00-web/rest/UpdateDownload?updateId=…&uin=…&type=fw",
          "licenseURL": "https://majestic-web.mpsa.com/mjf00-web/rest/LicenseDownload?mediaVersion=…&uin=…"
        }
      ]
    }
  ]
}

An update is used only if requestResult == "OK", updateRequestResult == "OK", update is not empty and updateURL is a valid URL.

Note: the original application sorts update[] with a.updateDate - b.updateDate on strings, which yields NaN: the sort has no effect and update[0] is used. OpenPU also uses update[0], unless several entries have comparable ISO dates, in which case it takes the most recent one.

uin is the head unit identifier (20 hexadecimal characters). It is embedded in the returned URLs; the client never needs to know it.

3. Downloads (majestic-web.mpsa.com)

URL Role
…/mjf00-web/rest/UpdateDownload?updateId=&uin=&type=fw redirects (3xx) to the CDN https://ds4emloty3shq.cloudfront.net/<SUPPLIER>/<HU_REGION>/<softwareType>/<file>.tar
…/mjf00-web/rest/LicenseDownload?mediaVersion=&uin= license file, named by Content-Disposition: …filename=<name> (license_<UIN>.key or licenses_<updateId>_<yyyyMMddHHmmss>.tar)

File names

  • Firmware/map: last path segment of the final URL (after redirects), without the query.
  • License: HEAD, then Content-Disposition split on filename=; otherwise the last URL segment.
  • Names are resolved sequentially. Comment in the original code: two simultaneous requests to Majestic sometimes both fail.

Resumable download (rangeDownload.ts)

  1. HEAD updateURL (Connection: keep-alive), 5 s timeout, redirects followed. The answer must be a 200 with a non-zero content-length, which gives the total size.
  2. If <folder>/<file> already exists, its size gives have. If have >= total, the file is complete.
  3. GET finalUrl with Range: bytes=<have>-<total-1>. A 206 with content-length == total-have is expected; data is appended to the file.
    • A 200 (no Range support) or a wrong length deletes the partial file, switches to non-Range mode and retries.
  4. Watchdog: 10 s without data drops the connection, then retries.
  5. At most 5 retries (session cache cleared in between). A disk error is fatal immediately.
  6. Pause and resume: the request is stopped, then step 1 starts again (the partial file is kept).

The license is downloaded without resume (electron-dl). An existing file is not downloaded again.

Proxy

<install>/proxy.json: {http_proxy, https_proxy, no_proxy}. OpenPU uses the standard environment variables (natively supported by libcurl).

4. Observations on the real API (capture of 2026-11-28)

  • Gateway (X-Global-Transaction-ID, IBM DataPower-like): responses have no Content-Length, and the gateway closes the TLS connection without close_notify. OpenSSL 3 then reports unexpected eof while reading (curl error 56) although the body is complete. Chromium tolerates it; so does OpenPU, but only for bodies delimited by the connection close.
  • The JSON escapes = and & as \u003d / \u0026 in URLs: always decode before parsing.
  • Real ecuType values: NAC_EUR_WAVE2, NAC_EUR_WAVE4, RCC (see the test fixtures).
  • updateDate uses the yyyy-MM-dd HH:mm:ss.S format. updateSize is a string.
  • NAC maps: updateURL points directly to the TomTom CDN (https://download-cde.tomtom.com/OEM/PSA/MAP/PSA_map-eur_<ver>-NAC_EUR_WAVE2.tar), and licenseURL is empty.
  • installerURL is present at the root (an UpdateDownload URL on majestic.mpsa.com). Its role is unknown and the original application does not use it.
  • An unknown VIN returns 404 with an HTML body.
  • The license is generated asynchronously: the first LicenseDownload of an update returned a 200 with Content-Disposition: filename=licenses_<updateId>_<yyyyMMddHHmmss>.tar and an empty body. A later call returns the real license_<UIN>.key (about 10 KB). The official application keeps the empty file, hence the ENOENT errors and "restart the app" in its log. OpenPU deletes the empty answer and retries with an increasing delay.
  • RCC firmware CDN (CloudFront): HEAD → 200 + Content-Length, and Range → 206. Resuming was verified (interrupted at 1.59 GB then resumed, about 80 MB/s).
  • No special header is required: any User-Agent works, and HTTP/1.1 is enough (no h2 negotiation).

5. Updating the application itself

electron-updater, generic provider https://d1tik0o5ahgjm.cloudfront.net/peugeot/latest.yml. Out of scope for OpenPU.