{
  "openapi": "3.0.1",
  "info": {
    "title": "HTML to JSON Smart Parser — Pages, Tables & Links",
    "description": "Convert HTML to JSON from URLs, pasted HTML or files: headings, links, tables, JSON-LD and custom fields. No API key needed. USD 3 per 1,000 records.",
    "version": "1.0",
    "x-build-id": "fRYyVKHrwe78a7Hd6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/muhammadafzal~html-to-json-smart-parser/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-muhammadafzal-html-to-json-smart-parser",
        "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/muhammadafzal~html-to-json-smart-parser/runs": {
      "post": {
        "operationId": "runs-sync-muhammadafzal-html-to-json-smart-parser",
        "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/muhammadafzal~html-to-json-smart-parser/run-sync": {
      "post": {
        "operationId": "run-sync-muhammadafzal-html-to-json-smart-parser",
        "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": {
          "startUrls": {
            "title": "Page URLs",
            "type": "array",
            "description": "Web page URLs to fetch and parse into JSON. Use this when the user provides specific pages (products, articles, listings, documents). Each URL is fetched and parsed; one structured JSON record is returned per page. Leave empty if pasting HTML or uploading files.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "htmlContent": {
            "title": "HTML Content (Paste)",
            "type": "string",
            "description": "Raw HTML to convert to JSON, pasted directly into this field. Use this when the HTML is not publicly reachable (emails, local files, authenticated pages). Takes precedence over nothing — it is processed in addition to any URLs. Leave empty if using URLs or file URLs."
          },
          "htmlFileUrls": {
            "title": "HTML File URLs",
            "type": "array",
            "description": "URLs of HTML files to fetch and parse (e.g., exported HTML archives or static files). You can upload files in the Apify Console using the file upload button, or provide direct download URLs. Leave empty if using page URLs or pasted HTML.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "fieldsToExtract": {
            "title": "Fields to Extract",
            "type": "string",
            "description": "Comma-separated list of custom fields to pull out of the HTML, e.g. 'title, price, author, availability'. Each field is extracted heuristically using common selectors (itemprop, meta tags, data attributes, class names). Leave empty to auto-detect all important fields. AI mode uses these names as the extraction contract.",
            "default": ""
          },
          "outputSchema": {
            "title": "Output JSON Schema (AI Mode)",
            "type": "string",
            "description": "A JSON schema or sample object that the AI should return in AI mode, e.g. {\"title\": \"string\", \"price\": \"number\", \"inStock\": \"boolean\"}. Only used in AI mode (mode 'ai', or 'auto' with your own API key). When set, the AI restructures the page into exactly this shape. Ignored in heuristic mode.",
            "default": ""
          },
          "mode": {
            "title": "Extraction Mode",
            "enum": [
              "auto",
              "heuristic",
              "ai"
            ],
            "type": "string",
            "description": "How to extract data. 'auto' uses AI when you provide your own API key, otherwise the rule-based engine. 'heuristic' always uses the fast rule-based engine. 'ai' always calls the AI model to restructure the page into your fieldsToExtract or outputSchema; it requires your API key, and without one the run is rejected with no charge.",
            "default": "auto"
          },
          "openaiApiKey": {
            "title": "OpenAI API Key (Optional)",
            "type": "string",
            "description": "Your own API key for the provider named in this field's title, used only in AI mode ('ai', or 'auto' when a key is present). Without it, extraction is rule-based. Model usage is billed to your key by its provider. The key is stored as a secret and never returned in results."
          },
          "model": {
            "title": "AI Model",
            "enum": [
              "standard",
              "advanced"
            ],
            "type": "string",
            "description": "AI model tier used in AI mode. 'standard' is fast with low token cost and suits most pages; 'advanced' handles complex or ambiguous documents at a higher token cost to your key.",
            "default": "standard"
          },
          "systemPrompt": {
            "title": "System Prompt (Optional)",
            "type": "string",
            "description": "Custom instructions that override the default AI extraction prompt. Use to add domain rules (e.g. 'extract prices in EUR only', 'normalize dates to YYYY-MM-DD'). Only used in AI mode. Leave empty to use the smart default prompt.",
            "default": ""
          },
          "maxContentChars": {
            "title": "Max Content Characters (AI Mode)",
            "minimum": 1000,
            "maximum": 60000,
            "type": "integer",
            "description": "How much of the page text to send to the AI model in AI mode. Larger pages are truncated to this limit to control token cost. Heuristic mode ignores this.",
            "default": 20000
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of JSON records to produce across all sources (cost control). One record is produced per URL, pasted HTML block, or HTML file.",
            "default": 100
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}