{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Charts & Report (Chart Images + PDF from Any Data)",
    "description": "Turns any Apify dataset, CSV/Excel/JSON file URL or JSON array into chart images (bar, line, area, pie, scatter as PNG and SVG) and an optional PDF or HTML report with KPIs and a plain-English summary. Define charts by field names. Charged per chart and per report; agent-ready via x402 and MCP.",
    "version": "0.1",
    "x-build-id": "2QMNnpGxZRCLgix3x"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nerolabs~dataset-charts-report/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nerolabs-dataset-charts-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/nerolabs~dataset-charts-report/runs": {
      "post": {
        "operationId": "runs-sync-nerolabs-dataset-charts-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/nerolabs~dataset-charts-report/run-sync": {
      "post": {
        "operationId": "run-sync-nerolabs-dataset-charts-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",
        "required": [
          "charts"
        ],
        "properties": {
          "datasetId": {
            "title": "Dataset to chart",
            "type": "string",
            "description": "Pick an existing Apify dataset (for example the output of any scraper run). Use this OR 'File URL' OR 'Data (inline)' below. Declaring it this way lets the Actor run with limited permissions: it may read the dataset you point at and nothing else on your account."
          },
          "fileUrl": {
            "title": "File URL (CSV, Excel, JSON or JSON Lines)",
            "type": "string",
            "description": "Instead of a dataset, download the rows from a public link: a CSV or TSV file, an Excel .xlsx file (first sheet, header row), a JSON array or JSON Lines file, or a Google Sheet (paste the normal sheet link with sharing set to 'Anyone with the link can view'). Format detected automatically. Up to 100 MB."
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "tsv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Only needed if automatic detection gets the file URL's format wrong.",
            "default": "auto"
          },
          "data": {
            "title": "Data (inline)",
            "type": "array",
            "description": "A JSON array of records to chart, for ad-hoc data instead of a dataset ID or file URL."
          },
          "maxRows": {
            "title": "Maximum rows to load",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "A cost and memory guard. Rows beyond this are not loaded. Hard ceiling 50,000 per run.",
            "default": 5000
          },
          "charts": {
            "title": "Charts to draw",
            "type": "array",
            "description": "A JSON list of charts, up to 20. Each: {\"type\": bar | horizontalBar | stackedBar | line | area | pie | donut | scatter, \"title\", \"x\": field, \"y\": field (omit to count rows), \"series\": field to split into colours, \"aggregate\": sum | count | mean | median | min | max | distinct, \"sort\": desc | asc | x, \"limit\": top N categories (the rest become 'Other'), \"timeUnit\": auto | day | week | month | quarter | year, \"xTitle\", \"yTitle\", \"color\": hex, \"yFormat\": d3 format like ',.0f' or '$,.2f'}. Only 'x' is required."
          },
          "width": {
            "title": "Chart width (px)",
            "minimum": 320,
            "maximum": 2000,
            "type": "integer",
            "description": "The drawing area width. The PNG is rendered at this width times 'PNG scale'.",
            "default": 800
          },
          "height": {
            "title": "Chart height (px)",
            "minimum": 200,
            "maximum": 1400,
            "type": "integer",
            "description": "The drawing area height.",
            "default": 450
          },
          "theme": {
            "title": "Theme",
            "enum": [
              "light",
              "dark"
            ],
            "type": "string",
            "description": "Light (white background) or dark (near-black background) charts and HTML report.",
            "default": "light"
          },
          "accentColor": {
            "title": "Accent colour",
            "type": "string",
            "description": "Hex colour for single-series charts, e.g. #2a78d6. Multi-series charts use a fixed 10-colour palette. A chart's own 'color' overrides this."
          },
          "imageFormats": {
            "title": "Image formats",
            "uniqueItems": true,
            "type": "array",
            "description": "PNG (default, for Slack, email, docs and slides) and/or SVG (crisp at any size, editable).",
            "items": {
              "type": "string",
              "enum": [
                "png",
                "svg"
              ],
              "enumTitles": [
                "PNG",
                "SVG"
              ]
            }
          },
          "scale": {
            "title": "PNG scale",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "1 = the chart width in pixels, 2 = twice that (sharp on retina screens, the default), 3 = print quality.",
            "default": 2
          },
          "generateReport": {
            "title": "Generate a report",
            "type": "boolean",
            "description": "On (default): build the report in the formats below. Off: charts only.",
            "default": true
          },
          "reportTitle": {
            "title": "Report title",
            "type": "string",
            "description": "Shown at the top of the report. Defaults to the first chart's title or 'Data report'."
          },
          "reportSubtitle": {
            "title": "Report subtitle",
            "type": "string",
            "description": "Optional second line, for example the client name or the period covered."
          },
          "reportFormats": {
            "title": "Report formats",
            "uniqueItems": true,
            "type": "array",
            "description": "PDF (A4, ready to send) and/or HTML (a single self-contained page with crisp SVG charts, good for sharing a link or printing).",
            "items": {
              "type": "string",
              "enum": [
                "pdf",
                "html"
              ],
              "enumTitles": [
                "PDF",
                "HTML"
              ]
            }
          },
          "tableRows": {
            "title": "Data preview rows in the report",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "How many of the first rows to show in the report's data table (up to 7 columns, the charted fields first). 0 hides the table.",
            "default": 15
          },
          "aiSummary": {
            "title": "Add a plain-English summary (AI)",
            "type": "boolean",
            "description": "Off by default. On: a model writes 3 to 6 sentences from the KPIs and chart values only, never from the raw rows, and never invents numbers. The model tokens (about $0.002 per report on the default model) are billed to your Apify account through Apify's official OpenRouter proxy; no API key is needed. Free Apify plans pay 10x the token rate.",
            "default": false
          },
          "aiModel": {
            "title": "Summary model",
            "enum": [
              "anthropic/claude-haiku-4.5",
              "anthropic/claude-sonnet-4.5",
              "openai/gpt-4.1-mini",
              "google/gemini-2.5-flash",
              "deepseek/deepseek-v3.2"
            ],
            "type": "string",
            "description": "Any OpenRouter model id. Claude Haiku 4.5 is the default and is plenty for a summary.",
            "default": "anthropic/claude-haiku-4.5"
          },
          "summaryInstructions": {
            "title": "Summary instructions (optional)",
            "type": "string",
            "description": "Extra guidance for the summary: the audience, the language to write in, what to focus on."
          },
          "webhookUrl": {
            "title": "Webhook URL (optional)",
            "type": "string",
            "description": "Optional. If set, the chart and report links, KPIs and captions are POSTed here as JSON the moment the run finishes. Works with a Zapier/Make/n8n catch-hook, your own API, or a Slack incoming webhook. Only charged on a confirmed HTTP 2xx; a failed delivery is a warning and costs nothing."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}