API and Apps
The torq web interface and any external scripts or integrations use the same JSON REST API under /api/v1.
| Resource | Link |
|---|---|
| OpenAPI 3.1 contract | openapi.yaml — attached to every release |
| API guide | docs/api.md — authentication, error codes, units, and compatibility rules |
Signing in & managing devices
- Browsers authenticate using the
torq_sessioncookie. - Scripts and apps sign in with
"token": trueand sendAuthorization: Bearer <token>. Like browser sessions, tokens expire after30 daysof inactivity. GET /api/v1/instancereturns pre-login instance metadata, includingapi_versionfor capability detection.
Every user can view all active browser and API sessions under Settings → Devices (showing device name, last activity, and IP address) and sign out a single device or all other devices at once.
Do not add Access-Control-Allow-Origin or other CORS headers in torq or in your reverse proxy. Bearer token requests intentionally skip CSRF header checks because browsers cannot send custom Authorization headers cross-site without CORS; enabling CORS would bypass that protection.
Compatibility & API levels
Within /api/v1, changes are strictly additive: existing fields, routes, and error codes are never renamed or removed, and no existing request field becomes required. api_version increments whenever a release adds new endpoints or capabilities.
| Level | Release | Additions |
|---|---|---|
4 | v1.5.0 | Displacement and power units per vehicle |
5 | v1.6.0 | Project tags |
6 | v1.7.0 | Hour meters, hours on entries and reminders, cost per hour |
7 | v1.8.0 | Instance name, logo, and contact details (branding) |
8 | v1.8.0 | Vehicle types, motorcycle catalog filter, motorcycle spec fields, type-specific service categories |
9 | v1.10.0 | Public vehicle links (/vehicles/{id}/share, /shared/{token}) |
10 | v1.11.0 | Roles and permissions (/roles, vehicle access, permissions, x-torq-permission) |
11 | v1.12.0 | Two-factor sign-in and passkeys (/me/mfa, mfa_*, require_mfa) |
12 | v1.13.0 | Field-level *.view visibility permissions (x-torq-see) |
13 | v1.14.0 | User-initiated vehicle sharing (vehicle_access.share, /vehicles/{id}/shared-with) |
14 | v1.15.0 | Legal links on instance info and settings |
15 | v1.16.0 | Accessories endpoints and accessories.* permissions |
16 | v1.17.0 | Email notifications (/me/email, /settings/email) |
17 | v1.18.0 | Password reset and email confirmation endpoints |
Units in the API
The API always accepts and returns metric values (*_km, *_ml, Nm, bar, cm³, power_w). Display vehicle distances in the vehicle's odometer_unit, and all other quantities in the signed-in user's preferences from GET /auth/me. See Units and formats.