{
  "openapi": "3.0.1",
  "info": {
    "title": "Grants.gov Funding Digest | Opportunity Watch & Signal Digest",
    "description": "Monitor Grants.gov funding opportunities by agency, category, keyword, and instrument — one summary digest row per configured feed, no API key required.",
    "version": "0.1",
    "x-build-id": "bbwIyNCmKDy9iRE1r"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/taroyamada~grants-gov-funding-digest/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-taroyamada-grants-gov-funding-digest",
        "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/taroyamada~grants-gov-funding-digest/runs": {
      "post": {
        "operationId": "runs-sync-taroyamada-grants-gov-funding-digest",
        "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/taroyamada~grants-gov-funding-digest/run-sync": {
      "post": {
        "operationId": "run-sync-taroyamada-grants-gov-funding-digest",
        "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": [
          "feeds"
        ],
        "properties": {
          "feeds": {
            "title": "Funding feeds to monitor (required)",
            "type": "array",
            "description": "One entry per watch target. Each feed produces one digest row. At minimum, set id, name, and at least one filter (agencies, fundingCategories, or keyword). No API key required.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "title": "Feed ID",
                  "description": "Stable identifier used in snapshots and output rows.",
                  "type": "string"
                },
                "name": {
                  "title": "Feed name",
                  "description": "Human-readable label for this feed in the digest output.",
                  "type": "string"
                },
                "keyword": {
                  "title": "Keyword",
                  "description": "Free-text keyword to search in opportunity title and synopsis.",
                  "type": "string"
                },
                "agencies": {
                  "title": "Agency codes (pipe-separated)",
                  "description": "One or more agency codes separated by | e.g. DOD|HHS. Narrows results to specific awarding agencies.",
                  "type": "string"
                },
                "fundingCategories": {
                  "title": "Funding category codes (pipe-separated)",
                  "description": "Pipe-separated category codes e.g. ST|EN|HL. See Grants.gov category reference.",
                  "type": "string"
                },
                "fundingInstruments": {
                  "title": "Funding instrument codes (pipe-separated)",
                  "description": "G=Grant, CA=Cooperative Agreement, PC=Procurement Contract, O=Other. e.g. G|CA.",
                  "type": "string"
                },
                "oppStatuses": {
                  "title": "Opportunity status filter (pipe-separated)",
                  "description": "forecasted|posted|closed|archived — default is posted for v1.",
                  "type": "string"
                },
                "minAwardCeiling": {
                  "title": "Minimum award ceiling (USD)",
                  "description": "Feed-specific minimum award ceiling filter. Opportunities with awardCeiling below this are excluded.",
                  "type": "number"
                }
              }
            }
          },
          "watchTerms": {
            "title": "Watch terms — keywords to flag in opportunity titles and synopses (comma-separated)",
            "type": "string",
            "description": "Terms to flag in opportunity titles and synopses. Any opportunity matching a watch term receives a watch_term_hit signal tag and appears in the digest's watchTermHits section."
          },
          "lookbackDays": {
            "title": "Opportunity lookback window (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Include opportunities opened within this many days. Keep short (14–30) for recurring runs; widen for initial discovery.",
            "default": 14
          },
          "maxOpportunitiesPerFeed": {
            "title": "Max opportunities per feed",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Upper bound on opportunities fetched per feed per run.",
            "default": 50
          },
          "minAwardCeiling": {
            "title": "Global minimum award ceiling (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Skip opportunities with award ceiling below this value. Applied globally unless overridden per feed. Set 0 to include all.",
            "default": 0
          },
          "closingSoonDays": {
            "title": "Closing-soon threshold (days)",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "Opportunities closing within this many days receive a closing_soon signal tag.",
            "default": 14
          },
          "highValueThreshold": {
            "title": "High-value award ceiling threshold (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Opportunities with awardCeiling >= this value receive a high_value signal tag.",
            "default": 1000000
          },
          "delivery": {
            "title": "Delivery mode",
            "enum": [
              "dataset",
              "webhook"
            ],
            "type": "string",
            "description": "dataset stores results in the Apify dataset. webhook posts the digest JSON to webhookUrl.",
            "default": "dataset"
          },
          "webhookUrl": {
            "title": "Webhook URL (required when delivery=webhook)",
            "type": "string",
            "description": "POST target for funding digest payload. Leave empty for dataset delivery."
          },
          "datasetMode": {
            "title": "Dataset output mode",
            "enum": [
              "all",
              "action_needed",
              "new_only"
            ],
            "type": "string",
            "description": "all emits every feed digest row. action_needed emits only feeds with new or closing-soon opportunities. new_only emits only feeds with opportunities not seen in the previous run.",
            "default": "all"
          },
          "snapshotKey": {
            "title": "Snapshot key for recurring state",
            "type": "string",
            "description": "Stable key used to persist seen opportunity IDs across recurring runs.",
            "default": "grants-funding-digest-state"
          },
          "grantsGovApiUrl": {
            "title": "Grants.gov search2 API URL",
            "type": "string",
            "description": "Grants.gov legacy search2 endpoint. No API key required.",
            "default": "https://api.grants.gov/v1/api/search2"
          },
          "requestTimeoutSeconds": {
            "title": "HTTP request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for each API request.",
            "default": 30
          },
          "notifyOnNoNew": {
            "title": "Emit digest even when no new opportunities found",
            "type": "boolean",
            "description": "When true, every feed always produces a digest row even if no new opportunities were found.",
            "default": true
          },
          "dryRun": {
            "title": "Dry run (skip snapshot writes and webhook delivery)",
            "type": "boolean",
            "description": "Validate and fetch without persisting state or posting webhooks. Safe for testing input shapes.",
            "default": false
          },
          "nowIso": {
            "title": "Override current time (ISO string, for testing)",
            "type": "string",
            "description": "Set to a fixed ISO timestamp to make runs deterministic against fixture data."
          },
          "grantsGovFixturePath": {
            "title": "Grants.gov fixture file path (testing)",
            "type": "string",
            "description": "Local JSON fixture for offline Grants.gov tests."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}