> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withterminal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Historical Vehicle Stats

> List historical stats and logs about the vehicle.



## OpenAPI

````yaml GET /vehicles/{vehicleId}/stats/historical
openapi: 3.1.0
info:
  title: Terminal Telematics API
  description: >-
    Terminal is a unified API that makes it easy to integrate with the leading
    telematics service providers.
  version: '0.0'
  contact:
    name: Terminal
    email: connect@withterminal.com
    url: https://www.withterminal.com
servers:
  - url: https://api.withterminal.com/tsp/v1
    description: Production
  - url: https://api.sandbox.withterminal.com/tsp/v1
    description: Sandbox
security:
  - Authorization: []
tags:
  - name: Authentication
  - name: Connections
  - name: Data Management
  - name: Drivers
  - name: Groups
  - name: Hours of Service
  - name: IFTA
  - name: Issues
  - name: Link
  - name: Providers
  - name: Safety
  - name: Trailers
  - name: Vehicles
  - name: Vehicle Utilization
  - name: Webhook Events
paths:
  /vehicles/{vehicleId}/stats/historical:
    parameters:
      - schema:
          title: VehicleId
          description: Unique identifier for the vehicle in Terminal.
          type: string
          format: ulid
          pattern: ^vcl_[0-9A-HJKMNP-TV-Z]{26}$
          example: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
        name: vehicleId
        in: path
        required: true
    get:
      tags:
        - Vehicles
      summary: Historical Vehicle Stats
      description: List historical stats and logs about the vehicle.
      operationId: listHistoricalVehicleStats
      parameters:
        - name: X-Application-Id
          in: header
          required: false
          description: >-
            Scopes the request to a Terminal application in the caller's
            organization. Required for multi-application organizations when
            using a user session or OAuth access token. API keys are already
            bound to a single application.
          schema:
            type: string
        - name: Connection-Token
          in: header
          required: true
          schema:
            type: string
            example: con_tkn_22vUhkC6tgre4kwaYfUkCDA1rzn6eyb4
            pattern: ^con_tkn_\S+$
          description: >-
            The token returned when a user authenticated their account. This
            authorizes access to a specific account.
        - name: cursor
          in: query
          schema:
            type: string
            format: cursor
            example: cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw
          description: Pagination cursor to start requests from
        - name: limit
          in: query
          required: false
          schema:
            type: integer
          description: The maximum number of results to return in a page.
        - schema:
            type: string
            enum:
              - vehicle
          in: query
          name: expand
          description: Expand resources in the returned response
        - name: startAt
          in: query
          required: false
          schema:
            type: string
            format: date-time
            example: '2021-01-06T03:24:53.000Z'
          description: Timestamp to start from - defaults to beginning of history
        - name: endAt
          in: query
          required: false
          schema:
            type: string
            format: date-time
            example: '2021-01-06T03:24:53.000Z'
          description: Timestamp to end at - defaults to now
        - schema:
            type: string
            example: odometer,engine_state,fuel_level,total_fuel_consumption
          in: query
          name: types
          description: Comma separated list of vehicle stats to filter for
          required: false
        - name: raw
          in: query
          required: false
          schema:
            type: boolean
          description: >-
            Include raw responses used to normalize model. Used for debugging or
            accessing unique properties that are not unified.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      x-model-category: historical
                      title: Vehicle Stat Log
                      type: object
                      properties:
                        id:
                          title: VehicleStatLogId
                          type: string
                          format: ulid
                          example: vcl_st_01D8ZQFGHVJ858NBF2Q7DV9MNC
                        sourceId:
                          title: SourceId
                          type: string
                          example: '123456789'
                          description: >-
                            The ID used to represent the entity in the source
                            system.
                        provider:
                          title: Provider Code
                          type: string
                          example: geotab
                          description: >-
                            Every provider has a unique code to identify it
                            across Terminal's system. You can find each
                            provider's code under [provider
                            details](/providers).
                        type:
                          type: string
                        timestamp:
                          title: ISODateTime
                          type: string
                          format: date-time
                          example: '2021-01-06T03:24:53.000Z'
                          description: '[ISO 8601](https://www.w3.org/TR/NOTE-datetime) date'
                        vehicle:
                          description: Reference to the vehicle the event is about
                          example: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          oneOf:
                            - title: VehicleId
                              description: Unique identifier for the vehicle in Terminal.
                              type: string
                              format: ulid
                              pattern: ^vcl_[0-9A-HJKMNP-TV-Z]{26}$
                              example: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                            - title: Expanded Vehicle
                              type: object
                              properties:
                                id:
                                  title: VehicleId
                                  description: >-
                                    Unique identifier for the vehicle in
                                    Terminal.
                                  type: string
                                  format: ulid
                                  pattern: ^vcl_[0-9A-HJKMNP-TV-Z]{26}$
                                  example: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                              required:
                                - id
                        metadata:
                          title: TimeSeriesMetadata
                          type: object
                          description: Internal metadata about the time series.
                          required:
                            - modifiedAt
                          properties:
                            modifiedAt:
                              title: ModifiedAt
                              type: string
                              format: date-time
                              description: >-
                                The date and time the record was last updated in
                                Terminal. Note: this is not the date and time
                                the record was updated in the provider's system.
                        raw:
                          title: RawDataList
                          type: array
                          example: []
                          items:
                            title: RawData
                            type: object
                            properties:
                              provider:
                                type: string
                              schema:
                                type: string
                              extractedAt:
                                type: string
                              data:
                                type: object
                            required:
                              - provider
                              - schema
                              - extractedAt
                              - data
                      required:
                        - id
                        - provider
                        - type
                        - timestamp
                        - vehicle
                        - metadata
                      discriminator:
                        propertyName: type
                      oneOf:
                        - title: Engine State Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_state
                            state:
                              type: string
                              enum:
                                - 'on'
                                - 'off'
                                - idle
                          required:
                            - type
                            - state
                        - title: Odometer Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: odometer
                            odometer:
                              title: Distance In Kilometers
                              type: number
                              description: Distance in kilometers
                              example: 100
                          required:
                            - type
                            - odometer
                        - title: Total Fuel Consumption Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: total_fuel_consumption
                            fuelConsumed:
                              title: Volume In Liters
                              type: number
                              description: Volume in liters rounded to 2 decimal places.
                              example: 95.33
                          required:
                            - type
                            - fuelConsumed
                        - title: Fuel Level Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: fuel_level
                            fuelPercentage:
                              title: Fuel Percentage
                              type: number
                              example: 50
                              minimum: 0
                              maximum: 100
                              description: >-
                                The percentage value of how much fuel is left in
                                the tank.
                          required:
                            - type
                            - fuelPercentage
                        - title: Engine Runtime Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_runtime
                            duration:
                              title: DurationInMS
                              type: integer
                              example: 0
                              description: Duration in MS
                          required:
                            - type
                            - duration
                        - title: Engine Oil Percentage Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_oil_percentage
                            percentage:
                              title: Percentage
                              type: number
                              description: >-
                                Percentage value between 0 and 100, rounded to 2
                                decimal places.
                              example: 85
                              minimum: 0
                              maximum: 100
                          required:
                            - type
                            - percentage
                        - title: Engine Oil Pressure Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_oil_pressure
                            pressure:
                              title: Pressure In PSI
                              type: number
                              description: >-
                                Pressure in PSI (Pounds per Square Inch) rounded
                                to 2 decimal places.
                              example: 45.2
                          required:
                            - type
                            - pressure
                        - title: Engine Oil Temperature Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_oil_temperature
                            temperature:
                              title: Temperature In Celsius
                              type: number
                              description: >-
                                Temperature in Celsius rounded to 2 decimal
                                places.
                              example: 95.33
                          required:
                            - type
                            - temperature
                        - title: Engine Coolant Temperature Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_coolant_temperature
                            temperature:
                              title: Temperature In Celsius
                              type: number
                              description: >-
                                Temperature in Celsius rounded to 2 decimal
                                places.
                              example: 95.33
                          required:
                            - type
                            - temperature
                        - title: Coolant Percentage Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: coolant_percentage
                            percentage:
                              title: Percentage
                              type: number
                              description: >-
                                Percentage value between 0 and 100, rounded to 2
                                decimal places.
                              example: 85
                              minimum: 0
                              maximum: 100
                          required:
                            - type
                            - percentage
                        - title: Engine RPM Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: engine_rpm
                            rpm:
                              title: RPM
                              type: number
                              description: >-
                                Engine RPM (Revolutions Per Minute) rounded to 2
                                decimal places.
                              example: 2500
                          required:
                            - type
                            - rpm
                        - title: Battery Voltage Log
                          type: object
                          properties:
                            type:
                              type: string
                              const: battery_voltage
                            voltage:
                              title: Voltage In Volts
                              type: number
                              description: Voltage in volts rounded to 2 decimal places.
                              example: 12.5
                          required:
                            - type
                            - voltage
                      example:
                        - id: vcl_st_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          sourceId: '123456789'
                          provider: geotab
                          type: engine_state
                          timestamp: '2021-01-06T03:24:53.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          state: 'on'
                          metadata:
                            modifiedAt: '2021-01-06T03:24:53.000Z'
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M2D
                          sourceId: '987654321'
                          provider: geotab
                          type: odometer
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          odometer: 230843
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3E
                          sourceId: '987654322'
                          provider: geotab
                          type: engine_runtime
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          duration: 1234.5
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3F
                          sourceId: '987654323'
                          provider: geotab
                          type: engine_oil_percentage
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          percentage: 85
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3G
                          sourceId: '987654324'
                          provider: geotab
                          type: engine_oil_pressure
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          pressure: 45.2
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3H
                          sourceId: '987654325'
                          provider: geotab
                          type: engine_oil_temperature
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          temperature: 95
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3I
                          sourceId: '987654326'
                          provider: geotab
                          type: engine_coolant_temperature
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          temperature: 90
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3J
                          sourceId: '987654327'
                          provider: geotab
                          type: coolant_percentage
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          percentage: 75
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3K
                          sourceId: '987654328'
                          provider: geotab
                          type: engine_rpm
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          rpm: 2500
                          raw: []
                        - id: vcl_st_01D8ZQFGHVJ8584BF2Q7D29M3L
                          sourceId: '987654329'
                          provider: geotab
                          type: battery_voltage
                          timestamp: '2021-01-06T04:34:52.000Z'
                          vehicle: vcl_01D8ZQFGHVJ858NBF2Q7DV9MNC
                          voltage: 12.5
                          raw: []
                      x-description: >-
                        A point-in-time record of stats and logs for a specific
                        vehicle.
                  next:
                    title: Pagination Cursor
                    type: string
                    example: cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw
                    description: Cursor used for pagination.
                    format: cursor
                required:
                  - results
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - bad_request
                  message:
                    type: string
                    example: Invalid request body
                  detail:
                    type: array
                    items:
                      title: ErrorPathDetail
                      type: object
                      properties:
                        message:
                          type: string
                          example: '''vehicleId'' property must be a valid ulid'
                        path:
                          type: string
                          example: '{requestQuery}.vehicleId'
                        suggestion:
                          type: string
                          example: >-
                            Please ensure you submit a valid 'vehicleId'
                            property
                        context:
                          type: object
                      required:
                        - message
                        - path
                required:
                  - code
                  - message
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - unauthorized
                  message:
                    type: string
                    example: Unauthorized Request
                  detail:
                    type: string
                    example: Please ensure you have a valid API key
                required:
                  - code
                  - message
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - forbidden
                  message:
                    type: string
                    example: Forbidden Request
                  detail:
                    type: string
                    example: >-
                      Please ensure the connection token matches the resource
                      you are attempting to access.
                required:
                  - code
                  - message
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - not_found
                  message:
                    type: string
                    example: Resource not found
                  detail:
                    type: string
                    example: 'Could not find resource with ID: 2342342'
                required:
                  - code
                  - message
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                properties:
                  code:
                    enum:
                      - too_many_requests
                  retryAfter:
                    description: The number of seconds to wait before retrying the request
                    type: integer
                    example: 60
                  message:
                    type: string
                    example: Too Many Requests
                  detail:
                    type: string
                    example: You have exceeded your rate limit. Please try again later.
                required:
                  - code
                  - message
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - internal_server_error
                  message:
                    type: string
                    example: Internal Server Error
                  detail:
                    type: string
                    example: Something went wrong
                required:
                  - code
                  - message
        '504':
          description: Gateway Timeout Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    enum:
                      - gateway_timeout
                  message:
                    type: string
                    example: Gateway Timeout
                required:
                  - code
                  - message
components:
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````