SPB Git

Repository Public

openapi.yaml 33.3 KB 613 lines yaml

1# =============================================================================2# SP BOUCHER | SOURCE FILE3# =============================================================================4# Project      : MacLustr Vision5# File         : openapi/openapi.yaml6# Author       : Simon-Pierre Boucher | https://spboucher.ai7# Contact      : admin@spboucher.ai8# Copyright    : (c) 2026 Simon-Pierre Boucher9# License      : None specified (no license file in this repository)10# =============================================================================11# END OF SP BOUCHER SOURCE HEADER12# =============================================================================1314openapi: 3.1.015info:16  title: MacLustr Vision — API privée17  version: "1.2.0"18  description: |19    API de la plateforme privée de vidéosurveillance MacLustr Vision.2021    - Toutes les routes exigent une session (cookie `__Host-mlv`), sauf celles marquées `security: []`.22    - Toute requête autre que GET/HEAD doit porter l'en-tête `Origin` exact du site, l'en-tête `X-MLV: 1`23      et, si elle a un corps, `Content-Type: application/json` (16 Ko au plus).24    - Les horodatages sont des entiers en millisecondes UTC. Les réponses privées sont en `Cache-Control: no-store`.25    - Erreurs : `{ "error": "<code>", "message": "<texte>" }`.2627    **Direct par WebSocket** (hors OpenAPI) : `GET /api/live/ws?camera=<id>&profile=main|sub[&audio=1]` avec28    `Upgrade: websocket`, la session et l'`Origin` du site. Le serveur relaie le protocole MSE de la passerelle :29    le client envoie `{"type":"mse","value":"<codecs séparés par des virgules>"}`, reçoit30    `{"type":"mse","value":"video/mp4; codecs=\"…\""}` puis des messages binaires fMP4. `audio=1` est refusé (403)31    si l'audio en direct n'est pas activé pour la caméra. Refus : 401 sans session, 403 si l'origine est mauvaise,32    404 si la caméra est inconnue. La connexion est coupée si la session est révoquée.33servers:34  - url: https://camera.spboucher.ai35security:36  - session: []37tags:38  - name: Authentification39  - name: Caméras40  - name: Direct41  - name: Enregistrements42  - name: Exports43  - name: Événements44  - name: Système45paths:46  /api/health:47    get:48      tags: [Système]49      summary: Santé de l'API (sans information sensible)50      security: []51      responses:52        '200': { description: En service, content: { application/json: { schema: { type: object, properties: { ok: { type: boolean } } } } } }53  /api/auth/login:54    post:55      tags: [Authentification]56      summary: Ouvre une session à partir de la clé d'accès57      security: []58      parameters: [{ $ref: '#/components/parameters/XMlv' }]59      requestBody:60        required: true61        content:62          application/json:63            schema:64              type: object65              required: [key]66              properties:67                key: { type: string, description: Clé d'accès personnelle }68                trust: { type: boolean, description: 'Appareil de confiance : session de 30 jours au lieu de 24 h' }69      responses:70        '200':71          description: Session ouverte (cookie `__Host-mlv`)72          headers: { Set-Cookie: { schema: { type: string } } }73          content: { application/json: { schema: { type: object, properties: { ok: { type: boolean }, expiresMs: { type: integer }, trusted: { type: boolean } } } } }74        '401': { $ref: '#/components/responses/Error' }75        '403': { $ref: '#/components/responses/Error' }76        '429': { $ref: '#/components/responses/RateLimited' }77  /api/auth/enroll:78    post:79      tags: [Authentification]80      summary: Activation par lien à usage unique81      description: Consomme le jeton du lien, crée une nouvelle clé (l'ancienne clé et toutes les sessions sont révoquées), ouvre la session de l'appareil et renvoie la clé une seule fois.82      security: []83      parameters: [{ $ref: '#/components/parameters/XMlv' }]84      requestBody:85        required: true86        content:87          application/json:88            schema:89              type: object90              required: [token]91              properties:92                token: { type: string, description: Jeton lu dans le fragment de l'URL `/setup#…` }93                trust: { type: boolean, default: true }94      responses:95        '200':96          description: Clé créée et session ouverte97          headers: { Set-Cookie: { schema: { type: string } } }98          content: { application/json: { schema: { type: object, properties: { key: { type: string }, expiresMs: { type: integer } } } } }99        '401': { $ref: '#/components/responses/Error' }100        '429': { $ref: '#/components/responses/RateLimited' }101  /api/auth/session:102    get:103      tags: [Authentification]104      summary: État de la session courante105      security: []106      responses:107        '200':108          description: Authentifié ou non (jamais 401)109          content:110            application/json:111              schema:112                type: object113                properties:114                  authenticated: { type: boolean }115                  configured: { type: boolean, description: 'Présent si non authentifié : une clé active existe' }116                  sessionId: { type: string }117                  expiresMs: { type: integer }118                  trusted: { type: boolean }119                  timezone: { type: string }120                  version: { type: string }121  /api/auth/logout:122    post:123      tags: [Authentification]124      summary: Révoque la session courante125      parameters: [{ $ref: '#/components/parameters/XMlv' }]126      responses:127        '200': { $ref: '#/components/responses/Ok' }128        '401': { $ref: '#/components/responses/Error' }129  /api/auth/sessions:130    get:131      tags: [Authentification]132      summary: Sessions actives133      responses:134        '200':135          description: Liste136          content: { application/json: { schema: { type: object, properties: { sessions: { type: array, items: { $ref: '#/components/schemas/Session' } } } } } }137  /api/auth/sessions/{id}:138    delete:139      tags: [Authentification]140      summary: Révoque une session (et coupe ses flux en direct)141      parameters: [{ $ref: '#/components/parameters/Id' }, { $ref: '#/components/parameters/XMlv' }]142      responses:143        '200': { $ref: '#/components/responses/Ok' }144        '404': { $ref: '#/components/responses/Error' }145  /api/auth/rotate-key:146    post:147      tags: [Authentification]148      summary: Renouvelle la clé d'accès149      description: Exige la clé actuelle. Révoque l'ancienne clé et toutes les sessions, y compris la session courante. La nouvelle clé n'est renvoyée qu'ici, une fois.150      parameters: [{ $ref: '#/components/parameters/XMlv' }]151      requestBody:152        required: true153        content: { application/json: { schema: { type: object, required: [currentKey], properties: { currentKey: { type: string } } } } }154      responses:155        '200': { description: Nouvelle clé, content: { application/json: { schema: { type: object, properties: { key: { type: string } } } } } }156        '401': { $ref: '#/components/responses/Error' }157        '429': { $ref: '#/components/responses/RateLimited' }158  /api/cameras:159    get:160      tags: [Caméras]161      summary: Caméras autorisées, réglages et état162      responses:163        '200':164          description: Liste165          content: { application/json: { schema: { type: object, properties: { cameras: { type: array, items: { $ref: '#/components/schemas/Camera' } }, serverTimeMs: { type: integer } } } } }166  /api/cameras/{id}/status:167    get:168      tags: [Caméras]169      summary: État d'une caméra170      parameters: [{ $ref: '#/components/parameters/Id' }]171      responses:172        '200': { description: État, content: { application/json: { schema: { $ref: '#/components/schemas/CameraStatus' } } } }173        '404': { $ref: '#/components/responses/Error' }174  /api/cameras/{id}/live:175    get:176      tags: [Direct]177      summary: Adresses des transports du direct pour une caméra178      parameters: [{ $ref: '#/components/parameters/Id' }]179      responses:180        '200':181          description: Chemins relatifs (WebSocket MSE et HLS), par profil ; `webrtc` vaut toujours null182          content:183            application/json:184              schema:185                type: object186                properties:187                  audioAllowed: { type: boolean }188                  mse: { $ref: '#/components/schemas/LivePaths' }189                  hls: { $ref: '#/components/schemas/LivePaths' }190                  webrtc: { type: 'null' }191        '404': { $ref: '#/components/responses/Error' }192  /api/cameras/{id}/snapshot:193    get:194      tags: [Direct]195      summary: Instantané JPEG réel de la caméra196      description: Image tirée du flux en cours (mise en cache 2 s côté serveur). Aucune image de substitution.197      parameters:198        - { $ref: '#/components/parameters/Id' }199        - { name: profile, in: query, schema: { type: string, enum: [main, sub], default: sub } }200        - { name: download, in: query, schema: { type: string, enum: ['1'] }, description: Ajoute un en-tête de téléchargement }201      responses:202        '200':203          description: Image204          headers: { X-Captured-At: { schema: { type: string }, description: Instant de capture (ms UTC) } }205          content: { image/jpeg: { schema: { type: string, format: binary } } }206        '502': { $ref: '#/components/responses/Error' }207        '503': { $ref: '#/components/responses/Error' }208  /api/cameras/{id}/settings:209    patch:210      tags: [Caméras]211      summary: Modifie les réglages d'une caméra212      parameters: [{ $ref: '#/components/parameters/Id' }, { $ref: '#/components/parameters/XMlv' }]213      requestBody:214        required: true215        content:216          application/json:217            schema:218              type: object219              minProperties: 1220              properties:221                name: { type: string, minLength: 1, maxLength: 60 }222                recordEnabled: { type: boolean }223                recordAudio: { type: boolean }224                liveAudio: { type: boolean }225                ptzEnabled: { type: boolean }226                schedule: { $ref: '#/components/schemas/Schedule' }227      responses:228        '200': { description: Caméra mise à jour, content: { application/json: { schema: { $ref: '#/components/schemas/Camera' } } } }229        '400': { $ref: '#/components/responses/Error' }230  /api/cameras/{id}/ptz:231    post:232      tags: [Caméras]233      summary: Commande d'orientation (PTZ)234      description: Exécutée par le service d'enregistrement. Un déplacement est toujours arrêté par le serveur après `durationMs`.235      parameters: [{ $ref: '#/components/parameters/Id' }, { $ref: '#/components/parameters/XMlv' }]236      requestBody:237        required: true238        content:239          application/json:240            schema:241              oneOf:242                - type: object243                  required: [action, pan, tilt]244                  properties:245                    action: { const: move }246                    pan: { type: number, minimum: -1, maximum: 1 }247                    tilt: { type: number, minimum: -1, maximum: 1 }248                    durationMs: { type: integer, minimum: 100, maximum: 3000, default: 600 }249                - type: object250                  required: [action]251                  properties: { action: { const: stop } }252      responses:253        '200': { $ref: '#/components/responses/Ok' }254        '400': { $ref: '#/components/responses/Error' }255        '403': { description: PTZ désactivé dans les réglages, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } }256        '409': { description: Caméra sans PTZ, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } }257        '502': { $ref: '#/components/responses/Error' }258        '503': { $ref: '#/components/responses/Error' }259  /api/live/hls/stream.m3u8:260    get:261      tags: [Direct]262      summary: Liste de lecture HLS maîtresse (repli)263      parameters:264        - { name: camera, in: query, required: true, schema: { type: string } }265        - { name: profile, in: query, schema: { type: string, enum: [main, sub], default: sub } }266        - { name: audio, in: query, schema: { type: string, enum: ['1'] } }267      responses:268        '200': { description: Liste maîtresse, content: { application/vnd.apple.mpegurl: { schema: { type: string } } } }269        '403': { $ref: '#/components/responses/Error' }270        '404': { $ref: '#/components/responses/Error' }271        '502': { $ref: '#/components/responses/Error' }272  /api/live/hls/hls/{file}:273    get:274      tags: [Direct]275      summary: Fichiers d'une session HLS276      parameters:277        - { name: file, in: path, required: true, schema: { type: string, enum: [playlist.m3u8, init.mp4, segment.m4s, segment.ts] } }278        - { name: id, in: query, required: true, schema: { type: string, pattern: '^[A-Za-z0-9]{4,32}$' }, description: Identifiant éphémère émis par la passerelle }279        - { name: n, in: query, schema: { type: integer } }280      responses:281        '200': { description: Liste ou segment, content: { '*/*': { schema: { type: string, format: binary } } } }282        '404': { $ref: '#/components/responses/Error' }283  /api/recordings:284    get:285      tags: [Enregistrements]286      summary: Segments enregistrés d'une période287      parameters:288        - { $ref: '#/components/parameters/CameraId' }289        - { $ref: '#/components/parameters/From' }290        - { $ref: '#/components/parameters/To' }291        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 2000, default: 1500 } }292        - { name: cursor, in: query, schema: { type: integer }, description: Valeur `nextCursor` de la page précédente }293      responses:294        '200':295          description: Page de segments296          content: { application/json: { schema: { type: object, properties: { segments: { type: array, items: { $ref: '#/components/schemas/Segment' } }, nextCursor: { type: [integer, 'null'] } } } } }297        '400': { $ref: '#/components/responses/Error' }298  /api/recordings/timeline:299    get:300      tags: [Enregistrements]301      summary: Plages enregistrées, trous et protections d'une période302      parameters: [{ $ref: '#/components/parameters/CameraId' }, { $ref: '#/components/parameters/From' }, { $ref: '#/components/parameters/To' }]303      responses:304        '200':305          description: Couverture306          content:307            application/json:308              schema:309                type: object310                properties:311                  ranges: { type: array, items: { $ref: '#/components/schemas/Range' } }312                  gaps: { type: array, items: { $ref: '#/components/schemas/Range' } }313                  segments: { type: integer }314                  bytes: { type: integer }315                  protections: { type: array, items: { type: object, properties: { id: { type: integer }, fromMs: { type: integer }, toMs: { type: integer }, label: { type: [string, 'null'] } } } }316  /api/recordings/days:317    get:318      tags: [Enregistrements]319      summary: Durée enregistrée par jour (fuseau du serveur)320      parameters: [{ $ref: '#/components/parameters/CameraId' }, { $ref: '#/components/parameters/From' }, { $ref: '#/components/parameters/To' }]321      responses:322        '200':323          description: Jours324          content: { application/json: { schema: { type: object, properties: { days: { type: array, items: { type: object, properties: { day: { type: string, format: date }, seconds: { type: integer }, bytes: { type: integer }, segments: { type: integer } } } } } } } }325  /api/recordings/thumbnail:326    get:327      tags: [Enregistrements]328      summary: Vignette tirée de l'enregistrement à un instant329      parameters:330        - { $ref: '#/components/parameters/CameraId' }331        - { name: t, in: query, required: true, schema: { type: integer }, description: Instant (ms UTC) }332      responses:333        '200': { description: Vignette, content: { image/jpeg: { schema: { type: string, format: binary } } } }334        '204': { description: Aucun enregistrement à cet instant }335  /api/recordings/{id}/playback:336    get:337      tags: [Enregistrements]338      summary: Lecture d'un segment en MP4 (requêtes `Range` acceptées)339      parameters:340        - { name: id, in: path, required: true, schema: { type: integer, minimum: 1 } }341        - { name: compat, in: query, schema: { type: string, enum: ['1'] }, description: Copie H.264 720p pour les navigateurs sans décodeur HEVC }342      responses:343        '200': { description: Vidéo, content: { video/mp4: { schema: { type: string, format: binary } } } }344        '206': { description: Plage d'octets, content: { video/mp4: { schema: { type: string, format: binary } } } }345        '404': { $ref: '#/components/responses/Error' }346        '416': { description: Plage non satisfaisable }347        '500': { $ref: '#/components/responses/Error' }348  /api/recordings/protect:349    post:350      tags: [Enregistrements]351      summary: Protège (ou libère) une période de la purge352      parameters: [{ $ref: '#/components/parameters/XMlv' }]353      requestBody:354        required: true355        content:356          application/json:357            schema:358              type: object359              required: [cameraId, fromMs, toMs]360              properties:361                cameraId: { type: string }362                fromMs: { type: integer }363                toMs: { type: integer, description: 7 jours au plus après fromMs }364                protected: { type: boolean, default: true }365                label: { type: string, maxLength: 80 }366      responses:367        '200': { description: Nombre de segments touchés, content: { application/json: { schema: { type: object, properties: { ok: { type: boolean }, segments: { type: integer } } } } } }368        '400': { $ref: '#/components/responses/Error' }369  /api/exports:370    get:371      tags: [Exports]372      summary: Les 50 derniers exports373      responses:374        '200': { description: Liste, content: { application/json: { schema: { type: object, properties: { exports: { type: array, items: { $ref: '#/components/schemas/Export' } } } } } } }375    post:376      tags: [Exports]377      summary: Lance l'export MP4 d'une période378      description: 120 minutes au plus ; 4 exports en attente au plus. Vidéo copiée sans réencodage, coupe aux images clés.379      parameters: [{ $ref: '#/components/parameters/XMlv' }]380      requestBody:381        required: true382        content: { application/json: { schema: { type: object, required: [cameraId, fromMs, toMs], properties: { cameraId: { type: string }, fromMs: { type: integer }, toMs: { type: integer } } } } }383      responses:384        '202': { description: Export mis en file, content: { application/json: { schema: { type: object, properties: { id: { type: string } } } } } }385        '400': { $ref: '#/components/responses/Error' }386        '404': { description: Aucun enregistrement sur la période, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } }387        '429': { $ref: '#/components/responses/Error' }388  /api/exports/{id}:389    get:390      tags: [Exports]391      summary: État d'un export392      parameters: [{ $ref: '#/components/parameters/Id' }]393      responses:394        '200': { description: Export, content: { application/json: { schema: { $ref: '#/components/schemas/Export' } } } }395        '404': { $ref: '#/components/responses/Error' }396    delete:397      tags: [Exports]398      summary: Supprime un export qui n'est pas en cours399      parameters: [{ $ref: '#/components/parameters/Id' }, { $ref: '#/components/parameters/XMlv' }]400      responses:401        '200': { $ref: '#/components/responses/Ok' }402        '404': { $ref: '#/components/responses/Error' }403  /api/exports/{id}/download:404    get:405      tags: [Exports]406      summary: Télécharge un export terminé (requêtes `Range` acceptées)407      parameters: [{ $ref: '#/components/parameters/Id' }]408      responses:409        '200': { description: Fichier MP4, content: { video/mp4: { schema: { type: string, format: binary } } } }410        '404': { $ref: '#/components/responses/Error' }411  /api/events:412    get:413      tags: [Événements]414      summary: Journal des événements réels du système, du plus récent au plus ancien415      parameters:416        - { name: cameraId, in: query, schema: { type: string } }417        - { name: type, in: query, schema: { type: string, pattern: '^[a-z_]{1,40}$' } }418        - { name: severity, in: query, schema: { type: string, enum: [info, warning, critical] } }419        - { name: from, in: query, schema: { type: integer } }420        - { name: to, in: query, schema: { type: integer } }421        - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 200, default: 50 } }422        - { name: cursor, in: query, schema: { type: integer }, description: Valeur `nextCursor` de la page précédente }423      responses:424        '200':425          description: Page d'événements426          content: { application/json: { schema: { type: object, properties: { events: { type: array, items: { $ref: '#/components/schemas/Event' } }, nextCursor: { type: [integer, 'null'] } } } } }427        '400': { $ref: '#/components/responses/Error' }428  /api/storage/status:429    get:430      tags: [Système]431      summary: Capacité réelle, utilisation par caméra, rétention, estimation432      responses:433        '200':434          description: État du stockage435          content:436            application/json:437              schema:438                type: object439                properties:440                  archive: { type: object, properties: { ok: { type: boolean }, reason: { type: [string, 'null'] }, location: { type: string }, usedBytes: { type: integer }, quotaBytes: { type: integer }, usedPct: { type: number }, level: { type: string, enum: [ok, warning, high, critical] } } }441                  disk: { type: object, properties: { totalBytes: { type: integer }, freeBytes: { type: integer }, usedPct: { type: number } } }442                  spool: { type: object, properties: { bytes: { type: integer }, maxBytes: { type: integer } } }443                  exports: { type: object, properties: { bytes: { type: integer } } }444                  cache: { type: object, properties: { bytes: { type: integer }, maxBytes: { type: integer } } }445                  retention: { type: object, properties: { days: { type: integer }, maxArchiveGB: { type: number }, minFreeGB: { type: number }, criticalFreeGB: { type: number } } }446                  suspended: { type: boolean }447                  estimate: { type: object, description: Tirée du débit réellement enregistré, properties: { measuredOverMs: { type: integer }, bytesPerDay: { type: integer }, daysAtQuota: { type: [number, 'null'] }, daysUntilQuota: { type: [number, 'null'] } } }448                  cameras: { type: array, items: { type: object, properties: { cameraId: { type: string }, name: { type: string }, segments: { type: integer }, bytes: { type: integer }, oldestMs: { type: integer }, newestMs: { type: integer }, recordedSeconds: { type: integer }, protectedSegments: { type: integer } } } }449  /api/system/status:450    get:451      tags: [Système]452      summary: État du nœud, des services, des enregistreurs et erreurs récentes453      responses:454        '200':455          description: État du système456          content:457            application/json:458              schema:459                type: object460                properties:461                  node: { type: object, properties: { hostname: { type: string }, platform: { type: string }, arch: { type: string }, cpus: { type: integer }, cpuModel: { type: [string, 'null'] }, totalMemBytes: { type: integer }, uptimeS: { type: integer }, load: { type: array, items: { type: number } } } }462                  core: { type: object, description: Battement de vision-core, properties: { alive: { type: boolean }, lastBeatMs: { type: [integer, 'null'] }, startedMs: { type: [integer, 'null'] }, version: { type: [string, 'null'] }, commit: { type: [string, 'null'] }, gateway: { type: [object, 'null'] }, archiveOk: { type: [boolean, 'null'] }, spoolFull: { type: [boolean, 'null'] } } }463                  api: { type: object, properties: { startedMs: { type: integer }, version: { type: string }, commit: { type: [string, 'null'] }, liveViewers: { type: integer }, node: { type: string } } }464                  current: { type: object, properties: { cpuPct: { type: [number, 'null'] }, visionCpuPct: { type: [number, 'null'] }, visionRssMb: { type: [number, 'null'] }, bitrateBps: { type: [number, 'null'] }, processes: { type: [number, 'null'] } } }465                  series: { type: object, description: 'Mesures des 3 dernières heures, paires [ms, valeur]', properties: { cpuPct: { type: array }, visionRssMb: { type: array }, bitrateBps: { type: array } } }466                  workers: { type: array, items: { type: object, properties: { cameraId: { type: string }, reachable: { type: boolean }, recorderState: { type: string }, sinceMs: { type: [integer, 'null'] }, restarts: { type: integer }, lastSegmentEndMs: { type: [integer, 'null'] }, bitrateBps: { type: [integer, 'null'] }, lastError: { type: [string, 'null'] } } } }467                  recentErrors: { type: array, items: { $ref: '#/components/schemas/Event' } }468                  serverTimeMs: { type: integer }469                  timezone: { type: string }470  /api/settings:471    get:472      tags: [Système]473      summary: Réglages généraux474      responses:475        '200':476          description: Réglages477          content:478            application/json:479              schema:480                type: object481                properties:482                  retention: { $ref: '#/components/schemas/Retention' }483                  session: { type: object, properties: { trustedDays: { type: integer }, defaultHours: { type: integer } } }484                  timezone: { type: string }485                  limits: { type: object, properties: { exportMaxMinutes: { type: integer } } }486    patch:487      tags: [Système]488      summary: Modifie la rétention et le quota d'archive489      parameters: [{ $ref: '#/components/parameters/XMlv' }]490      requestBody:491        required: true492        content: { application/json: { schema: { type: object, required: [retention], properties: { retention: { $ref: '#/components/schemas/Retention' } } } } }493      responses:494        '200': { description: Rétention en vigueur, content: { application/json: { schema: { type: object, properties: { retention: { $ref: '#/components/schemas/Retention' } } } } } }495        '400': { $ref: '#/components/responses/Error' }496  /api/push/status:497    get:498      summary: État des notifications (APNs configuré, appareils inscrits, préférences de cette session)499      responses: { "200": { description: "{ configured, devices, thisSession[] }" }, "401": { description: Session requise } }500  /api/push/devices:501    post:502      summary: Inscrire ou mettre à jour l'appareil de la session (jeton APNs, environnement, mouvement, alertes système)503      requestBody: { required: true, content: { application/json: { schema: { type: object, required: [token], properties: { token: { type: string, pattern: "^[0-9a-f]{64,200}$" }, environment: { type: string, enum: [production, sandbox] }, motion: { type: boolean }, system: { type: boolean }, name: { type: string, maxLength: 60 } } } } } }504      responses: { "200": { description: "{ ok: true }" }, "400": { description: Jeton invalide } }505  /api/push/devices/{token}:506    delete:507      summary: Désinscrire un appareil de la session courante508      parameters: [ { name: token, in: path, required: true, schema: { type: string } } ]509      responses: { "200": { description: "{ ok: true }" } }510  /api/push/test:511    post:512      summary: Envoyer une notification d'essai aux appareils de la session courante513      responses: { "200": { description: "{ sent, failed }" }, "503": { description: APNs non configuré } }514  /api/events/{id}/image:515    get:516      summary: Image JPEG prise au déclenchement d'un événement de mouvement517      parameters: [ { name: id, in: path, required: true, schema: { type: integer } } ]518      responses: { "200": { description: image/jpeg }, "404": { description: Pas d'image pour cet événement } }519components:520  securitySchemes:521    session:522      type: apiKey523      in: cookie524      name: __Host-mlv525      description: Jeton de session opaque, émis par `/api/auth/login` ou `/api/auth/enroll` (Secure, HttpOnly, SameSite=Strict).526  parameters:527    Id: { name: id, in: path, required: true, schema: { type: string, pattern: '^[A-Za-z0-9_.-]{1,64}$' } }528    XMlv: { name: X-MLV, in: header, required: true, schema: { type: string, enum: ['1'] }, description: En-tête applicatif exigé sur toute mutation (avec un `Origin` exact) }529    CameraId: { name: cameraId, in: query, required: true, schema: { type: string } }530    From: { name: from, in: query, required: true, schema: { type: integer }, description: Début (ms UTC) }531    To: { name: to, in: query, required: true, schema: { type: integer }, description: Fin (ms UTC), 62 jours au plus après le début }532  responses:533    Ok: { description: Fait, content: { application/json: { schema: { type: object, properties: { ok: { type: boolean } } } } } }534    Error: { description: Erreur, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } }535    RateLimited:536      description: Trop de tentatives537      headers: { Retry-After: { schema: { type: integer } } }538      content: { application/json: { schema: { allOf: [{ $ref: '#/components/schemas/Error' }, { type: object, properties: { retryAfterS: { type: integer } } }] } } }539  schemas:540    Error: { type: object, required: [error, message], properties: { error: { type: string }, message: { type: string } } }541    Range: { type: object, properties: { startMs: { type: integer }, endMs: { type: integer } } }542    Retention: { type: object, properties: { days: { type: integer, minimum: 1, maximum: 365 }, maxArchiveGB: { type: number, minimum: 5 } } }543    Schedule:544      description: null = 24 h sur 24 ; sinon plages hebdomadaires dans le fuseau du serveur (0 = dimanche). Une plage peut traverser minuit.545      type: [array, 'null']546      maxItems: 28547      items: { type: object, required: [days, from, to], properties: { days: { type: array, items: { type: integer, minimum: 0, maximum: 6 } }, from: { type: string, pattern: '^([01]\d|2[0-3]):[0-5]\d$' }, to: { type: string, pattern: '^([01]\d|2[0-3]):[0-5]\d$' } } }548    LivePaths: { type: object, properties: { main: { type: string }, sub: { type: string }, mainAudio: { type: [string, 'null'] }, subAudio: { type: [string, 'null'] } } }549    Session: { type: object, properties: { id: { type: string }, createdMs: { type: integer }, expiresMs: { type: integer }, lastSeenMs: { type: integer }, ip: { type: [string, 'null'] }, userAgent: { type: [string, 'null'] }, trusted: { type: boolean }, current: { type: boolean } } }550    CameraStatus:551      type: object552      properties:553        reachable: { type: boolean }554        reachableSinceMs: { type: [integer, 'null'] }555        lastCheckMs: { type: [integer, 'null'] }556        recorderState: { type: string, enum: [stopped, starting, recording, backoff, suspended] }557        recorderRestarts: { type: integer }558        lastSegmentEndMs: { type: [integer, 'null'] }559        recConfirmed: { type: boolean, description: Vrai seulement si un segment valide a été archivé récemment }560        bitrateBps: { type: [integer, 'null'] }561        lastError: { type: [string, 'null'] }562    Camera:563      type: object564      properties:565        id: { type: string }566        name: { type: string }567        model: { type: [string, 'null'] }568        firmware: { type: [string, 'null'] }569        capabilities: { type: object, properties: { ptz: { type: boolean }, audio: { type: boolean } } }570        profiles: { type: array, items: { type: object, properties: { role: { type: string, enum: [main, sub] }, width: { type: [integer, 'null'] }, height: { type: [integer, 'null'] }, fps: { type: [number, 'null'] }, bitrateKbps: { type: [number, 'null'] } } } }571        settings: { type: object, properties: { recordEnabled: { type: boolean }, recordAudio: { type: boolean }, liveAudio: { type: boolean }, ptzEnabled: { type: boolean }, schedule: { $ref: '#/components/schemas/Schedule' } } }572        status: { $ref: '#/components/schemas/CameraStatus' }573    Segment:574      type: object575      properties:576        id: { type: integer }577        startMs: { type: integer }578        endMs: { type: integer }579        durationMs: { type: integer }580        sizeBytes: { type: integer }581        codec: { type: [string, 'null'] }582        width: { type: [integer, 'null'] }583        height: { type: [integer, 'null'] }584        hasAudio: { type: boolean }585        state: { type: string, enum: [archived, recovered] }586        protected: { type: boolean }587        discontinuity: { type: boolean }588    Export:589      type: object590      properties:591        id: { type: string }592        cameraId: { type: string }593        fromMs: { type: integer }594        toMs: { type: integer }595        state: { type: string, enum: [queued, running, done, failed] }596        progress: { type: number, minimum: 0, maximum: 1 }597        sizeBytes: { type: [integer, 'null'] }598        fileName: { type: [string, 'null'] }599        error: { type: [string, 'null'] }600        createdMs: { type: integer }601        finishedMs: { type: [integer, 'null'] }602        expiresMs: { type: [integer, 'null'] }603    Event:604      type: object605      properties:606        id: { type: integer }607        tsMs: { type: integer }608        cameraId: { type: [string, 'null'] }609        type: { type: string }610        severity: { type: string, enum: [info, warning, critical] }611        message: { type: string }612        data: { type: object }613
Files main
Menu

Theme