{
  "openapi": "3.0.1",
  "info": {
    "title": "Tariff Trade Change Digest | Federal Register + HTS Monitor",
    "description": "Monitor U.S. tariff and trade changes with one summary-first digest row per configured topic. Combines Federal Register trade notices, USITC HTS releases/search/notices, and optional USTR RSS context.",
    "version": "0.1",
    "x-build-id": "sKvOE3nq4Y8PzaGju"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/taroyamada~tariff-trade-change-digest/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-taroyamada-tariff-trade-change-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~tariff-trade-change-digest/runs": {
      "post": {
        "operationId": "runs-sync-taroyamada-tariff-trade-change-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~tariff-trade-change-digest/run-sync": {
      "post": {
        "operationId": "run-sync-taroyamada-tariff-trade-change-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": [
          "topics"
        ],
        "properties": {
          "topics": {
            "title": "Topics / watchlists to monitor (required)",
            "type": "array",
            "description": "One entry = one digest row. Keep each topic narrow: one Federal Register query plus one focused HTS keyword and/or small HTS code set.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "title": "Topic ID",
                  "type": "string",
                  "description": "Stable identifier used in snapshots and output rows."
                },
                "name": {
                  "title": "Topic name",
                  "type": "string",
                  "description": "Human-readable label for this tariff/trade watchlist."
                },
                "description": {
                  "title": "Topic description",
                  "type": "string",
                  "description": "Optional internal note about why this topic matters."
                },
                "watchTerms": {
                  "title": "Topic watch terms",
                  "type": "string",
                  "description": "Comma-separated terms used for action-needed highlighting (e.g. section 301, chapter 99, additional duties)."
                },
                "useUstrContext": {
                  "title": "Include USTR RSS context",
                  "type": "boolean",
                  "description": "When true, relevant USTR RSS items are attached as context only. They do not replace Federal Register or HTS evidence.",
                  "default": false
                },
                "federalRegister": {
                  "title": "Federal Register query",
                  "type": "object",
                  "editor": "json",
                  "description": "Single Federal Register query for this topic. Keep it narrow and legally traceable.",
                  "properties": {
                    "agencySlug": {
                      "title": "Primary agency slug",
                      "type": "string",
                      "description": "Defaults to trade-representative-office-of-united-states."
                    },
                    "agencySlugs": {
                      "title": "Additional agency slugs",
                      "type": "string",
                      "description": "Comma-separated extra Federal Register agency slugs."
                    },
                    "documentTypes": {
                      "title": "Document types",
                      "type": "string",
                      "description": "Comma-separated types: NOTICE, RULE, PRORULE, PRESDOCU. Defaults to NOTICE."
                    },
                    "keywords": {
                      "title": "Federal Register keywords",
                      "type": "string",
                      "description": "Required comma-separated query keywords. Example: tariff, semiconductor, critical minerals."
                    },
                    "lookbackDays": {
                      "title": "Topic-specific lookback window",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 365,
                      "description": "Optional override for the global lookbackDays."
                    }
                  }
                },
                "hts": {
                  "title": "USITC HTS query",
                  "type": "object",
                  "editor": "json",
                  "description": "Focused HTS keyword and/or small code set for this topic.",
                  "properties": {
                    "searchTerm": {
                      "title": "HTS search term",
                      "type": "string",
                      "description": "Optional focused HTS keyword or chapter 99 code prefix such as 9903.88."
                    },
                    "htsCodes": {
                      "title": "Tracked HTS codes",
                      "type": "string",
                      "description": "Optional comma-separated exact HTS codes or prefixes. Keep the set small (ideally <= 8)."
                    },
                    "maxMatches": {
                      "title": "Max HTS matches in evidence",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100,
                      "description": "Upper bound on HTS items returned in the evidence payload."
                    }
                  }
                }
              }
            }
          },
          "watchTerms": {
            "title": "Global watch terms",
            "type": "string",
            "description": "Comma-separated terms added to every topic for highlighting notices and context."
          },
          "lookbackDays": {
            "title": "Global lookback window (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Default lookback for Federal Register and USTR context filtering.",
            "default": 7
          },
          "maxDocsPerTopic": {
            "title": "Max Federal Register docs per topic",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Upper bound on Federal Register documents returned for each topic.",
            "default": 20
          },
          "maxPagesPerTopic": {
            "title": "Max Federal Register API pages per topic",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Hard page cap for the Federal Register query. Keep low for recurring runs.",
            "default": 2
          },
          "maxHtsMatchesPerTopic": {
            "title": "Default max HTS matches per topic",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Default cap for HTS evidence rows when topic.hts.maxMatches is omitted.",
            "default": 15
          },
          "delivery": {
            "title": "Delivery mode",
            "enum": [
              "dataset",
              "webhook"
            ],
            "type": "string",
            "description": "dataset stores the digest JSON in the Apify dataset/local output. webhook posts the full payload to webhookUrl.",
            "default": "dataset"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Required only when delivery=webhook."
          },
          "datasetMode": {
            "title": "Dataset output mode",
            "enum": [
              "all",
              "action_needed",
              "changed_only"
            ],
            "type": "string",
            "description": "all emits every topic row. action_needed emits only action-needed rows. changed_only emits only topics with changes since the last run.",
            "default": "all"
          },
          "snapshotKey": {
            "title": "Snapshot key",
            "type": "string",
            "description": "Stable key used to persist seen Federal Register docs plus current HTS state across recurring runs.",
            "default": "tariff-trade-change-digest-state"
          },
          "federalRegisterApiUrl": {
            "title": "Federal Register API URL",
            "type": "string",
            "description": "Public Federal Register documents endpoint.",
            "default": "https://www.federalregister.gov/api/v1/documents.json"
          },
          "htsBaseUrl": {
            "title": "USITC HTS base URL",
            "type": "string",
            "description": "Public no-auth HTS REST base URL.",
            "default": "https://hts.usitc.gov/reststop/"
          },
          "ustrRssUrl": {
            "title": "USTR RSS URL",
            "type": "string",
            "description": "Optional context-only RSS feed. Default: https://ustr.gov/rss.xml",
            "default": "https://ustr.gov/rss.xml"
          },
          "includeUstrContext": {
            "title": "Enable USTR context for all topics",
            "type": "boolean",
            "description": "Global default for topic.useUstrContext.",
            "default": false
          },
          "requestTimeoutSeconds": {
            "title": "HTTP request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for each public-source HTTP request.",
            "default": 30
          },
          "notifyOnNoChange": {
            "title": "Emit rows even when no changes detected",
            "type": "boolean",
            "description": "When false, stable topics are omitted unless datasetMode requires them.",
            "default": true
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Skip snapshot writes and webhook delivery.",
            "default": false
          },
          "nowIso": {
            "title": "Override current time (testing)",
            "type": "string",
            "description": "ISO timestamp used for deterministic fixture tests."
          },
          "fixturePath": {
            "title": "Fixture file path (testing)",
            "type": "string",
            "description": "Local JSON fixture bundle for offline tests and proofs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}