Skip to content

API contract ​

The backend exposes a single REST API, versioned in the path (/api/v2), consumed by the frontend. This page describes the rules shared by all endpoints and the API's organization by domain. It deliberately lists neither the exact paths nor the parameters: they change quickly, and the only up-to-date source of truth is the OpenAPI document generated by the backend.

Where to find endpoint details

When documentation is enabled (REGISTRY_DOCUMENTATION_ENABLED=true, in development), the backend serves the OpenAPI 3 document and Swagger UI on its management port (see Getting started). Swagger UI lets you authenticate (authorization code + PKCE) and try each endpoint. Each operation states its required permission there.

Principles ​

Resources nested under their owner ​

  • Global resources (users, preferences, metadata, purges) sit directly under /api/v2.
  • Everything that belongs to a project is under /api/v2/projects/{projectId}/…. The project identifier in the path is what makes it possible to check the permission on that project (Security → Authorization).
  • Names are plural, lowercase and kebab-case; JSON bodies are camelCase.

Consistent verbs ​

VerbUsage
GETRead (a record, a list page, a capped search, statistics)
POSTCreate, and trigger a state transition (hide/show, block/unblock, accept an invitation, add to favorites…)
PATCHChange some fields
DELETEPermanently delete

Each state transition is a separate endpoint, with its own access rule: (soft) delete, restore and permanently delete map to three distinct permissions (ADR 017).

Predictable responses ​

  • A creation answers 201 with the address of the created resource; a deletion answers 204.
  • Responses contain dedicated DTOs (never the database entities); an item does not embed its whole project.
  • Errors follow the standard problem details format (RFC 9457) with a stable code (for example "movement date in the future") and a message translated according to the Accept-Language header (French or English). The frontend shows that message, enriched with its own text (ADR 015).

A single list grammar ​

All lists share the same parameters, which lets the frontend implement progressive loading, search, filters and sorting only once:

  • pagination by page and page size (capped size); the response states whether there is a next page;
  • text search tolerant of typos and accents (PostgreSQL trigrams, ADR 006);
  • sorting on a closed list of fields, - prefix for descending order;
  • visibility (visible items, deleted items, or both), taken into account only for those holding the restore permission;
  • typed filters specific to each list (status, "active at this instant" date, date range, favorite…). An inverted range is refused.

Selection searches (autocomplete fields: participants to add, vehicles, reasons…) are not paginated: they return a small, capped number of results.

Bounded inputs ​

Every string, list and parameter has a maximum size; an oversized request body is refused (413). Sign-in redirect URLs are restricted to an allowlist. See Security → Data integrity.

Optimistic concurrency ​

Reads and writes of an item return an ETag derived from its last change. Sending it back in If-Match on an edit makes the write fail (412) if someone else changed it in the meantime; a lock conflict answers 409, an update that takes too long 408 (ADR 016).

Status codes to know ​

CodeMeaning in Registry
400Invalid request (validation, parameter too long, inverted range…)
401Not authenticated or invalid token — the frontend tries a refresh then sends to sign-in
403Insufficient permission, project option disabled or failed CSRF check
404Item not found (or invisible to the caller)
408 / 409 / 412Concurrency: timeout, lock unavailable or business conflict, item changed since it was read
413Request body too large
422Business rule violated (incompatible reason, definitive departure before other movements…)
423Account blocked
424The identity provider is not responding correctly
429Rate limit exceeded

The API by domain ​

DomainWhat it coversAccess
AuthenticationSign-in and sign-out URLs, token exchange and refresh, current user with their authorities and preferencesPublic for the token exchange; the rest authenticated
MetadataTranslated labels of the enumerations (statuses, types, project options…) and features enabled by configurationPublic, no sensitive data
UsersDirectory, application role, blocking, deletion, GDPR export; deletion and export of one's own accountPlatform administrator; oneself
PreferencesTheme, language, refresh frequencyOneself
My profilesMy memberships and invitations, accept/decline, join as supportOneself; support: platform administrator
ProjectsList with summary (profile, counters, alerts), CRUD, soft delete/restore, favoritesDepending on the profile; global read for the platform administrator
Members (project profiles)Bulk invitation, change of role and access window, blocking, removal, user search by exact emailProject administrator; read: coordinator
ParticipantsCRUD, birthdays, movement history and presence timeline, GDPR export, selection searchesProject roles (history: administrator and coordinator)
GroupsCRUD, members (list, add, remove)Project roles
MovementsCheck-ins/check-outs of registered participants and guests, contents, live headcounts, planned arrivals and departures, selection searchesProject roles
Vehicles (option)CRUD, history, timeline and usage rateAdministrator and coordinator
Activities (option)CRUD, history and statisticsAdministrator and coordinator
Communications (option)Messages, threads of a movement or an alertProject roles
Alerts (option)List, creation, status change, soft delete/restore, permanent deletion, thread, statisticsProject roles
PurgesThe five retention sweeps, as a dry run by defaultScheduled job permission

The full "who can do what" matrix is in Roles and permissions.

Evolving the API ​

  • A new endpoint is declared on a contract interface (path, access rule, validation, OpenAPI documentation) implemented by a controller that only delegates; an architecture test rejects any controller outside this pattern (Backend).
  • Any extension of the list of public endpoints must be justified and approved.
  • A contract break is handled in a new path version; since the frontend is the only client, v2 could replace v1 in one go (ADR 015).