{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset to Executive Report",
    "description": "Turn structured JSON, CSV, or Apify dataset rows into deterministic executive summaries, KPI rollups, anomalies, recommendations, and Markdown report artifacts.",
    "version": "1.0",
    "x-build-id": "kIh12ROy8XXliGAfl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/junipr~dataset-to-executive-report/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-junipr-dataset-to-executive-report",
        "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/junipr~dataset-to-executive-report/runs": {
      "post": {
        "operationId": "runs-sync-junipr-dataset-to-executive-report",
        "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/junipr~dataset-to-executive-report/run-sync": {
      "post": {
        "operationId": "run-sync-junipr-dataset-to-executive-report",
        "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": {
          "records": {
            "title": "Inline JSON Records",
            "type": "array",
            "description": "Structured object rows to summarize. Leave the default sample for a tiny zero-config run, or replace with rows from your dataset.",
            "items": {
              "type": "object"
            },
            "default": [
              {
                "month": "2026-04",
                "region": "North America",
                "segment": "Enterprise",
                "revenue": 184000,
                "previousRevenue": 166000,
                "pipeline": 312000,
                "activeCustomers": 38,
                "conversionRate": 0.18,
                "churnRisk": 0.06
              },
              {
                "month": "2026-04",
                "region": "North America",
                "segment": "SMB",
                "revenue": 62000,
                "previousRevenue": 71000,
                "pipeline": 92000,
                "activeCustomers": 116,
                "conversionRate": 0.12,
                "churnRisk": 0.14
              },
              {
                "month": "2026-04",
                "region": "EMEA",
                "segment": "Enterprise",
                "revenue": 128000,
                "previousRevenue": 121000,
                "pipeline": 206000,
                "activeCustomers": 24,
                "conversionRate": 0.16,
                "churnRisk": 0.08
              },
              {
                "month": "2026-04",
                "region": "EMEA",
                "segment": "SMB",
                "revenue": 44000,
                "previousRevenue": 58000,
                "pipeline": 63000,
                "activeCustomers": 82,
                "conversionRate": 0.09,
                "churnRisk": 0.19
              },
              {
                "month": "2026-04",
                "region": "APAC",
                "segment": "Enterprise",
                "revenue": 71000,
                "previousRevenue": 52000,
                "pipeline": 142000,
                "activeCustomers": 17,
                "conversionRate": 0.21,
                "churnRisk": 0.05
              }
            ]
          },
          "csvText": {
            "title": "CSV Text",
            "type": "string",
            "description": "Optional CSV-like input with a header row. If provided, CSV Text is used instead of Inline JSON Records.",
            "default": ""
          },
          "datasetId": {
            "title": "Apify Dataset ID",
            "type": "string",
            "description": "Optional Apify dataset ID to read. If provided, the actor reads from this dataset instead of inline rows or CSV text.",
            "default": ""
          },
          "reportTitle": {
            "title": "Report Title",
            "type": "string",
            "description": "Title used for the dataset row and Markdown report artifact.",
            "default": "Monthly Revenue Executive Brief"
          },
          "reportContext": {
            "title": "Report Context",
            "type": "string",
            "description": "Optional business context for your own tracking. It is accepted as metadata but the report remains deterministic.",
            "default": ""
          },
          "audience": {
            "title": "Audience",
            "enum": [
              "executive",
              "operator",
              "sales",
              "investor",
              "board"
            ],
            "type": "string",
            "description": "Target audience label for your workflow. The deterministic report format does not call an LLM.",
            "default": "executive"
          },
          "groupBy": {
            "title": "Group By Fields",
            "type": "array",
            "description": "Top-level fields used for group rollups. Leave blank to infer common dimensions such as region and segment.",
            "items": {
              "type": "string"
            },
            "default": [
              "region",
              "segment"
            ]
          },
          "metrics": {
            "title": "Metrics",
            "type": "array",
            "description": "Metric definitions for KPI rollups. If omitted, numeric fields are inferred. Supported aggregations: sum, average, count, min, max.",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "title": "Field",
                  "description": "Source row field name used for this metric.",
                  "type": "string"
                },
                "label": {
                  "title": "Label",
                  "description": "Human-readable metric label in the generated report.",
                  "type": "string"
                },
                "aggregation": {
                  "title": "Aggregation",
                  "description": "Aggregation method used for this metric.",
                  "type": "string",
                  "enum": [
                    "sum",
                    "average",
                    "count",
                    "min",
                    "max"
                  ]
                },
                "format": {
                  "title": "Format",
                  "description": "Display format for the metric value.",
                  "type": "string",
                  "enum": [
                    "number",
                    "currency",
                    "percent"
                  ]
                },
                "target": {
                  "title": "Target",
                  "description": "Optional target value used for gap and status calculations.",
                  "type": "number"
                },
                "previousField": {
                  "title": "Previous Field",
                  "description": "Optional source row field containing the prior-period value.",
                  "type": "string"
                },
                "goodDirection": {
                  "title": "Good Direction",
                  "description": "Whether higher, lower, or neutral movement is preferable.",
                  "type": "string",
                  "enum": [
                    "up",
                    "down",
                    "neutral"
                  ]
                },
                "precision": {
                  "title": "Precision",
                  "description": "Decimal places used when formatting this metric.",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 4
                }
              }
            },
            "default": [
              {
                "field": "revenue",
                "label": "Revenue",
                "aggregation": "sum",
                "format": "currency",
                "target": 500000,
                "previousField": "previousRevenue",
                "goodDirection": "up"
              },
              {
                "field": "pipeline",
                "label": "Pipeline",
                "aggregation": "sum",
                "format": "currency",
                "goodDirection": "up"
              },
              {
                "field": "activeCustomers",
                "label": "Active Customers",
                "aggregation": "sum",
                "format": "number",
                "goodDirection": "up"
              },
              {
                "field": "conversionRate",
                "label": "Conversion Rate",
                "aggregation": "average",
                "format": "percent",
                "target": 0.15,
                "goodDirection": "up"
              },
              {
                "field": "churnRisk",
                "label": "Churn Risk",
                "aggregation": "average",
                "format": "percent",
                "target": 0.1,
                "goodDirection": "down"
              }
            ]
          },
          "maxItems": {
            "title": "Maximum Rows",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum source rows to process. Defaults low so the prefilled run finishes quickly and cheaply.",
            "default": 50
          },
          "topGroups": {
            "title": "Top Groups",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum number of ranked group rollups to include.",
            "default": 8
          },
          "anomalyThresholdPct": {
            "title": "Anomaly Threshold",
            "minimum": 0.05,
            "maximum": 100,
            "type": "number",
            "description": "Relative change threshold for anomaly detection. Use 0.25 for 25%, or 25 for 25%.",
            "default": 0.25
          },
          "includeReport": {
            "title": "Write Report Artifacts",
            "type": "boolean",
            "description": "Store Markdown and JSON report artifacts in the default key-value store after row-processing charges succeed.",
            "default": true
          },
          "llmMode": {
            "title": "LLM Mode",
            "enum": [
              "off"
            ],
            "type": "string",
            "description": "Reserved for a future optional LLM enhancement. This actor does not call external LLM APIs and only supports off.",
            "default": "off"
          },
          "maxChargeUsd": {
            "title": "Maximum Charge (USD)",
            "minimum": 0,
            "maximum": 1000,
            "type": "number",
            "description": "Hard local spending cap for actor-start, per-item, and report events. The actor stops before work or withholds uncharged output when the next event would exceed this amount.",
            "default": 10
          },
          "dryRun": {
            "title": "Dry Run",
            "type": "boolean",
            "description": "Validate input and write a dry-run summary without PPE charges or dataset output.",
            "default": false
          },
          "debug": {
            "title": "Debug Logging",
            "type": "boolean",
            "description": "Enable additional logs for troubleshooting parsing and metric decisions.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}