openapi: 3.0.0
info:
  title: 'Beekube API'
  description: "API Beekube v2 — Accédez à toutes vos données apicoles : ruchers, ruches, interventions, récoltes, reines, objets connectés. Configurez des webhooks pour recevoir des notifications en temps réel dans vos outils d'automatisation (Make, N8N, etc.).\n\n## Authentification\n\nIncluez votre clé API dans l'en-tête `X-API-KEY` de chaque requête. Générez votre clé dans `Configuration > Développeur`.\n\n## Pagination\n\nLes endpoints de liste retournent des résultats paginés. Utilisez les paramètres `page` et `limit` pour naviguer.\n\n## Webhooks\n\nSouscrivez à des événements pour recevoir des notifications HTTP en temps réel. Les payloads sont signés avec HMAC-SHA256.\n\n## Document OpenAPI\nhttps://www.beekube.com/docs/v2_openapi.yaml\n"
  contact:
    name: 'Support Beekube'
    email: support@beekube.com
  version: v2
servers:
  -
    url: 'https://www.beekube.com/api/v2'
paths:
  /me:
    get:
      tags:
        - account
      summary: 'Informations du compte'
      description: 'Retourne les informations du compte associé à la clé API. Utilisé pour valider la connexion.'
      operationId: ac24e721d3630b6cd7ceb37adb001162
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountRespond'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorRespond'
              example:
                error:
                  code: 401
                  message: Unauthorized
                  details: []
  /apiaries:
    get:
      tags:
        - apiaries
      summary: 'Liste des ruchers'
      operationId: fdbdb135cf3d008f36a3f67b7f78a7ce
      parameters:
        -
          name: name
          in: query
          description: 'Filtrer par nom {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/ApiaryRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/apiaries/{id}':
    get:
      tags:
        - apiaries
      summary: "Détail d'un rucher"
      operationId: d15afb03e8b8f06657ea58dec816c108
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant du rucher {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiaryRespond'
        '404':
          description: 'Rucher inconnu'
  /beehives:
    get:
      tags:
        - beehives
      summary: 'Liste des ruches'
      operationId: 3fc52b2aa7232cfb4e4dadd03b85c590
      parameters:
        -
          name: apiary_id
          in: query
          description: 'Filtrer par rucher {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: status
          in: query
          description: 'Filtrer par statut {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: tag_id
          in: query
          description: 'Filtrer par tag {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/BeehiveRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/beehives/{id}':
    get:
      tags:
        - beehives
      summary: "Détail d'une ruche"
      operationId: 9fec10f1ee0409852dac4d2c6b94022f
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant de la ruche {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BeehiveRespond'
        '404':
          description: 'Ruche inconnue'
  '/apiaries/{id}/beehives':
    get:
      tags:
        - beehives
      summary: "Ruches d'un rucher"
      operationId: 66074bf065f43c321ab190ece39920e8
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant du rucher {@from path}'
          required: true
          schema:
            type: integer
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/BeehiveRespond' } }
                  pagination: { type: object }
                type: object
        '404':
          description: 'Rucher inconnu'
  /devices:
    get:
      tags:
        - devices
      summary: 'Liste des objets connectés'
      operationId: e6ff46d2da393169a3d71d47f10707ba
      parameters:
        -
          name: type
          in: query
          description: 'Type de device {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/DeviceRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/devices/{id}':
    get:
      tags:
        - devices
      summary: "Détail d'un objet connecté"
      operationId: aa9285c6d5471da7ee5c80e46afc9cff
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceRespond'
        '404':
          description: 'Device inconnu'
  '/devices/{id}/data':
    get:
      tags:
        - devices
      summary: "Données de mesure d'un objet connecté"
      operationId: c617ed3a0f316e4f30d7c70eda4c53cd
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
        -
          name: since
          in: query
          description: 'Date de début {@from query} {@required true}'
          required: true
          schema:
            type: string
          example: '2024-01-01'
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { type: object } }
                  pagination: { type: object }
                type: object
        '404':
          description: 'Device inconnu'
  /harvests:
    get:
      tags:
        - harvests
      summary: 'Liste des récoltes'
      operationId: d7b581c965f05951b6fcd1e0e06bd213
      parameters:
        -
          name: type
          in: query
          description: 'Type (1=miel, 2=pollen, 3=propolis) {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: apiary_id
          in: query
          description: 'Filtrer par rucher {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: beehive_id
          in: query
          description: 'Filtrer par ruche {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: since
          in: query
          description: 'Date de début {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: until
          in: query
          description: 'Date de fin {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/HarvestRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/harvests/{id}':
    get:
      tags:
        - harvests
      summary: "Détail d'une récolte"
      operationId: 8b26fb64bd2971fdeb2dc1111f1a4422
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HarvestRespond'
        '404':
          description: 'Récolte inconnue'
  /interventions:
    get:
      tags:
        - interventions
      summary: 'Liste des interventions'
      operationId: c96081f8859d2bf63c3308584a4855c6
      parameters:
        -
          name: apiary_id
          in: query
          description: 'Filtrer par rucher {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: beehive_id
          in: query
          description: 'Filtrer par ruche {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: type_id
          in: query
          description: 'Filtrer par type {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: since
          in: query
          description: 'Date de début {@from query} {@required false}'
          required: false
          schema:
            type: string
          example: '2024-01-01'
        -
          name: until
          in: query
          description: 'Date de fin {@from query} {@required false}'
          required: false
          schema:
            type: string
          example: '2024-12-31'
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/InterventionRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/interventions/{id}':
    get:
      tags:
        - interventions
      summary: "Détail d'une intervention"
      operationId: 3653072edbc69431e20d7f400266ab7c
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InterventionRespond'
        '404':
          description: 'Intervention inconnue'
  '/beehives/{id}/interventions':
    get:
      tags:
        - interventions
      summary: "Interventions d'une ruche"
      operationId: 4f8d15c7e40a19729706640ce58203c2
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant de la ruche {@from path}'
          required: true
          schema:
            type: integer
        -
          name: since
          in: query
          description: 'Date de début {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: until
          in: query
          description: 'Date de fin {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/InterventionRespond' } }
                  pagination: { type: object }
                type: object
        '404':
          description: 'Ruche inconnue'
  /queens:
    get:
      tags:
        - queens
      summary: 'Liste des reines'
      operationId: 3e7543d09ee91e0b8b7bc7f6c79af444
      parameters:
        -
          name: state
          in: query
          description: 'État (0=cellule, 1=vierge, 2=pondeuse) {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: state_exploitation
          in: query
          description: 'État exploitation (0=vivante, 1=morte, 2=transférée) {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: color
          in: query
          description: 'Couleur {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/QueenBeeRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/queens/{id}':
    get:
      tags:
        - queens
      summary: "Détail d'une reine"
      operationId: 66723ec0a88ed6acffa059a69f9fc25f
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueenBeeRespond'
        '404':
          description: 'Reine inconnue'
  /tags:
    get:
      tags:
        - tags
      summary: 'Liste des tags'
      operationId: 5a680462c56b641283528ac4bc424e25
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/TagRespond' } }
                type: object
        '401':
          description: Unauthorized
  /tasks:
    get:
      tags:
        - tasks
      summary: 'Liste des tâches'
      operationId: de1d6b1bfeac94811b1d57e986100056
      parameters:
        -
          name: validated
          in: query
          description: 'Filtre validée (0 ou 1) {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: since
          in: query
          description: 'Date de début {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: until
          in: query
          description: 'Date de fin {@from query} {@required false}'
          required: false
          schema:
            type: string
        -
          name: page
          in: query
          description: 'Page {@from query} {@required false}'
          required: false
          schema:
            type: integer
        -
          name: limit
          in: query
          description: 'Items par page {@from query} {@required false}'
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/TaskRespond' } }
                  pagination: { type: object }
                type: object
        '401':
          description: Unauthorized
  '/tasks/{id}':
    get:
      tags:
        - tasks
      summary: "Détail d'une tâche"
      operationId: c7ba4b41114a2122ae5d50aba45521ab
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRespond'
        '404':
          description: 'Tâche inconnue'
  /webhooks:
    get:
      tags:
        - webhooks
      summary: 'Liste des souscriptions webhook'
      operationId: 919602d0f11c7efb43e3ab160759153b
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/WebhookRespond' } }
                type: object
        '401':
          description: Unauthorized
    post:
      tags:
        - webhooks
      summary: 'Créer une souscription webhook'
      description: "Crée une souscription webhook. Un secret HMAC est généré automatiquement. Un événement de vérification est envoyé à l'URL fournie."
      operationId: 02350deaaab735f56b2a855f79412b19
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
                - url
                - events
              properties:
                url:
                  type: string
                  example: 'https://hook.eu1.make.com/abc123'
                events:
                  type: array
                  items: { type: string }
                  example: '["intervention.created","harvest.created"]'
              type: object
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookRespond'
        '400':
          description: 'Paramètres invalides'
        '401':
          description: Unauthorized
  /webhooks/events:
    get:
      tags:
        - webhooks
      summary: 'Liste des événements webhook disponibles'
      operationId: 9be8d0c4f1a5662c1d5ca278d579ae6a
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  data: { type: array, items: { $ref: '#/components/schemas/WebhookEventListRespond' } }
                type: object
  '/webhooks/{id}':
    get:
      tags:
        - webhooks
      summary: "Détail d'une souscription webhook"
      operationId: 30d19e3418ee8db2765937579ea6dcc5
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookRespond'
        '404':
          description: 'Webhook inconnu'
    delete:
      tags:
        - webhooks
      summary: 'Supprimer une souscription webhook'
      operationId: 04ff222d50be049acb697e9b38f4b5bc
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  success: { type: boolean, example: true }
                  message: { type: string, example: 'Webhook supprimé' }
                type: object
        '404':
          description: 'Webhook inconnu'
  '/webhooks/{id}/test':
    post:
      tags:
        - webhooks
      summary: 'Envoyer un ping de test'
      operationId: 8727ca1491ad9c237f1c9940e88522fb
      parameters:
        -
          name: id
          in: path
          description: 'Identifiant {@from path}'
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '404':
          description: 'Webhook inconnu'
components:
  schemas:
    AccountRespond:
      properties:
        id:
          description: "Identifiant de l'exploitation"
          type: integer
          example: 42
        society:
          description: 'Nom de la société'
          type: string
          example: 'Mon Rucher'
          nullable: true
        napi:
          description: 'Numéro NAPI'
          type: string
          example: 75A12345
          nullable: true
      type: object
    ApiaryRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 3
        name:
          description: 'Nom du rucher'
          type: string
          example: 'Les Tilleuls'
          nullable: true
        description:
          description: Description
          type: string
          nullable: true
        localisation:
          description: Localisation
          type: string
          example: 'Route des Lavandes, 04000 Digne'
          nullable: true
        lat:
          description: Latitude
          type: number
          format: float
          example: 44.0923
          nullable: true
        lng:
          description: Longitude
          type: number
          format: float
          example: 6.2358
          nullable: true
        warehouse:
          description: 'Entrepôt/lieu de stockage'
          type: boolean
          example: false
        beehiveCount:
          description: 'Nombre de ruches'
          type: integer
        dateAdd:
          description: 'Date de création'
          type: string
          nullable: true
      type: object
    BeehiveRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 12
        reference:
          description: Référence
          type: string
          example: R-042
          nullable: true
        description:
          description: Description
          type: string
          nullable: true
        apiary:
          description: Rucher
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ApiarySimpleRespond'
        type:
          description: 'Type de ruche'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveTypeRespond'
        status:
          description: Statut
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveStatusRespond'
        nbFrame:
          description: 'Nombre de cadres'
          type: integer
          nullable: true
        strength:
          description: 'Force de la colonie (1-5)'
          type: integer
          nullable: true
        power:
          description: 'Puissance (0-1)'
          type: number
          format: float
          example: 0.75
          nullable: true
        behaviour:
          description: 'Comportement (0=agressif, 1=normal, 2=calme)'
          type: integer
          nullable: true
        exposure:
          description: 'Exposition (N, S, E, W)'
          type: string
          nullable: true
        stored:
          description: 'En stockage'
          type: boolean
        queenBee:
          description: 'Reine actuelle'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/QueenBeeSimpleRespond'
        tags:
          description: Tags
          type: array
          items:
            $ref: '#/components/schemas/TagRespond'
        dateCreated:
          description: 'Date de création'
          type: string
          nullable: true
        dateLastIntervention:
          description: 'Date de dernière intervention'
          type: string
          nullable: true
      type: object
    ApiarySimpleRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        name:
          description: Nom
          type: string
          nullable: true
      type: object
    BeehiveTypeRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        name:
          description: Nom
          type: string
          example: 'Dadant 10 cadres'
          nullable: true
        type:
          description: 'Type (hive, nuc-hive, nuc, crate)'
          type: string
        maxFrame:
          description: 'Nombre max de cadres'
          type: integer
          nullable: true
      type: object
    BeehiveStatusRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        name:
          description: Nom
          type: string
          nullable: true
      type: object
    BeehiveSimpleRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        reference:
          description: Référence
          type: string
          nullable: true
      type: object
    QueenBeeSimpleRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        name:
          description: Nom/Référence
          type: string
          nullable: true
        color:
          description: Couleur
          type: string
          nullable: true
      type: object
    DeviceRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 23
        name:
          description: Nom
          type: string
          example: 'Balance Ruche 3'
          nullable: true
        type:
          description: 'Type (0=custom, 1=optibee, 2=honey_instruments, 3=bee2beep, 4=cbk)'
          type: integer
        typeConnection:
          description: 'Type de connexion (0=sigfox, 2=lora, 3=satellite)'
          type: integer
          nullable: true
        refExtern:
          description: 'Référence externe'
          type: string
          nullable: true
        state:
          description: Statut
          type: integer
          nullable: true
        lat:
          description: Latitude
          type: number
          format: float
          nullable: true
        lng:
          description: Longitude
          type: number
          format: float
          nullable: true
        lastSync:
          description: 'Dernière synchronisation'
          type: string
          nullable: true
        beehive:
          description: 'Ruche associée'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveSimpleRespond'
        apiary:
          description: 'Rucher associé'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ApiarySimpleRespond'
      type: object
    HarvestRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 89
        reference:
          description: Référence
          type: string
          nullable: true
        type:
          description: 'Type (1=miel, 2=pollen, 3=propolis)'
          type: integer
          example: 1
          nullable: true
        typeLabel:
          description: 'Type en texte'
          type: string
          example: Miel
          nullable: true
        weight:
          description: 'Poids (kg)'
          type: number
          format: float
          example: 12.5
          nullable: true
        beforeWeight:
          description: 'Poids avant récolte (kg)'
          type: number
          format: float
          nullable: true
        afterWeight:
          description: 'Poids après récolte (kg)'
          type: number
          format: float
          nullable: true
        frame:
          description: 'Nombre de cadres'
          type: integer
          nullable: true
        ratio:
          description: 'Ratio (%)'
          type: number
          format: float
          nullable: true
        honeyType:
          description: 'Type de miel'
          type: string
          nullable: true
        apiary:
          description: Rucher
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ApiarySimpleRespond'
        beehive:
          description: Ruche
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveSimpleRespond'
        dateAdd:
          description: 'Date de la récolte'
          type: string
          nullable: true
      type: object
    InterventionRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 456
        interventionType:
          description: "Type d'intervention"
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/InterventionTypeRespond'
        apiary:
          description: Rucher
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ApiarySimpleRespond'
        beehive:
          description: Ruche
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveSimpleRespond'
        queenBee:
          description: Reine
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/QueenBeeSimpleRespond'
        observation:
          description: 'Observation (comptage varroa, pesée, etc.)'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ObservationInlineRespond'
        comments:
          description: Commentaires
          type: string
          nullable: true
        quantity:
          description: Quantité
          type: integer
          nullable: true
        photosCount:
          description: 'Nombre de photos'
          type: integer
        photos:
          description: 'Photos avec URLs (URLs temporaires, expiration ~24h)'
          type: array
          items:
            $ref: '#/components/schemas/InterventionPhotoRespond'
        dateAdd:
          description: "Date de l'intervention"
          type: string
          nullable: true
      type: object
    InterventionTypeRespond:
      properties:
        id:
          description: Identifiant
          type: integer
        name:
          description: Nom
          type: string
          nullable: true
      type: object
    ObservationInlineRespond:
      properties:
        type:
          description: 'Type (1=comptage varroa, 2=pesée, 3=comptage varroa VPH)'
          type: integer
          example: 2
        subType:
          description: Sous-type
          type: integer
          nullable: true
        value:
          description: Valeur
          type: string
          example: '3.5'
          nullable: true
        unit:
          description: Unité
          type: string
          example: kg
          nullable: true
        compareWithPrev:
          description: 'Comparaison avec la mesure précédente'
          type: number
          format: float
          example: -0.5
          nullable: true
      type: object
    InterventionPhotoRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 78
        url:
          description: "URL de l'image originale (expiration ~24h)"
          type: string
        thumbnailUrl:
          description: 'URL de la miniature 200px (expiration ~24h)'
          type: string
        mediumUrl:
          description: 'URL moyenne résolution 800px (expiration ~24h)'
          type: string
        width:
          description: 'Largeur en pixels'
          type: integer
          nullable: true
        height:
          description: 'Hauteur en pixels'
          type: integer
          nullable: true
        mimeType:
          description: 'Type MIME'
          type: string
          example: image/jpeg
          nullable: true
        uploadedAt:
          description: "Date d'upload"
          type: string
          nullable: true
      type: object
    QueenBeeRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 7
        name:
          description: Nom/Référence
          type: string
          example: R-003
          nullable: true
        origin:
          description: Origine
          type: string
          nullable: true
        bee:
          description: Race
          type: string
          nullable: true
        state:
          description: 'État (0=cellule, 1=vierge, 2=pondeuse)'
          type: integer
          nullable: true
        stateExploitation:
          description: 'État exploitation (0=vivante, 1=morte, 2=transférée)'
          type: integer
          nullable: true
        color:
          description: Couleur
          type: string
          example: blue
          nullable: true
        bib:
          description: 'Numéro de marquage'
          type: integer
          nullable: true
        accepted:
          description: Acceptée
          type: boolean
        marked:
          description: Marquée
          type: boolean
        clipped:
          description: Clippée
          type: boolean
        generation:
          description: 'Génération (0=F0, 1=F1, 2=F2, 3=FX)'
          type: integer
          nullable: true
        description:
          description: Description
          type: string
          nullable: true
        beehive:
          description: 'Ruche actuelle'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveSimpleRespond'
        parent:
          description: Mère
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/QueenBeeSimpleRespond'
        scoreAverage:
          description: 'Score moyen'
          type: number
          format: float
          nullable: true
        born:
          description: 'Date de naissance'
          type: string
          nullable: true
        died:
          description: 'Date de mort'
          type: string
          nullable: true
        dateAdd:
          description: 'Date de création'
          type: string
          nullable: true
      type: object
    TagRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 5
        label:
          description: Libellé
          type: string
          example: 'À surveiller'
          nullable: true
        icon:
          description: Icône
          type: string
          nullable: true
        color:
          description: Couleur
          type: string
          example: '#FF5733'
          nullable: true
      type: object
    TaskRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 15
        taskType:
          description: 'Type de tâche'
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/InterventionTypeRespond'
        apiary:
          description: Rucher
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/ApiarySimpleRespond'
        beehive:
          description: Ruche
          nullable: true
          oneOf:
            -
              $ref: '#/components/schemas/BeehiveSimpleRespond'
        comments:
          description: Commentaires
          type: string
          nullable: true
        category:
          description: Catégorie
          type: string
          example: standard
        validated:
          description: Validée
          type: boolean
        quantity:
          description: Quantité
          type: integer
          nullable: true
        color:
          description: Couleur
          type: string
          nullable: true
        dateTask:
          description: 'Date de la tâche'
          type: string
          nullable: true
        dateAdd:
          description: 'Date de création'
          type: string
          nullable: true
      type: object
    WebhookRespond:
      properties:
        id:
          description: Identifiant
          type: integer
          example: 1
        url:
          description: 'URL de callback'
          type: string
          example: 'https://hook.eu1.make.com/abc123'
        secret:
          description: 'Secret HMAC (affiché uniquement à la création)'
          type: string
          nullable: true
        events:
          description: 'Événements souscrits'
          type: array
          items:
            type: string
          example: '["intervention.created","harvest.created"]'
        active:
          description: Actif
          type: boolean
        verified:
          description: Vérifié
          type: boolean
        failureCount:
          description: "Nombre d'échecs consécutifs"
          type: integer
        dateAdd:
          description: 'Date de création'
          type: string
          nullable: true
      type: object
    WebhookEventListRespond:
      properties:
        event:
          description: "Nom de l'événement"
          type: string
          example: intervention.created
        description:
          description: Description
          type: string
          example: 'Nouvelle intervention enregistrée'
        category:
          description: Catégorie
          type: string
          example: interventions
      type: object
    ErrorRespond:
      properties:
        code:
          description: "Code d'erreur"
          type: integer
        message:
          description: "Message de l'erreur"
          type: string
        details:
          description: 'Informations supplémentaires'
          type: array
          items:
            type: integer
      type: object
    PaginationRespond:
      properties:
        currentPage:
          description: 'Page actuelle'
          type: integer
          example: 1
        maxPage:
          description: 'Nombre de page maximum'
          type: integer
          example: 2
        itemPerPage:
          description: "Nombre maximum d'item par page"
          type: integer
          example: 100
        nextPage:
          description: 'Numéro de la page suivante'
          type: integer
          example: 2
          nullable: true
        nextPageUrl:
          description: 'URL de la page suivante'
          type: string
          nullable: true
        previousPage:
          description: 'Numéro de la page précédente'
          type: integer
          nullable: true
        previousPageUrl:
          description: 'URL de la page précédente'
          type: string
          nullable: true
      type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: "## Authentification de l'API Beekube\n\nL'authentification à l'API Beekube est assurée par l'utilisation d'une clé API. Cette clé est un token unique qui permet d'identifier et de sécuriser vos interactions avec l'API. Voici comment procéder pour l'utiliser :\n\n### Obtention de votre Clé API\n\n1. **Accès à la clé :** Connectez-vous à votre compte Beekube et naviguez vers la section `Configuration > Développeur`. \n2. **Génération de la clé :** Dans cette section, vous trouverez l'option pour générer votre clé API personnelle. Une fois générée, vous pouvez la copier pour l'utiliser dans vos requêtes API.\n\n### Utilisation de la Clé API\n\n- **Intégration dans les Requêtes :** Pour chaque requête envoyée à l'API Beekube, vous devez inclure votre clé API. Elle doit être insérée dans l'en-tête HTTP de la requête sous la clé `X-API-KEY`.\n- **Format de l'En-tête :** L'en-tête doit être structuré de la manière suivante : `X-API-KEY: VotreCléAPI`.\n\n### Sécurité\n\n- **Confidentialité :** Votre clé API est unique et doit rester confidentielle. Ne la partagez avec personne pour assurer la sécurité de vos données.\n- **Révocation et Régénération :** En cas de compromission ou pour des raisons de sécurité, vous pouvez à tout moment révoquer et régénérer une nouvelle clé API depuis votre compte Beekube.\n\nEn suivant ces étapes simples, vous assurez une connexion sécurisée et authentifiée avec l'API Beekube, permettant une interaction fluide et sûre avec vos dispositifs connectés pour ruches.\n"
      name: X-API-KEY
      in: header
security:
  -
    ApiKeyAuth: []
tags:
  -
    name: account
    description: 'Informations du compte connecté'
    x-displayName: Compte
  -
    name: apiaries
    description: 'Gestion des ruchers'
    x-displayName: Ruchers
  -
    name: beehives
    description: 'Gestion des ruches'
    x-displayName: Ruches
  -
    name: devices
    description: 'Objets connectés et données de mesure'
    x-displayName: 'Objets connectés'
  -
    name: harvests
    description: 'Gestion des récoltes'
    x-displayName: Récoltes
  -
    name: interventions
    description: 'Historique des interventions'
    x-displayName: Interventions
  -
    name: queens
    description: 'Gestion des reines'
    x-displayName: Reines
  -
    name: tags
    description: 'Tags personnalisés'
    x-displayName: Tags
  -
    name: tasks
    description: 'Gestion des tâches planifiées'
    x-displayName: Tâches
  -
    name: webhooks
    description: "Gestion des souscriptions webhook. Les webhooks permettent de recevoir des notifications HTTP en temps réel lorsqu'un événement se produit sur votre compte."
    x-displayName: Webhooks
x-tagGroups:
  -
    name: account
    tags:
      - account
  -
    name: apiculture
    tags:
      - apiaries
      - beehives
      - interventions
      - harvests
      - queens
      - tasks
      - tags
  -
    name: devices
    tags:
      - devices
  -
    name: webhooks
    tags:
      - webhooks
