The script API is plain JSON over HTTPS with Bearer tokens. The OpenAPI document is at /api/openapi.json.
@require https://sync.wazetools.com/wme-sync-lib.js handles the PIN prompt, token storage and refresh for you.
// ==UserScript==
// @name My WME Script
// @match https://www.waze.com/*editor*
// @match https://beta.waze.com/*editor*
// @require https://sync.wazetools.com/wme-sync-lib.js
// @grant GM_xmlhttpRequest
// @grant GM_getValue
// @grant GM_setValue
// @connect sync.wazetools.com
// ==/UserScript==
window.SDK_INITIALIZED.then(async () => {
const sdk = getWmeSdk({ scriptId: 'my-wme-script', scriptName: 'My WME Script' })
await sdk.Events.once({ eventName: 'wme-ready' })
// Asks the editor for their PIN the first time, then remembers the tokens.
const sync = await WMESync.init({ scriptId: 'my-wme-script', sdk })
const settings = (await sync.get('settings')) ?? { highlight: true }
settings.lastOpened = Date.now()
await sync.set('settings', settings)
})