{
  "openapi": "3.0.1",
  "info": {
    "title": "NHTSA Recall, Complaint & Safety Spike Monitor",
    "description": "Monitor official NHTSA data for new recalls, complaints, and statistically defined complaint spikes by vehicle or component. Get severity scores, crash/fire/injury/death signals, before/after context, and auditable spike math. Stateful baselines prevent historical records from appearing as new.",
    "version": "0.1",
    "x-build-id": "YrXkIrYRlEqUkrCQx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/johnatan029~nhtsa-safety-intelligence/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-johnatan029-nhtsa-safety-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/johnatan029~nhtsa-safety-intelligence/runs": {
      "post": {
        "operationId": "runs-sync-johnatan029-nhtsa-safety-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/johnatan029~nhtsa-safety-intelligence/run-sync": {
      "post": {
        "operationId": "run-sync-johnatan029-nhtsa-safety-intelligence",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "vehicles"
        ],
        "properties": {
          "vehicles": {
            "title": "Vehicles to monitor",
            "type": "array",
            "description": "One entry per vehicle: { make, model, modelYear }. Up to 50 per run. Use the exact NHTSA model name: \"f-150\" works, \"f150\" is rejected; \"silverado 1500\" works, \"silverado\" is rejected. See the README section \"Vehicle name spelling\" for the measured list."
          },
          "eventTypes": {
            "title": "Event types to emit",
            "type": "array",
            "description": "NEW_* need a previous run to compare against. SPIKE events work from the very first run.",
            "items": {
              "type": "string",
              "enum": [
                "NEW_RECALL",
                "NEW_COMPLAINT",
                "COMPLAINT_SPIKE",
                "COMPONENT_SPIKE"
              ]
            },
            "default": [
              "NEW_RECALL",
              "NEW_COMPLAINT",
              "COMPLAINT_SPIKE",
              "COMPONENT_SPIKE"
            ]
          },
          "recentWindowDays": {
            "title": "Recent window (days)",
            "minimum": 1,
            "maximum": 180,
            "type": "integer",
            "description": "How far back counts as recent when looking for a spike.",
            "default": 30
          },
          "baselineWindowDays": {
            "title": "Baseline window (days)",
            "minimum": 30,
            "maximum": 1825,
            "type": "integer",
            "description": "Reference period just before the recent window. Must be >= the recent window.",
            "default": 365
          },
          "spikeFactor": {
            "title": "Spike factor",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many times above the expected rate counts as a spike.",
            "default": 2
          },
          "minRecentComplaints": {
            "title": "Minimum recent complaints (vehicle)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Absolute floor. Prevents 1-vs-0.2 from being reported as a 5x spike.",
            "default": 5
          },
          "minComponentComplaints": {
            "title": "Minimum recent complaints (component)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Absolute floor per component, which is naturally smaller.",
            "default": 3
          },
          "minBaselineCount": {
            "title": "Minimum baseline complaints (vehicle)",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Without enough history there is no spike, only noise. No alert is emitted below this.",
            "default": 10
          },
          "minComponentBaselineCount": {
            "title": "Minimum baseline complaints (component)",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Same as the vehicle baseline floor, applied per component. Component counts are naturally smaller.",
            "default": 5
          },
          "maxComplaintsPerVehicle": {
            "title": "Max complaints per vehicle",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "A single popular model can have 800+ complaints. The baseline window needs enough of them to be meaningful.",
            "default": 500
          },
          "maxResults": {
            "title": "Max events per run",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on billable events. The run stops gracefully when reached.",
            "default": 1000
          },
          "maxRuntimeMs": {
            "title": "Max runtime (ms)",
            "minimum": 10000,
            "maximum": 3600000,
            "type": "integer",
            "description": "Hard time cap. The run stops gracefully and keeps what it already collected.",
            "default": 300000
          },
          "includeDistribution": {
            "title": "Include monthly distribution in the run summary",
            "type": "boolean",
            "description": "Useful to calibrate the spike thresholds against your own vehicles.",
            "default": false
          },
          "debug": {
            "title": "Verbose logs",
            "type": "boolean",
            "description": "Print extra diagnostics in the run log.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}