openapi: 3.1.0
info:
  title: Wunder Fleet Hardware API - Webhooks
  version: 0.97.0
  description: |
    Wunder Fleet supports the implementation of custom hardware. This is done by using the Wunder Fleet hardware API.
    It allows to connect third party hardware and push telemetry data and other hardware events back to the Wunder platform.
  contact:
    name: Wunder Mobility GmbH
    url: 'https://wundermobility.com'
    email: info@wundermobility.com
servers:
  - url: https://devices-webhooks-staging.gourban.services/hooks-api/v1/tenants/{tenant}/integrations/hardware-api
    description: Wunder Platform Hardware API Webhook - Staging
    variables:
      tenant:
        default: demo
        description: Tenant identifier of your system. Usually 8 characters.
  - url: https://devices-webhooks.gourban.services/hooks-api/v1/tenants/{tenant}/integrations/hardware-api
    description: Wunder Platform Hardware API Webhook - Production
    variables:
      tenant:
        default: demo
        description: Tenant identifier of your system. Usually 8 characters.
paths:
  /webhook:
    post:
      operationId: publishEventWebhook
      summary: Webhook
      description: |
        Publish a new webhook containing telemetry and event information for a device connected via Wunder Fleet hardware API.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Webhook'
      responses:
        "201":
          description: Successful response
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  error:
                    type: string
                  key:
                    type: string
components:
  schemas:
    Webhook:
      type: object
      properties:
        deviceId:
          type: string
        eventId:
          type: integer
        timestamp:
          type: integer
        lat:
          type: number
          format: float
        lon:
          type: number
          format: float
        position_accuracy:
          type: integer
        energy_level:
          type: number
          format: float
        locked:
          type: boolean
        immobilised:
          type: boolean
        ignition_on:
          type: boolean
        mileage:
          type: number
          format: float
        box_closed:
          type: boolean
        key_inserted:
          type: boolean
        on_stand:
          type: boolean
        lights:
          type: string
          enum: [ on, off ]
        doors:
          type: string
          enum: [ open, closed ]
        windows:
          type: string
          enum: [ open, closed ]
        sunroof:
          type: string
          enum: [ open, closed ]
        gear:
          type: string
          enum: [ P, R, N, D, U ]
        cable_lock:
          type: boolean
        saddle:
          type: string
          enum: [ open, closed ]
        tailbox:
          type: string
          enum: [ open, closed ]
        electric_vehicle_state:
          type: object
          properties:
            charge:
              type: string
              enum: [ on, off ]
        in_station:
          type: boolean
        iot_battery_level:
          type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
security:
  - ApiKeyAuth: []