{
  "openapi": "3.0.1",
  "info": {
    "title": "ReportGen - CSV Analytics to Branded PDF Reports",
    "description": "Drop a Google Analytics or Google Ads CSV export, get a branded PDF report with AI-written executive summary, KPI scorecard, charts, and recommendations. $0.20/report. BYOK — bring your own AI key from Anthropic, OpenAI, or Google.",
    "version": "0.1",
    "x-build-id": "1H8HuLOYflvbNKiYq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/milotools~reportgen/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-milotools-reportgen",
        "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/milotools~reportgen/runs": {
      "post": {
        "operationId": "runs-sync-milotools-reportgen",
        "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/milotools~reportgen/run-sync": {
      "post": {
        "operationId": "run-sync-milotools-reportgen",
        "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": {
          "demoMode": {
            "title": "Demo Mode",
            "type": "boolean",
            "description": "Generate a sample report with built-in fictional data — no CSV or API key required. Perfect for evaluating report quality before using your own data.",
            "default": true
          },
          "csvFile": {
            "title": "CSV File",
            "type": "string",
            "description": "URL to a CSV file (e.g., from Apify Key-Value Store) or base64-encoded CSV content."
          },
          "platform": {
            "title": "Analytics Platform",
            "enum": [
              "auto",
              "google_analytics",
              "google_ads",
              "search_console",
              "facebook_ads"
            ],
            "type": "string",
            "description": "The analytics platform that exported the CSV. Set to 'auto' to detect automatically from column headers.",
            "default": "auto"
          },
          "previousPeriodCsvFile": {
            "title": "Previous Period CSV (Optional)",
            "type": "string",
            "description": "URL or base64-encoded CSV for the previous period. Enables period-over-period comparison with delta indicators on KPIs and in AI narrative. Must be the same platform as the main CSV."
          },
          "clientName": {
            "title": "Client Name",
            "type": "string",
            "description": "The client or company name that appears on the report."
          },
          "reportTitle": {
            "title": "Report Title",
            "type": "string",
            "description": "Custom report title. Defaults to '[Client Name] Monthly Report'."
          },
          "reportingPeriod": {
            "title": "Reporting Period",
            "type": "string",
            "description": "The time period covered by this report, e.g., 'January 2026' or 'Q1 2026'."
          },
          "reportType": {
            "title": "Report Type",
            "enum": [
              "monthly",
              "weekly",
              "quarterly"
            ],
            "type": "string",
            "description": "The cadence of the report, which affects length and detail level.",
            "default": "monthly"
          },
          "primaryColor": {
            "title": "Primary Color",
            "type": "string",
            "description": "Hex color code for report branding (e.g., '#2563EB').",
            "default": "#2563EB"
          },
          "agencyName": {
            "title": "Agency Name",
            "type": "string",
            "description": "Your agency name, shown in the report header and footer."
          },
          "logoUrl": {
            "title": "Logo URL",
            "type": "string",
            "description": "URL to a logo image (PNG or SVG) to display on the cover page."
          },
          "narrativeInstructions": {
            "title": "Narrative Instructions",
            "type": "string",
            "description": "Custom instructions for the AI narrative, e.g., 'Emphasize organic growth' or 'Focus on cost efficiency'."
          },
          "narrativeProvider": {
            "title": "AI Provider",
            "enum": [
              "anthropic",
              "openai",
              "google"
            ],
            "type": "string",
            "description": "Which AI model to use for narrative generation. Anthropic (Claude) produces the best quality, OpenAI (GPT) is solid, Google (Gemini) is the cheapest.",
            "default": "anthropic"
          },
          "anthropicApiKey": {
            "title": "Anthropic API Key",
            "type": "string",
            "description": "Your Anthropic API key for narrative generation. Required if using Anthropic provider. Get one at console.anthropic.com."
          },
          "openaiApiKey": {
            "title": "OpenAI API Key",
            "type": "string",
            "description": "Your OpenAI API key for narrative generation. Required if using OpenAI provider. Get one at platform.openai.com."
          },
          "googleApiKey": {
            "title": "Google AI API Key",
            "type": "string",
            "description": "Your Google AI API key for narrative generation. Required if using Google provider. Get one at aistudio.google.com."
          },
          "recipientEmail": {
            "title": "Recipient Email",
            "type": "string",
            "description": "Email address to send the generated report to. Requires SMTP settings below."
          },
          "emailSubject": {
            "title": "Email Subject",
            "type": "string",
            "description": "Custom email subject line. Defaults to '[Report Title] — [Reporting Period]'."
          },
          "emailBody": {
            "title": "Email Body",
            "type": "string",
            "description": "Custom email body text. If not provided, a professional default template is used."
          },
          "smtpHost": {
            "title": "SMTP Host",
            "type": "string",
            "description": "SMTP server hostname (e.g., 'smtp.gmail.com', 'smtp.office365.com', 'email-smtp.us-east-1.amazonaws.com')."
          },
          "smtpPort": {
            "title": "SMTP Port",
            "type": "integer",
            "description": "SMTP server port. Common: 587 (STARTTLS), 465 (SSL). Default: 587.",
            "default": 587
          },
          "smtpUser": {
            "title": "SMTP Username",
            "type": "string",
            "description": "Username for SMTP authentication (often your email address)."
          },
          "smtpPassword": {
            "title": "SMTP Password",
            "type": "string",
            "description": "Password or app-specific password for SMTP authentication."
          },
          "senderEmail": {
            "title": "Sender Email",
            "type": "string",
            "description": "From address for emails. Defaults to SMTP username if not set."
          },
          "reports": {
            "title": "Batch Reports",
            "type": "array",
            "description": "Array of report configurations for batch processing. When provided, generates multiple branded PDF reports in a single run. API keys are shared across all reports. Maximum 50 reports per batch.",
            "items": {
              "type": "object",
              "properties": {
                "csvFile": {
                  "title": "CSV File",
                  "type": "string",
                  "description": "URL or base64-encoded CSV content for this report."
                },
                "previousPeriodCsvFile": {
                  "title": "Previous Period CSV",
                  "type": "string",
                  "description": "URL or base64-encoded previous period CSV for comparison."
                },
                "platform": {
                  "title": "Analytics Platform",
                  "type": "string",
                  "description": "Analytics platform (auto-detected if omitted).",
                  "default": "auto",
                  "enum": [
                    "auto",
                    "google_analytics",
                    "google_ads"
                  ]
                },
                "clientName": {
                  "title": "Client Name",
                  "type": "string",
                  "description": "Client name for this report."
                },
                "reportTitle": {
                  "title": "Report Title",
                  "type": "string",
                  "description": "Custom title (defaults to '[Client Name] Monthly Report')."
                },
                "reportingPeriod": {
                  "title": "Reporting Period",
                  "type": "string",
                  "description": "Time period covered, e.g. 'January 2026'."
                },
                "primaryColor": {
                  "title": "Primary Color",
                  "type": "string",
                  "description": "Hex color for branding (e.g. '#2563EB')."
                },
                "agencyName": {
                  "title": "Agency Name",
                  "type": "string",
                  "description": "Agency name for header/footer."
                },
                "logoUrl": {
                  "title": "Logo URL",
                  "type": "string",
                  "description": "URL to logo image."
                },
                "narrativeInstructions": {
                  "title": "Narrative Instructions",
                  "type": "string",
                  "description": "Custom AI narrative instructions for this report."
                },
                "recipientEmail": {
                  "title": "Recipient Email",
                  "type": "string",
                  "description": "Email address to send this report to (overrides top-level recipientEmail)."
                }
              },
              "required": [
                "csvFile",
                "clientName"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}