> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wede.pt/llms.txt
> Use this file to discover all available pages before exploring further.

# Changelog

> API and SDK version history

## v1.2.0 - 9 June 2026

### New - Offline-First Device Sync (Passo 6)

* `POST /v1/devices/register` — register a device for offline-first operation with permanent device ID
* `POST /v1/devices/sync` — sync offline dispatch queue; idempotent at `(device_id, sequence_number)` level
* `GET /v1/devices/:id/queue` — get pending (unsynced) queue for a device
* Offline queue: immutable until server confirms, monotonic sequence numbers, survives app restarts

### New - Dispatch Settings

* `PATCH /v1/tenant/dispatch-settings` — configure auto-dispatch, threshold, and reinforcement timeout
  * `dispatch_mode` — enable/disable auto-dispatch
  * `dispatch_threshold` — minimum score for auto-dispatch (0–1)
  * `reinforcement_timeout_min` — minutes before backup auto-dispatch if team doesn't ACK (0 = disabled)

### Updated - Missions

* Mission status lifecycle corrected: `CREATED → SENT → ACK → ON_ROUTE → ON_SITE → COMPLETED | FAILED`
* `COMPLETED` and `FAILED` now automatically close the originating event and return team to `available`
* `missions:receive` permission allows field operators to update status (previously only `missions:manage`)
* Backup dispatch: send a second team to an active mission using `POST /v1/teams/dispatch` with the same `event_id`

### Updated - Dispatch

* `event_lat` and `event_lng` now optional (undefined when GPS not available, previously NaN)
* `requires_manual: true` returned when no team meets auto-dispatch threshold
* Auto-reinforcement: scheduler job checks every minute for missions without ACK beyond timeout

### SDKs - v1.2

All five SDKs updated (JS, React Native, Android/Kotlin, Swift, Python):

* `requestBackup(missionId, eventId, eventLat?, eventLng?)` — request backup team for active mission
* `updateDispatchSettings(dispatchMode?, dispatchThreshold?, reinforcementTimeoutMin?)` — configure dispatch settings
* Offline components: `ScoreEngine`, `WedeCache`, `WedeOfflineDispatch`, `WedeDeviceId` — full offline-first capability
* New SDK: `Wedeadmin/wede-sdk-android` (Kotlin) — paridade com JS/RN/Swift/Python

***

## v1.1.0 - 27 May 2026

### New - Teams and Dispatch

* `GET /v1/teams` - list teams with members and GPS coordinates
* `GET /v1/teams/:id` - get team detail
* `PATCH /v1/teams/:id/members/:memberId/location` - update member GPS location
* `POST /v1/teams/dispatch/score` - proximity score engine - ranks teams by distance, equipment, availability and vertical capability
* `POST /v1/teams/dispatch` - dispatch a team to an event - stores `event_lat`/`event_lng` for route mapping

### New - Missions

* `GET /v1/missions` - list missions with filters by team, status and limit
* `GET /v1/missions/:id` - get mission detail
* `PATCH /v1/missions/:id/status` - update mission lifecycle status with optional feedback payload

### New - Billing

* `GET /v1/tenant/billing` - current plan, annual usage counters, channel costs and available plans by country

### New - API Key Management

* `GET /v1/tenant/api-keys` - list active API keys (prefix only)
* `POST /v1/tenant/api-keys/rotate` - rotate API key with configurable grace period - previous key remains valid during transition

### Security

* Brute force protection - account locked for 15 minutes after 5 consecutive failed login attempts - self-unlock via password reset
* JWT token versioning - tokens immediately invalidated when user is suspended or reactivated
* `/metrics` endpoint protected - requires `x-wede-internal` header with secret stored in GCP Secret Manager
* CORS restricted to production origins only

### SDKs - v1.1

All four SDKs updated with Teams, Dispatch, Missions and Billing methods:

* `@wede/sdk` (TypeScript/JavaScript)
* `wede-sdk` (Python)
* `@wede/react-native-sdk` (React Native)
* `WedeSDK` (Swift)

***

## v1.0.0 - May 2026

### Core Platform

* `POST /v1/events` - submit events with automatic channel selection
* `GET /v1/events` - list events by zone and vertical
* `POST /v1/sync/batch` - sync offline event batches
* `GET /v1/sync/status` - check sync batch status
* `GET /v1/connectivity/status` - zone connectivity state
* `POST /v1/connectivity/report` - report connectivity from field device
* `GET /v1/zones` - list zones with geofence boundaries
* `GET /v1/parsers` - list event parsers by vertical
* `GET /v1/tenant/me` - tenant info and feature flags
* `GET /v1/tenant/usage` - usage stats by period
* `POST /v1/webhooks` - create webhook
* `GET /v1/webhooks` - list webhooks
* `DELETE /v1/webhooks/:id` - delete webhook

### Auth

* `POST /v1/auth/login` - email and password login - returns JWT
* `POST /v1/auth/forgot-password` - request password reset
* `POST /v1/auth/reset-password` - reset password with token
* `POST /v1/auth/change-password` - change password (authenticated)
* `POST /v1/auth/verify` - verify account activation token

### Infrastructure

* PostgreSQL 16 on GCP Cloud SQL europe-west1
* GCP Cloud Run with graceful shutdown
* GitHub Actions CI/CD
* Cloudflare DNS and CDN
* All secrets in GCP Secret Manager
* Helmet, CORS, rate limiting per tenant

### SDKs - v1.0

* `@wede/sdk` (TypeScript/JavaScript)
* `wede-sdk` (Python)
* `@wede/react-native-sdk` (React Native) - with offline queue via AsyncStorage
* `WedeSDK` (Swift) - iOS 15+ / macOS 12+
