{
  "name": "favicon-extract",
  "summary": "Discovers a page's favicons and returns the best one decoded to a normalised PNG with its size.",
  "rationale": "It fans out over URLs a page author wrote and must decode several icon formats: an agent that does this itself walks past every SSRF control and becomes a request amplifier, and hand-rolling ICO/SVG decoding is not inline work.",
  "family": "images",
  "price_usd": "0.003",
  "free": false,
  "timeout_ms": 45000,
  "max_timeout_seconds": 66,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri",
        "description": "Absolute http(s) URL of the web page whose icon <link> tags (rel icon, shortcut, apple-touch-icon or mask-icon) are read, up to 2048 characters; /favicon.ico on its origin is added as a last candidate and icons are only fetched from the same registrable domain."
      }
    },
    "required": [
      "url"
    ],
    "additionalProperties": false
  },
  "input_example": {
    "url": "https://grist.tools/samples/web/fieldnotes/index.html"
  },
  "output_example": {
    "page_url": "https://grist.tools/samples/web/fieldnotes/index.html",
    "icons": [
      {
        "url": "https://grist.tools/samples/web/fieldnotes/icon-32.png",
        "rel": "icon",
        "type": "image/png",
        "sizes": "32x32"
      },
      {
        "url": "https://grist.tools/samples/web/fieldnotes/icon.svg",
        "rel": "icon",
        "type": "image/svg+xml",
        "sizes": null
      },
      {
        "url": "https://grist.tools/favicon.ico",
        "rel": "icon",
        "type": null,
        "sizes": null
      }
    ],
    "selected": {
      "url": "https://grist.tools/samples/web/fieldnotes/icon-32.png",
      "source_format": "png",
      "width": 32,
      "height": 32,
      "bytes": 106,
      "image_base64": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAACXBIWXMAAAsSAAALEgHS3X78AAAAMUlEQVRIx2PQjw2gKWIYtWDUgiFswaf3z0hCoxaMWjBqwagFoxYMTwtGq8xRC0aQBQBMN1tMlMrjbQAAAABJRU5ErkJggg=="
    }
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "unsupported_content_type",
    "too_large",
    "unprocessable",
    "internal"
  ]
}