{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Care Tender Monitor with CQC Matching",
    "description": "Track new UK care-sector tenders from Find a Tender and Contracts Finder, with optional CQC provider and location enrichment. Pay only for new or materially changed matches, apart from the platform start event.",
    "version": "0.1",
    "x-build-id": "3AV7eVEsCkeBtrPcp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/refreshing_outlook~uk-care-tender-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-refreshing_outlook-uk-care-tender-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/refreshing_outlook~uk-care-tender-monitor/runs": {
      "post": {
        "operationId": "runs-sync-refreshing_outlook-uk-care-tender-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/refreshing_outlook~uk-care-tender-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-refreshing_outlook-uk-care-tender-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": {
          "monitorMode": {
            "title": "Monitoring preset",
            "enum": [
              "general",
              "careHome"
            ],
            "type": "string",
            "description": "Defaults to general: health, social work and medical equipment. careHome uses social work CPV 8531, including residential care. Explicit CPV lists override each preset list independently.",
            "default": "general"
          },
          "sources": {
            "title": "Tender sources",
            "enum": [
              "fts",
              "contractsFinder",
              "both"
            ],
            "type": "string",
            "description": "Monitor both official OCDS APIs by default, or select Find a Tender or Contracts Finder.",
            "default": "both"
          },
          "stages": {
            "title": "Notice stages",
            "minItems": 1,
            "type": "array",
            "description": "Defaults to planning, tender and award. Allowed values: planning, tender, award. Select which stages to monitor; updates, amendments and cancellations of those stages also qualify.",
            "items": {
              "type": "string"
            },
            "default": [
              "planning",
              "tender",
              "award"
            ]
          },
          "cpvPrefixes": {
            "title": "Custom CPV include prefixes",
            "minItems": 1,
            "type": "array",
            "description": "Optional override: 2–8 digit prefixes. Omit for mode defaults: general [\"85\", \"331\"], careHome [\"8531\"]. An explicit list overrides the preset and must contain at least one prefix.",
            "items": {
              "type": "string"
            }
          },
          "cpvExcludePrefixes": {
            "title": "Custom CPV exclude prefixes",
            "type": "array",
            "description": "Optional override. Omit for mode defaults: general [\"852\"] (veterinary), careHome []. Supply [] to exclude nothing. A notice still matches if another CPV code is eligible.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Additional keywords",
            "type": "array",
            "description": "Defaults to no keyword filter. Case-insensitive substring matching across title, description and buyer; any keyword can match. Combined with CPV and other filters using AND, including in careHome mode.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "regions": {
            "title": "Buyer or delivery regions",
            "type": "array",
            "description": "Defaults to no region filter. Any supplied region/locality substring can match, case-insensitively. Notices with no location data fail this filter.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "minValue": {
            "title": "Minimum contract value (GBP)",
            "minimum": 0,
            "type": "number",
            "description": "Optional inclusive minimum. Unknown and non-GBP values pass."
          },
          "maxValue": {
            "title": "Maximum contract value (GBP)",
            "minimum": 0,
            "type": "number",
            "description": "Optional inclusive maximum. Unknown and non-GBP values pass."
          },
          "sinceLastRun": {
            "title": "Continue from last run",
            "type": "boolean",
            "description": "Enabled by default. Use each source checkpoint with a one-hour overlap; the first run looks back seven days unless a start date is supplied.",
            "default": true
          },
          "fullRefresh": {
            "title": "Refresh selected source history",
            "type": "boolean",
            "description": "Disabled by default. Ignore checkpoints and rebuild selected snapshots. Emitted keys remain to prevent repeat charges; supply a start date to backfill.",
            "default": false
          },
          "tagCqcHints": {
            "title": "Tag CQC hints",
            "type": "boolean",
            "description": "Local heuristics only; makes no CQC requests.",
            "default": true
          },
          "dateFrom": {
            "title": "Window start date",
            "type": "string",
            "description": "Optional ISO datetime with time zone. Used when no checkpoint applies; otherwise the checkpoint takes precedence. Defaults to seven days before the window end."
          },
          "dateTo": {
            "title": "Window end date",
            "type": "string",
            "description": "Optional ISO datetime with time zone; defaults to now. Supplying this field prevents checkpoint advancement."
          },
          "requestDelayMs": {
            "title": "Request delay (ms)",
            "minimum": 0,
            "maximum": 9007199254740991,
            "type": "integer",
            "description": "FTS minimum 10000; Contracts Finder minimum 500. Unset defaults to 10000/1000."
          },
          "maxRetryWaitSecs": {
            "title": "Maximum retry wait (seconds)",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "Defaults to 60 seconds per 429/5xx retry wait. Contracts Finder 403 waits are exempt within the six-minute retry window.",
            "default": 60
          },
          "maxPages": {
            "title": "Maximum pages per source",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Defaults to 50 per source and window, shared across Find a Tender stages. Reaching this before completion fails without advancing tender state; narrow the window.",
            "default": 50
          },
          "stateKey": {
            "title": "State key",
            "pattern": "^[A-Za-z0-9_-]{1,40}$",
            "type": "string",
            "description": "Local state namespace; use a separate namespace for different filters.",
            "default": "default"
          },
          "cqcApiKey": {
            "title": "CQC API key",
            "type": "string",
            "description": "Optional. Get a free subscription key at https://api-portal.service.cqc.org.uk/ . Used only for CQC provider and location enrichment. If omitted, the Actor uses CQC_API_KEY from the run environment when present; otherwise enrichment is skipped and tender monitoring continues. Never charged."
          },
          "enrichCqc": {
            "title": "Enrich with CQC candidates",
            "type": "boolean",
            "description": "Enabled by default. Match within resolved English local authorities only. Needs a CQC API key via the secret cqcApiKey input or CQC_API_KEY in the environment; missing key skips enrichment. Never charged.",
            "default": true
          },
          "cqcStrongMatchesOnly": {
            "title": "Keep only strong CQC dataset matches",
            "type": "boolean",
            "description": "Disabled by default: the dataset retains strong, possible and weak candidates with strength labels. Enable to remove non-strong matches after ranking and the three-match cap; tender rows still emit if no matches remain.",
            "default": false
          },
          "cqcRequestDelayMs": {
            "title": "CQC request delay (milliseconds)",
            "minimum": 0,
            "maximum": 9007199254740991,
            "type": "integer",
            "description": "Defaults to 300 milliseconds between CQC requests.",
            "default": 300
          },
          "cqcMaxDetailFetches": {
            "title": "Maximum CQC rating lookups",
            "minimum": 0,
            "maximum": 9007199254740991,
            "type": "integer",
            "description": "Defaults to 25 high-confidence rating detail requests per run; zero disables detail requests.",
            "default": 25
          },
          "includeWeakInDigest": {
            "title": "Include possible and weak CQC digest examples",
            "type": "boolean",
            "description": "Disabled by default: digest examples show strong matches only, while counts include every strength. Enable to include possible and weak examples too. Does not filter dataset rows or restore matches removed by cqcStrongMatchesOnly.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}