LEEO Insurance Services Aggregates API

Daily and weekly aggregated driver scorecards.

OpenAPI Specification

leeo-insurance-services-aggregates-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LEEO Fleet Telematics Aggregates API
  version: v1
  summary: Driver, trip, and driving-behavior telematics data for commercial auto fleets insured by LEEO.
  description: 'The LEEO APIs expose the telematics data LEEO (formerly Fairmatic) collects for a fleet: the roster of drivers, the trips each driver has taken, detailed trip paths and driving events (phone use, hard braking, rapid acceleration, overspeeding), and daily/weekly aggregate driver scorecards. A report endpoint returns a presigned link to a generated CSV report. All requests are authenticated with a fleet-scoped API key issued from the LEEO dashboard Settings page and presented in the Authorization header as `APIKEY <fm_api_key>`. All dates and epoch timestamps are UTC. Trip data becomes available approximately four hours after a trip completes.'
  x-generated: '2026-07-19'
  x-method: generated
  x-source: https://docs.leeoinsurance.com/leeo-apis/
  contact:
    name: LEEO Sales
    email: sales@leeoinsurance.com
    url: https://leeoinsurance.com/contact
  termsOfService: https://leeoinsurance.com/terms-of-service
servers:
- url: https://api.leeoinsurance.com/api/v1
  description: Production
security:
- apiKeyAuth: []
tags:
- name: Aggregates
  description: Daily and weekly aggregated driver scorecards.
paths:
  /driver-aggregate/daily:
    get:
      operationId: getDailyDriverAggregate
      tags:
      - Aggregates
      summary: Get daily driver summary
      description: Aggregated daily driving metrics for the specified drivers. Aggregation is performed on UTC dates. `start_date` must be within the last six months and cannot be the current day. Between 1 and 20 `driver_id` values may be supplied.
      parameters:
      - name: start_date
        in: query
        required: true
        description: Summary date (YYYY-MM-DD). Within the last 6 months; cannot be today.
        schema:
          type: string
          format: date
        example: '2024-05-20'
      - name: driver_id
        in: query
        required: true
        description: Driver id to fetch a summary for. Repeatable — minimum 1, maximum 20.
        explode: true
        schema:
          type: array
          minItems: 1
          maxItems: 20
          items:
            type: string
      responses:
        '200':
          description: Daily aggregate summary per driver.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DailyAggregateResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
  /driver-aggregate/weekly:
    get:
      operationId: getWeeklyDriverAggregate
      tags:
      - Aggregates
      summary: Get weekly driver summary
      description: Aggregated weekly driving metrics for the specified drivers, including a day-by-day breakdown for the days the driver drove. Aggregation is performed on UTC dates. `start_date` must be a Monday, within the last six months, and cannot be the current day. Between 1 and 20 `driver_id` values may be supplied.
      parameters:
      - name: start_date
        in: query
        required: true
        description: Week start date (YYYY-MM-DD). Must be a Monday, within the last 6 months, not today.
        schema:
          type: string
          format: date
        example: '2024-05-20'
      - name: driver_id
        in: query
        required: true
        description: Driver id to fetch a summary for. Repeatable — minimum 1, maximum 20.
        explode: true
        schema:
          type: array
          minItems: 1
          maxItems: 20
          items:
            type: string
      responses:
        '200':
          description: Weekly aggregate summary per driver with daily breakdown.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WeeklyAggregateResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    RateLimited:
      description: Rate limit exceeded. All APIs are limited to 5000 requests per minute per fleet, counting all authenticated calls including non-200 responses.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
  schemas:
    DailyAggregateResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              driver_info:
                $ref: '#/components/schemas/Driver'
              driving_summary:
                $ref: '#/components/schemas/DailyDrivingSummary'
    EventSummary:
      type: object
      description: Counts and durations of driving events observed on a trip or aggregate window.
      properties:
        phone_use_count:
          type: integer
        rapid_acceleration_count:
          type: integer
        hard_brake_count:
          type: integer
        overspeeding_count:
          type: integer
        phone_use_time_seconds:
          type: number
        overspeeding_time_seconds:
          type: number
    WeeklyDrivingSummary:
      allOf:
      - $ref: '#/components/schemas/DrivingSummary'
      - type: object
        properties:
          start_date:
            type: string
            format: date
          end_date:
            type: string
            format: date
          daily_summary_breakdown:
            type: array
            description: Day-by-day breakdown for the days the driver drove in the week.
            items:
              $ref: '#/components/schemas/DailyDrivingSummary'
    Message:
      type: object
      description: Simple message envelope used for non-2xx responses.
      properties:
        message:
          type: string
    WeeklyAggregateResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              driver_info:
                $ref: '#/components/schemas/Driver'
              driving_summary:
                $ref: '#/components/schemas/WeeklyDrivingSummary'
    FocusArea:
      type: object
      description: Flags marking which behaviors are the driver's coaching focus areas.
      properties:
        is_phone_use:
          type: boolean
        is_rapid_acceleration:
          type: boolean
        is_acceleration:
          type: boolean
        is_hard_brake:
          type: boolean
        is_overspeeding:
          type: boolean
    Driver:
      type: object
      description: A driver in the fleet. All fields other than driver_id can be null.
      properties:
        driver_id:
          type: string
        first_name:
          type:
          - string
          - 'null'
        last_name:
          type:
          - string
          - 'null'
        email:
          type:
          - string
          - 'null'
        alias:
          type:
          - string
          - 'null'
        first_travel_date:
          type:
          - string
          - 'null'
          format: date
        last_travel_date:
          type:
          - string
          - 'null'
          format: date
      required:
      - driver_id
    DrivingSummary:
      type: object
      description: Aggregated driving metrics and LEEO driving score for a window.
      properties:
        fm_score:
          type: number
          description: LEEO/Fairmatic driving score.
        fm_grade:
          type: string
          description: Grade band for the score, e.g. excellent, good.
        trip_count:
          type: integer
        distance_miles:
          type: number
        duration_seconds:
          type: number
        night_driving_seconds:
          type: number
        highway_miles:
          type: number
        events_summary:
          $ref: '#/components/schemas/EventSummary'
        focus_area:
          $ref: '#/components/schemas/FocusArea'
    DailyDrivingSummary:
      allOf:
      - $ref: '#/components/schemas/DrivingSummary'
      - type: object
        properties:
          date:
            type: string
            format: date
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Fleet-scoped API key from the LEEO dashboard Settings page, sent as `Authorization: APIKEY <fm_api_key>`.'