{
  "openapi": "3.0.1",
  "info": {
    "title": "Federal Register Digest | Agency Rule & Notice Monitor",
    "description": "Monitor Federal Register documents — rules, proposed rules, and notices — per configured agency feed. Summary-first output with signal tagging, watch-term alerts, and deduplication across recurring runs.",
    "version": "0.1",
    "x-build-id": "2TrxfkB6xnqHjxTBd"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/taroyamada~federal-register-digest/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-taroyamada-federal-register-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~federal-register-digest/runs": {
      "post": {
        "operationId": "runs-sync-taroyamada-federal-register-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~federal-register-digest/run-sync": {
      "post": {
        "operationId": "run-sync-taroyamada-federal-register-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": "Feeds to monitor (required)",
            "type": "array",
            "description": "One entry per agency/topic watch target. Each feed produces one summary digest row. Set agencySlug and documentTypes to narrow the stream; add keywords for keyword filtering.",
            "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"
                },
                "agencySlug": {
                  "title": "Agency slug (primary)",
                  "description": "Federal Register agency identifier, e.g. environmental-protection-agency. Find slugs at federalregister.gov/agencies.",
                  "type": "string"
                },
                "agencySlugs": {
                  "title": "Additional agency slugs",
                  "description": "Comma-separated list of extra agency slugs to include in this feed.",
                  "type": "string"
                },
                "documentTypes": {
                  "title": "Document types",
                  "description": "Comma-separated list of document types to include: RULE, PRORULE, NOTICE, PRESDOCU. Leave empty for all types.",
                  "type": "string"
                },
                "keywords": {
                  "title": "Keywords",
                  "description": "Comma-separated keywords to filter documents by title/abstract content.",
                  "type": "string"
                },
                "lookbackDays": {
                  "title": "Feed-specific lookback window (days)",
                  "description": "Override the global lookbackDays for this individual feed.",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 365
                }
              }
            }
          },
          "watchTerms": {
            "title": "Watch terms (comma-separated)",
            "type": "string",
            "description": "Keywords, company names, or regulatory topics to flag in document titles and abstracts. Matching documents receive a watch_term_hit signal tag."
          },
          "lookbackDays": {
            "title": "Global lookback window (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Fetch documents published within this many days. Use 7–14 for recurring scheduled runs; widen to 30+ for initial discovery.",
            "default": 7
          },
          "maxDocsPerFeed": {
            "title": "Max documents per feed",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Upper bound on documents fetched per feed per run. Increase for broad discovery; keep low (50) for fast recurring digest runs.",
            "default": 50
          },
          "maxPagesPerFeed": {
            "title": "Max API pages per feed",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Hard page cap per feed to prevent runaway pagination. Each page fetches up to 100 documents.",
            "default": 5
          },
          "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 the 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 watch-term hits. new_only emits only feeds with documents not seen in the previous run.",
            "default": "all"
          },
          "snapshotKey": {
            "title": "Snapshot key for recurring state",
            "type": "string",
            "description": "Stable key used to persist seen document numbers across recurring runs so new_only and action_needed modes stay comparable. Use the same key across scheduled runs.",
            "default": "federal-register-digest-state"
          },
          "federalRegisterApiUrl": {
            "title": "Federal Register API URL",
            "type": "string",
            "description": "Federal Register documents endpoint. No authentication required.",
            "default": "https://www.federalregister.gov/api/v1/documents.json"
          },
          "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 documents found",
            "type": "boolean",
            "description": "When true, every feed always produces a digest row even if no new documents were found. When false, feeds with no new documents are omitted from the output.",
            "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."
          },
          "fixturePath": {
            "title": "Fixture file path (testing)",
            "type": "string",
            "description": "Local JSON fixture for offline tests. When set, all feeds use this file instead of the live API."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}