{
  "openapi": "3.1.0",
  "info": {
    "title": "lossruns.claims: the loss run as a typed read surface",
    "version": "0.1.0-earlyaccess",
    "description": "EARLY ACCESS STUB. This spec documents the typed shape of the loss run and the operations planned over it. NO OPERATION IN THIS SPEC IS CALLABLE YET: every operation is tagged x-status roadmap. The schema components are the free, keyless reference content of lossruns.claims. Contact hello@api.insure for early access.",
    "contact": {
      "name": "api.insure estate",
      "email": "hello@api.insure",
      "url": "https://lossruns.claims"
    }
  },
  "servers": [
    {
      "url": "https://lossruns.claims",
      "description": "Serves this spec and the reference pages today. No API operation below is live; all are roadmap."
    }
  ],
  "paths": {
    "/schema": {
      "get": {
        "operationId": "getLossRunSchema",
        "summary": "Return the LossRun JSON Schema (ROADMAP, not yet callable)",
        "description": "ROADMAP. Not yet callable. Will return the canonical JSON Schema for the LossRun shape. Until then, the schema is published inline in this document under components.schemas.LossRun.",
        "x-status": "roadmap",
        "responses": {
          "200": {
            "description": "The LossRun schema.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LossRun"
                }
              }
            }
          }
        }
      }
    },
    "/parse": {
      "post": {
        "operationId": "parseLossRun",
        "summary": "Parse a loss run document into the typed schema (ROADMAP, not yet callable)",
        "description": "ROADMAP. Not yet callable. Will accept a loss run PDF or AL3 file and return the typed LossRun shape, normalized across carrier formats.",
        "x-status": "roadmap",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "document": {
                    "type": "string",
                    "format": "binary",
                    "description": "Loss run PDF or AL3 file."
                  }
                },
                "required": [
                  "document"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The parsed loss run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LossRun"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LossRun": {
        "type": "object",
        "description": "A carrier-issued claims-history report on a policy, valued as of valuation_date. A point-in-time snapshot: open claims can move after it.",
        "required": [
          "carrier",
          "insured",
          "policy_number",
          "term_start",
          "term_end",
          "valuation_date",
          "claims",
          "totals"
        ],
        "properties": {
          "carrier": {
            "type": "string",
            "description": "Issuing carrier. Authoritative only from the carrier that held the policy."
          },
          "insured": {
            "type": "string",
            "description": "Named insured on the policy."
          },
          "policy_number": {
            "type": "string"
          },
          "line_of_business": {
            "type": "string",
            "description": "e.g. commercial_property, general_liability, workers_comp."
          },
          "term_start": {
            "type": "string",
            "format": "date"
          },
          "term_end": {
            "type": "string",
            "format": "date"
          },
          "valuation_date": {
            "type": "string",
            "format": "date",
            "description": "The date every figure is true as of."
          },
          "claims": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LossRunClaim"
            }
          },
          "totals": {
            "$ref": "#/components/schemas/LossRunTotals"
          }
        }
      },
      "LossRunClaim": {
        "type": "object",
        "required": [
          "claim_number",
          "date_of_loss",
          "status",
          "paid",
          "reserved",
          "incurred"
        ],
        "properties": {
          "claim_number": {
            "type": "string",
            "description": "The carrier's claim identifier."
          },
          "date_of_loss": {
            "type": "string",
            "format": "date",
            "description": "Occurrence date, not report date."
          },
          "cause_of_loss": {
            "type": "string",
            "description": "Peril or cause code, e.g. wind_hail, water_damage, theft."
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "closed"
            ],
            "description": "Open means paid/reserved/incurred can still move. Closed with paid = 0 means closed without payment."
          },
          "paid": {
            "type": "number",
            "description": "USD actually issued to date on the claim."
          },
          "reserved": {
            "type": "number",
            "description": "The carrier's accounting estimate of what remains to pay. Carrier accounting, not a promise."
          },
          "incurred": {
            "type": "number",
            "description": "paid + reserved. The figure underwriting prices on."
          },
          "coverage": {
            "type": "string",
            "description": "Coverage part the figures fall under, when the carrier splits them."
          }
        }
      },
      "LossRunTotals": {
        "type": "object",
        "required": [
          "paid",
          "reserved",
          "incurred",
          "claim_count",
          "open_count"
        ],
        "properties": {
          "paid": {
            "type": "number"
          },
          "reserved": {
            "type": "number"
          },
          "incurred": {
            "type": "number"
          },
          "claim_count": {
            "type": "integer"
          },
          "open_count": {
            "type": "integer"
          }
        }
      }
    }
  }
}