{
  "openapi": "3.0.1",
  "info": {
    "title": "Federal Opportunity Feed",
    "description": "Federal contract and grant opportunities from SAM.gov and Grants.gov in one feed — duplicates removed, agency names cleaned up, who won similar work before, and what changed since you last checked. No SAM.gov key.",
    "version": "0.1",
    "x-build-id": "ieiJkjXZTS5KSTMgb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/publicrecords~govcon-opportunity-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-publicrecords-govcon-opportunity-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/publicrecords~govcon-opportunity-feed/runs": {
      "post": {
        "operationId": "runs-sync-publicrecords-govcon-opportunity-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/publicrecords~govcon-opportunity-feed/run-sync": {
      "post": {
        "operationId": "run-sync-publicrecords-govcon-opportunity-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "monitor",
              "snapshot",
              "enrich",
              "rehashState"
            ],
            "type": "string",
            "description": "monitor (default): only what changed since your last run with these filters — near-$0 on a quiet day; delta PPE only when something changes. snapshot: full matching set now (opt-in; can be ~$10 at default caps). enrich: snapshot plus category leaders. rehashState: rebuild monitor state hashes without emitting deltas (ops / hash migration; no PPE deltas).",
            "default": "monitor"
          },
          "sources": {
            "title": "Sources",
            "type": "array",
            "description": "Allowed values: sam, grants. SAM defaults to daily Data Services CSV (samBulk=true, no key). Grants.gov needs no key.",
            "items": {
              "type": "string"
            },
            "default": [
              "sam",
              "grants"
            ]
          },
          "samApiKey": {
            "title": "SAM.gov API key",
            "type": "string",
            "description": "Optional when samBulk=true. Required only for API enrich (resourceLinks) / monitor checks / samBulk=false. Personal public API key from sam.gov (Account Details → Request API Key). Free. Stored encrypted; never logged."
          },
          "naics": {
            "title": "NAICS codes",
            "type": "array",
            "description": "6-digit or prefix, e.g. 541512 or 5415.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "agencies": {
            "title": "Agencies",
            "type": "array",
            "description": "Names or codes, e.g. Department of Defense, DHS, EPA.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Free-text keywords matched against opportunity titles.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "setAside": {
            "title": "Set-aside types",
            "type": "array",
            "description": "SB, 8A, HUBZone, SDVOSB, WOSB, NONE",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "Place of performance states",
            "type": "array",
            "description": "Two-letter US state codes for place of performance (contracts).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "noticeTypes": {
            "title": "Notice types",
            "type": "array",
            "description": "Filter by notice type, e.g. solicitation, award_notice, grant_posted.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "postedWithinDays": {
            "title": "Posted within N days",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Only include opportunities posted within the last N days. Declared product default is **14 days** (Thursday product window). Schedules and Store listing align to 14d; raise if you need a longer lookback (PPE scales with matches).",
            "default": 14
          },
          "deadlineAfter": {
            "title": "Deadline after",
            "type": "string",
            "description": "Defaults to today; excludes expired opportunities."
          },
          "includeDescriptions": {
            "title": "Include full descriptions",
            "type": "boolean",
            "description": "When true, fetch full grant synopses (slower).",
            "default": false
          },
          "includeContacts": {
            "title": "Include official contacts",
            "type": "boolean",
            "description": "When true, include SAM point-of-contact fields.",
            "default": false
          },
          "enrichTopN": {
            "title": "Incumbents per opportunity (enrich mode)",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Category leaders (or predecessors) per opportunity in enrich mode.",
            "default": 5
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Hard cap on opportunity rows returned (and billed) after sort by postedDate desc → Sol#. Default 10000. Schema maximum 50000 so a buyer can opt into covering a full Active+14d/30d window (they pay PPE for what they take). Under the default 14d window, Active matches often exceed 10k — runs emit CAP_TRUNCATED + CAP_COVERAGE.covered/total (never silent). Cap always drops the oldest rows.",
            "default": 10000
          },
          "samBulk": {
            "title": "Use SAM Data Services daily CSV (bulk)",
            "type": "boolean",
            "description": "When true (default), download GSA's public daily Contract Opportunities CSV — no API quota. API key only needed for optional enrich (resourceLinks) and monitor checks within samEnrichLimit.",
            "default": true
          },
          "samEnrichLimit": {
            "title": "SAM API enrich budget",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "Max SAM Opportunities API calls per run for resourceLinks/description enrich and selective monitor checks. Keep ≤5–10 on a personal key (10/day with no Role).",
            "default": 5
          },
          "incumbentMode": {
            "title": "Enrich join mode",
            "enum": [
              "category_leaders",
              "predecessor"
            ],
            "type": "string",
            "description": "category_leaders (default): top USASpending recipients by agency×NAICS. predecessor: true prior-awardee/recompete join (stub until PREDECESSOR_JOIN.md ships). Proof schedules must keep default.",
            "default": "category_leaders"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}