{
  "openapi": "3.0.1",
  "info": {
    "title": "CFPB Complaint Spike & Emerging-Issue Monitor",
    "description": "Detect recurring complaint spikes and emerging product–issue patterns with lag-aware baselines and persistent alerts. Unofficial Blaidlink tool; not affiliated with or endorsed by the CFPB or U.S. government.",
    "version": "0.1",
    "x-build-id": "UfYGTi5gKTbCuUWSF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/blaidlink~cfpb-complaint-spike-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-blaidlink-cfpb-complaint-spike-monitor",
        "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/blaidlink~cfpb-complaint-spike-monitor/runs": {
      "post": {
        "operationId": "runs-sync-blaidlink-cfpb-complaint-spike-monitor",
        "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/blaidlink~cfpb-complaint-spike-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-blaidlink-cfpb-complaint-spike-monitor",
        "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": {
          "products": {
            "title": "Products",
            "type": "array",
            "description": "Optional exact CFPB product labels. Leave blank for all products.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "issues": {
            "title": "Issues",
            "type": "array",
            "description": "Optional exact CFPB issue labels. Leave blank for all issues.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "companies": {
            "title": "Companies",
            "type": "array",
            "description": "Optional exact public company labels from the CFPB database.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "States",
            "type": "array",
            "description": "Optional two-letter state abbreviations.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searchTerm": {
            "title": "Search term",
            "type": "string",
            "description": "Optional term searched by the official CFPB API.",
            "default": ""
          },
          "searchField": {
            "title": "Search field",
            "enum": [
              "all",
              "complaint_what_happened"
            ],
            "type": "string",
            "description": "Search across all supported fields or only published narratives.",
            "default": "all"
          },
          "hasNarrative": {
            "title": "Narrative filter",
            "enum": [
              "",
              "yes",
              "no"
            ],
            "type": "string",
            "description": "Include all complaints or require the presence or absence of a published narrative. Narratives are never emitted by this Actor.",
            "default": ""
          },
          "dimensions": {
            "title": "Spike dimensions",
            "type": "array",
            "description": "Aggregate dimensions screened for composition-adjusted spikes.",
            "items": {
              "type": "string",
              "enum": [
                "product",
                "issue",
                "company"
              ]
            },
            "default": [
              "product",
              "issue",
              "company"
            ]
          },
          "reportingLagDays": {
            "title": "Reporting lag",
            "minimum": 0,
            "maximum": 90,
            "type": "integer",
            "description": "Most recent days excluded because CFPB warns that recent complaint publication is incomplete.",
            "default": 16
          },
          "currentWindowDays": {
            "title": "Current comparison window",
            "minimum": 2,
            "maximum": 31,
            "type": "integer",
            "description": "Number of lagged days whose complaint rate is evaluated for acceleration.",
            "default": 7
          },
          "baselineWindowDays": {
            "title": "Baseline window",
            "minimum": 7,
            "maximum": 180,
            "type": "integer",
            "description": "Number of immediately preceding days used to estimate the baseline rate.",
            "default": 28
          },
          "minCurrentCount": {
            "title": "Minimum current complaints",
            "minimum": 2,
            "type": "integer",
            "description": "Minimum CFPB-reported aggregate complaints in a category before it can produce a spike signal.",
            "default": 20
          },
          "minRateRatio": {
            "title": "Minimum daily-rate ratio",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Required current daily rate divided by the baseline daily rate.",
            "default": 1.75
          },
          "minShareRatio": {
            "title": "Minimum composition-share ratio",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Prevents a broad ingestion surge from flagging every category equally.",
            "default": 1.2
          },
          "minZScore": {
            "title": "Minimum z-score",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Required Poisson-style standardized difference between observed and expected current counts.",
            "default": 3
          },
          "maxAlerts": {
            "title": "Maximum signals per run",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Hard cap on signal and resolution records emitted to this run's dataset. All qualifying active signals remain tracked in state.",
            "default": 25
          },
          "sampleSize": {
            "title": "Cluster candidate sample",
            "minimum": 10,
            "maximum": 100,
            "type": "integer",
            "description": "Recent complaint records inspected only to propose product-issue combinations; narratives are never emitted.",
            "default": 100
          },
          "maxClusterCandidates": {
            "title": "Maximum exact cluster checks",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum sampled product-issue candidates confirmed through exact current and baseline queries.",
            "default": 5
          },
          "minClusterSampleOccurrences": {
            "title": "Minimum sample occurrences",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Minimum occurrences in the bounded recent-record sample before a product-issue pair receives exact confirmation queries.",
            "default": 2
          },
          "minClusterCurrentCount": {
            "title": "Minimum exact cluster count",
            "minimum": 2,
            "type": "integer",
            "description": "Minimum exact current-window complaints required for an emerging product-issue signal.",
            "default": 10
          },
          "maxClusterBaselineCount": {
            "title": "Low-baseline cluster ceiling",
            "minimum": 0,
            "type": "integer",
            "description": "A baseline count at or below this value qualifies as low prior volume when other gates pass.",
            "default": 5
          },
          "minClusterRateRatio": {
            "title": "Minimum cluster rate ratio",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Required current-to-baseline daily-rate ratio for an accelerating cluster above the low-baseline ceiling.",
            "default": 3
          },
          "minClusterShareRatio": {
            "title": "Minimum cluster share ratio",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Required current-to-baseline complaint-share ratio for an accelerating cluster.",
            "default": 1.5
          },
          "emitResolved": {
            "title": "Emit resolved signals",
            "type": "boolean",
            "description": "Emit a resolution when a previously active signal no longer clears its thresholds.",
            "default": true
          },
          "resetState": {
            "title": "Reset this monitor's alert state",
            "type": "boolean",
            "description": "Forget prior active signals for this exact filter/window scope before evaluating the run.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}