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

# Calculate Risk Score



## OpenAPI

````yaml post /v1/risk-score/ppa-garaging
openapi: 3.1.0
info:
  title: Vehicle Crashes API
  summary: 'This is the documentation for the Matrisk Data API. '
  version: 1.0.0
servers: []
security: []
tags:
  - name: Aggregated Crashes
    description: >-
      Provides aggregated crash data to support risk analysis and scoring
      models.
  - name: CA Garaging Risk Score
    description: >-
      Risk score derived from the garaging location of **commercial auto** (CA)
      vehicles. Helps evaluate potential risks based on where vehicles are
      stored or parked.
  - name: CA Telematics Risk Score
    description: >-
      Risk score generated using telematics data from **commercial auto**
      vehicles.
  - name: PPA Garaging Risk Score
    description: >-
      Risk score based on the garaging location of **personal passenger auto**
      (PPA) vehicles, assessing the safety and risk factors associated with
      where the vehicle is kept.
  - name: PPA Telematics Risk Score
    description: >-
      Risk score based on telematics data from **personal passenger auto** (PPA)
      vehicles.
  - name: API Key
    description: >-
      Operations related to managing API keys for authentication and
      authorization purposes.
paths:
  /v1/risk-score/ppa-garaging:
    post:
      tags:
        - PPA Garaging Risk Score
      summary: Calculate Risk Score
      operationId: calculate_garaging_ppa_risk_score
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PPA_GaragingRiskScoreRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PPA_GaragingRiskScoreResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PPA_GaragingRiskScoreRequest:
      properties:
        version:
          type: string
          enum:
            - v1
            - v2
          title: Version
          description: Version of the risk scoring model used.
          default: v2
        policy_holder_id:
          type: string
          title: Policy Holder Id
          description: Unique identifier for the policyholder.
          examples:
            - policy-holder-123
        effective_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Effective Date
          description: >-
            Start date of the policy. Defaults to the current date and time
            unless overridden, typically for backtesting. Will not pull in data
            after this date.
        vehicles:
          items:
            $ref: >-
              #/components/schemas/src__app__schemas__client__garaging_ppa__VehicleGaragingData
          type: array
          maxItems: 50
          minItems: 1
          title: Vehicles
          description: >-
            List of vehicles with their garaging locations. Max 50 vehicles per
            request.
      type: object
      required:
        - policy_holder_id
        - vehicles
      title: PPA_GaragingRiskScoreRequest
    PPA_GaragingRiskScoreResponse:
      properties:
        job_type:
          type: string
          const: ppa-garaging-risk-score
          title: Job Type
          description: Type of job that was run.
          default: ppa-garaging-risk-score
          examples:
            - ppa-garaging-risk-score
        policy_holder_id:
          type: string
          title: Policy Holder Id
          description: Unique identifier for the policyholder.
          examples:
            - policy-holder-123
        version:
          type: string
          enum:
            - v1
            - v2
          title: Version
          description: Version of the risk scoring model used.
          default: v2
          examples:
            - v1
            - v2
        vehicle_risk_scores:
          items:
            $ref: '#/components/schemas/PPA_VehicleGaragingRiskScore'
          type: array
          title: Vehicle Risk Scores
          description: Risk scores for each vehicle based on their garaging locations.
        errors:
          items:
            $ref: '#/components/schemas/PPA_VehicleGaragingRiskScoreError'
          type: array
          title: Errors
          description: Any vehicles that could not be scored.
          examples:
            - null
      type: object
      required:
        - policy_holder_id
        - vehicle_risk_scores
        - errors
      title: PPA_GaragingRiskScoreResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    src__app__schemas__client__garaging_ppa__VehicleGaragingData:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
          description: Unique identifier for the vehicle.
          examples:
            - vehicle-123
        body_type:
          anyOf:
            - $ref: '#/components/schemas/VehicleType'
            - type: 'null'
          description: >-
            Vehicle body type classification following the [MMUCC V13 Motor
            Vehicle Body Type
            standards](https://www.nhtsa.gov/traffic-records/model-minimum-uniform-crash-criteria).
            Used to more accurately assess risk based on vehicle
            characteristics.
          examples:
            - passenger-car
        garaging_location:
          anyOf:
            - $ref: '#/components/schemas/LocationGPS'
            - $ref: '#/components/schemas/LocationAddress'
            - $ref: '#/components/schemas/LocationStructuredAddress'
          title: Garaging Location
          description: >-
            Location where the vehicle is primarily garaged. Can be a GPS
            coordinate or an address.
      type: object
      required:
        - vehicle_id
        - garaging_location
      title: VehicleGaragingData
    PPA_VehicleGaragingRiskScore:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
          description: Unique identifier for the vehicle.
          examples:
            - vehicle-123
        vehicle_risk_score:
          type: number
          maximum: 1
          minimum: 0
          title: Vehicle Risk Score
          description: >-
            Risk score for the vehicle based on garaging location. Ranges from 0
            to 1 with higher scores indicating higher risk.
          examples:
            - 0.621
        metadata:
          $ref: '#/components/schemas/PPA_GaragingMetadata'
          description: Garaging metadata providing context for the risk score.
          examples:
            - coverage:
                - usstate: OH
                  years:
                    - 2020
                    - 2021
                    - 2022
                    - 2023
              effective_date: '2020-01-01T00:00:00'
              garaging_location:
                latitude: 39.9526
                longitude: -95.96728
                urbanicity: rural
                usstate: OH
      type: object
      required:
        - vehicle_id
        - vehicle_risk_score
        - metadata
      title: PPA_VehicleGaragingRiskScore
    PPA_VehicleGaragingRiskScoreError:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
          description: Unique identifier for the vehicle.
        effective_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Effective Date
          description: Effective date of the policy.
          examples:
            - '2020-01-01T00:00:00'
        usstate:
          anyOf:
            - $ref: '#/components/schemas/USState'
            - type: 'null'
          description: U.S. state.
          examples:
            - OH
            - MI
            - ID
        error_reason:
          type: string
          title: Error Reason
          description: Explanation why this vehicle's score could not be computed.
      type: object
      required:
        - vehicle_id
        - effective_date
        - error_reason
      title: PPA_VehicleGaragingRiskScoreError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    VehicleType:
      type: string
      enum:
        - passenger-car
        - sport-utility-vehicle
        - minivan-or-van
        - motor-home-or-recreational-vehicle
        - limousine
        - passenger-van
        - school-bus
        - transit-bus
        - motorcoach
        - other-large-passenger-or-bus
        - cargo-van
        - pickup-truck
        - single-unit-truck-2-axles
        - single-unit-truck-3-axles
        - truck-tractor
        - truck-unknown-type
        - construction-equipment
        - farm-equipment
        - all-terrain-vehicle
        - golf-cart
        - snowmobile
        - multipurpose-off-highway-vehicle
        - low-speed-vehicle
        - moped
        - two-wheeled-motorcycle
        - three-wheeled-motorcycle
        - autocycle
        - other
        - unknown
      title: VehicleType
      description: 'MMUCC Guideline: "V13. Motor Vehicle Body Type Category"'
    LocationGPS:
      properties:
        latitude:
          type: number
          maximum: 49.384358
          minimum: 24.396308
          title: Latitude
          description: >-
            Latitude range limited to Continental U.S. boundaries (24.396308°N
            to 49.384358°N). Uses the World Geodetic System 1984 (WGS84)
            coordinate system.
        longitude:
          type: number
          maximum: -66.93457
          minimum: -125
          title: Longitude
          description: >-
            Longitude range limited to Continental U.S. boundaries (-125.0°W to
            -66.93457°W). Uses the World Geodetic System 1984 (WGS84) coordinate
            system.
      type: object
      required:
        - latitude
        - longitude
      title: GPS Coordinates
    LocationAddress:
      properties:
        address:
          type: string
          minLength: 5
          title: Address
          description: A valid address to geocode. Minimum length of 5 characters.
      type: object
      required:
        - address
      title: Address
    LocationStructuredAddress:
      properties:
        street:
          type: string
          minLength: 5
          title: Street
          description: Street name and number.
        city:
          type: string
          minLength: 2
          title: City
          description: City name.
        state:
          type: string
          title: State
          description: State abbreviation.
        postal_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Postal Code
          description: 5 or 9 digit ZIP code.
      type: object
      required:
        - street
        - city
        - state
        - postal_code
      title: Structured Address
    PPA_GaragingMetadata:
      properties:
        effective_date:
          type: string
          format: date-time
          title: Effective Date
          description: Effective date of the policy.
          examples:
            - '2020-01-01T00:00:00'
        garaging_location:
          $ref: '#/components/schemas/GaragingLocationMetadata'
          description: Metadata about the garaging location.
          examples:
            - geocoding_confidence: high
              latitude: 39.9526
              longitude: -95.96728
              urbanicity: rural
              usstate: OH
        coverage:
          items:
            $ref: '#/components/schemas/RiskScoreCoverage'
          type: array
          title: Coverage
          description: >-
            List of U.S. states and years of data used to calculate the risk
            score.
          examples:
            - usstate: OH
              years:
                - 2020
                - 2021
            - usstate: MI
              years:
                - 2022
      type: object
      required:
        - effective_date
        - garaging_location
        - coverage
      title: PPA_GaragingMetadata
    USState:
      type: string
      enum:
        - AL
        - AK
        - AZ
        - AR
        - CA
        - CO
        - CT
        - DE
        - DC
        - FL
        - GA
        - HI
        - ID
        - IL
        - IN
        - IA
        - KS
        - KY
        - LA
        - ME
        - MD
        - MA
        - MI
        - MN
        - MS
        - MO
        - MT
        - NE
        - NV
        - NH
        - NJ
        - NM
        - NY
        - NC
        - ND
        - OH
        - OK
        - OR
        - PA
        - RI
        - SC
        - SD
        - TN
        - TX
        - UT
        - VT
        - VA
        - WA
        - WV
        - WI
        - WY
      title: USState
    GaragingLocationMetadata:
      properties:
        latitude:
          type: number
          title: Latitude
          description: Latitude of the garaging location.
          examples:
            - 39.9526
        longitude:
          type: number
          title: Longitude
          description: Longitude of the garaging location.
          examples:
            - -95.96728
        geocoding_confidence:
          anyOf:
            - type: string
              enum:
                - high
                - medium
                - low
            - type: 'null'
          title: Geocoding Confidence
          description: >-
            Geocoding confidence of the garaging location. Only returned if the
            garaging location was geocoded.
          examples:
            - high
            - medium
            - low
        usstate:
          $ref: '#/components/schemas/USState'
          description: U.S. state.
          examples:
            - OH
            - MI
            - ID
        urbanicity:
          type: string
          enum:
            - sparse-rural
            - rural
            - exurban
            - low-density-suburban
            - suburban
            - dense-suburban
            - urban
            - urban-core
            - dense-urban
            - very-dense-urban
          title: Urbanicity
          description: Urbanicity of the garaging location.
          examples:
            - rural
            - suburban
            - urban
      type: object
      required:
        - latitude
        - longitude
        - usstate
        - urbanicity
      title: GaragingLocationMetadata
    RiskScoreCoverage:
      properties:
        usstate:
          $ref: '#/components/schemas/USState'
          description: U.S. state.
          examples:
            - OH
            - MI
            - ID
        years:
          items:
            type: integer
          type: array
          title: Years
          description: Years of data used to calculate the risk score.
          examples:
            - - 2020
              - 2021
            - - 2022
      type: object
      required:
        - usstate
        - years
      title: Risk Score Coverage
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````