{
  "openapi": "3.0.1",
  "info": {
    "title": "NSQ Watch - CDSCO NSQ Drug Alerts & Batch Matcher",
    "description": "CDSCO NSQ, state NSQ and spurious drug lists as clean data. Match your pharmacy stock against flagged batches every day.",
    "version": "1.0",
    "x-build-id": "W6RTCmEK6w28CYxE8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/leons0016~cdsco-nsq-drug-alerts/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-leons0016-cdsco-nsq-drug-alerts",
        "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/leons0016~cdsco-nsq-drug-alerts/runs": {
      "post": {
        "operationId": "runs-sync-leons0016-cdsco-nsq-drug-alerts",
        "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/leons0016~cdsco-nsq-drug-alerts/run-sync": {
      "post": {
        "operationId": "run-sync-leons0016-cdsco-nsq-drug-alerts",
        "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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "match",
              "rows"
            ],
            "type": "string",
            "description": "Match checks your stock list against flagged batches. Rows delivers every new alert row as data, for example rows.",
            "default": "match"
          },
          "inventory": {
            "title": "Stock items (quick entry)",
            "maxItems": 500,
            "type": "array",
            "description": "One item per line: PRODUCT | BATCH: x | Mfr: y. Batch and Mfr are optional, for example Paracetamol Tablets IP 500 mg | BATCH: XYZ123 | Mfr: Example Pharma. For many items use the CSV link below.",
            "items": {
              "type": "string"
            }
          },
          "inventoryCsvUrl": {
            "title": "Stock list CSV (URL)",
            "pattern": "^https://.+",
            "type": "string",
            "description": "Link to a CSV file with a header row, for example https://example.org/stock.csv. Max 50,000 rows and 20 MB. Use a link nobody can guess, or a public record of an Apify key-value store."
          },
          "columnMap": {
            "title": "CSV column names",
            "type": "object",
            "description": "Map our field names to your CSV headers, for example {\"product\": \"Item Name\", \"batch\": \"Batch No\"}. Only product is required; common header names are recognised without this.",
            "default": {
              "product": "product",
              "batch": "batch",
              "manufacturer": "manufacturer",
              "expiry": "expiry",
              "sku": "sku",
              "location": "location",
              "quantity": "quantity"
            }
          },
          "lookbackMonths": {
            "title": "Check alerts from the last",
            "minimum": 0,
            "maximum": 24,
            "type": "integer",
            "description": "On the first run, and whenever stock items change, your items are checked against alerts of this many past months, for example 6.",
            "default": 6
          },
          "matchLevel": {
            "title": "Match level",
            "enum": [
              "batch",
              "product"
            ],
            "type": "string",
            "description": "Batch: the batch number must match. Product: also reports same product and maker with another batch, as a warning to check.",
            "default": "batch"
          },
          "minScore": {
            "title": "Minimum score",
            "minimum": 60,
            "maximum": 100,
            "type": "integer",
            "description": "Batch-level matches below this score are not reported, for example 80. Lower finds more, with more false alarms. 86 or more accepts only exact or letter/digit-confusion batch matches.",
            "default": 80
          },
          "alertTypes": {
            "title": "Alert types",
            "type": "array",
            "description": "Which lists to use, for example NSQ_STATE and SPURIOUS only.",
            "items": {
              "type": "string",
              "enum": [
                "NSQ_CENTRAL",
                "NSQ_STATE",
                "SPURIOUS",
                "RECALL_ALERT"
              ],
              "enumTitles": [
                "NSQ, CDSCO laboratories",
                "NSQ, state laboratories",
                "Spurious drugs",
                "Recall and ad hoc alerts"
              ]
            },
            "default": [
              "NSQ_CENTRAL",
              "NSQ_STATE",
              "SPURIOUS",
              "RECALL_ALERT"
            ]
          },
          "deliverAlertRows": {
            "title": "Also deliver new alert rows",
            "type": "boolean",
            "description": "Adds every new alert row to the results besides your matches. Charged per row. Always on in rows mode.",
            "default": false
          },
          "maxResultsPerRun": {
            "title": "Max results per run",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Largest number of matches and alert rows delivered in one run, for example 500. Protects your budget; the rest follows in the next run.",
            "default": 500
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "pattern": "^https://.+",
            "type": "string",
            "description": "Optional. The run summary and matches are sent here as JSON when the run ends, for example https://example.org/hook."
          },
          "slackWebhookUrl": {
            "title": "Slack webhook URL",
            "type": "string",
            "description": "Optional. A Slack incoming webhook; a short message with up to 10 matches is posted when the run ends."
          },
          "useSharedCache": {
            "title": "Use shared parsed-alert cache",
            "type": "boolean",
            "description": "Off by default. Reads alert rows from a shared parsed-alert cache when one is configured and fresh; otherwise the official sources are read directly.",
            "default": false
          },
          "includeLegacyPdfs": {
            "title": "Also read CDSCO PDF lists",
            "type": "boolean",
            "description": "Reads the PDF lists of the CDSCO Alerts page for months the CDSCO NSQ portal does not cover, and when the portal is down.",
            "default": true
          },
          "stateKey": {
            "title": "State key",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "type": "string",
            "description": "Optional name that ties runs together. Runs with the same key share what was already delivered, for example my-pharmacy. Saved Tasks use their own id."
          },
          "indexerMode": {
            "title": "Indexer mode",
            "type": "boolean",
            "description": "Publisher only.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}