{
  "openapi": "3.0.1",
  "info": {
    "title": "NHTSA Vehicle Complaints & Defect Investigations Feed",
    "description": "Early-warning feed of NHTSA vehicle safety data: newest owner defect complaints across all makes (crash, fire, injury flags, component, narrative) plus ODI defect investigations (PE, EA, RQ, DP) opened or closed. Filters, complaint clusters, new-since-last-run alerts.",
    "version": "0.1",
    "x-build-id": "Tgm7nhRIVPRrcON3k"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/moment-data~nhtsa-complaints-investigations-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-moment-data-nhtsa-complaints-investigations-feed",
        "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/moment-data~nhtsa-complaints-investigations-feed/runs": {
      "post": {
        "operationId": "runs-sync-moment-data-nhtsa-complaints-investigations-feed",
        "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/moment-data~nhtsa-complaints-investigations-feed/run-sync": {
      "post": {
        "operationId": "run-sync-moment-data-nhtsa-complaints-investigations-feed",
        "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",
        "properties": {
          "dataTypes": {
            "title": "Data types",
            "type": "array",
            "description": "Owner complaints (ODI consumer complaints) and/or NHTSA defect investigations (Preliminary Evaluations, Engineering Analyses, Recall Queries, Defect Petitions...). Default: both.",
            "items": {
              "type": "string",
              "enum": [
                "complaints",
                "investigations"
              ],
              "enumTitles": [
                "Consumer complaints (all makes)",
                "Defect investigations (ODI)"
              ]
            },
            "default": [
              "complaints",
              "investigations"
            ]
          },
          "makes": {
            "title": "Makes",
            "type": "array",
            "description": "Optional. Vehicle/equipment makes, e.g. TESLA, FORD, HONDA, MICHELIN. Empty = all makes.",
            "items": {
              "type": "string"
            }
          },
          "models": {
            "title": "Models",
            "type": "array",
            "description": "Optional. Model text, matched as a substring: 'MODEL Y' matches 'MODEL Y RWD'; 'F-150' matches 'F-150 LIGHTNING'.",
            "items": {
              "type": "string"
            }
          },
          "modelYears": {
            "title": "Model years",
            "type": "array",
            "description": "Optional. e.g. 2023, 2024. Empty = all model years.",
            "items": {
              "type": "string"
            }
          },
          "componentKeyword": {
            "title": "Component keyword",
            "type": "string",
            "description": "Optional. Only records whose NHTSA component (or investigation subject) contains this text, e.g. 'AIR BAG', 'BRAKES', 'STEERING', 'FUEL', 'ELECTRICAL', 'AUTOMATIC EMERGENCY BRAKING'."
          },
          "crashOrInjuryOnly": {
            "title": "Only crash / fire / injury / death complaints",
            "type": "boolean",
            "description": "Keep only complaints that report a crash, a fire, injuries or deaths. Investigations are not affected.",
            "default": false
          },
          "receivedWithinDays": {
            "title": "Complaints received within (days)",
            "minimum": 1,
            "maximum": 730,
            "type": "integer",
            "description": "Complaints received by NHTSA in the last N days (by date received).",
            "default": 30
          },
          "investigationsWithinDays": {
            "title": "Investigations opened/closed within (days)",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Investigations opened or closed in the last N days. NHTSA opens or closes roughly 5-15 per month.",
            "default": 60
          },
          "maxItems": {
            "title": "Max records per run",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Hard cap on delivered records (also caps your spend). Newest first; when both types are selected, investigations get up to half.",
            "default": 40
          },
          "vehicleHistory": {
            "title": "Full complaint history for specific vehicles (API)",
            "type": "boolean",
            "description": "Instead of recent complaints, pull ALL complaints ever filed for the given makes + model years (+ models) from api.nhtsa.gov. Requires makes and modelYears; ignores 'received within'.",
            "default": false
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "window",
              "sinceLastRun"
            ],
            "type": "string",
            "description": "window (default): everything in the time window, no saved state. sinceLastRun: only complaints/investigations not delivered before for this State key (investigation closures are delivered again as a new event). Use for schedules and alerts.",
            "default": "window"
          },
          "stateKey": {
            "title": "State key",
            "type": "string",
            "description": "Name of the saved feed for sinceLastRun mode. Use one key per schedule.",
            "default": "default"
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}