Skip to main content

API and Apps

The torq web interface and any external scripts or integrations use the same JSON REST API under /api/v1.

ResourceLink
OpenAPI 3.1 contractopenapi.yaml — attached to every release
API guidedocs/api.md — authentication, error codes, units, and compatibility rules

Signing in & managing devices​

  • Browsers authenticate using the torq_session cookie.
  • Scripts and apps sign in with "token": true and send Authorization: Bearer <token>. Like browser sessions, tokens expire after 30 days of inactivity.
  • GET /api/v1/instance returns pre-login instance metadata, including api_version for 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.

Never add CORS headers

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.

LevelReleaseAdditions
4v1.5.0Displacement and power units per vehicle
5v1.6.0Project tags
6v1.7.0Hour meters, hours on entries and reminders, cost per hour
7v1.8.0Instance name, logo, and contact details (branding)
8v1.8.0Vehicle types, motorcycle catalog filter, motorcycle spec fields, type-specific service categories
9v1.10.0Public vehicle links (/vehicles/{id}/share, /shared/{token})
10v1.11.0Roles and permissions (/roles, vehicle access, permissions, x-torq-permission)
11v1.12.0Two-factor sign-in and passkeys (/me/mfa, mfa_*, require_mfa)
12v1.13.0Field-level *.view visibility permissions (x-torq-see)
13v1.14.0User-initiated vehicle sharing (vehicle_access.share, /vehicles/{id}/shared-with)
14v1.15.0Legal links on instance info and settings
15v1.16.0Accessories endpoints and accessories.* permissions
16v1.17.0Email notifications (/me/email, /settings/email)
17v1.18.0Password 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.