{
  "openapi": "3.1.1",
  "info": {
    "title": "Mandelbrot \u0026 Julia Deep Zoom Renderer API",
    "version": "1.0.0",
    "summary": "Render the Mandelbrot or a Julia set anywhere, down to zoom 10²⁵⁰ with perturbation theory.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://prooflinefractal.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Render the Mandelbrot or a Julia set anywhere, down to zoom 10²⁵⁰ with perturbation theory.",
        "description": "Render the Mandelbrot set or a Julia set as a PNG image at any centre and zoom. Shallow views iterate in double precision; deep zooms beyond what doubles can resolve use perturbation theory with an exact BigInt reference orbit and rebasing, so a view of width 1e-22 or 1e-100 renders correctly. Centre coordinates may have hundreds of digits. The result lists the zoom factor, the method, the share of pixels inside the set and the escape-iteration statistics. Part of the Proofline math notebook.\n\nMethodology:\n- Escape time: z ← z² + c from z = 0 (Mandelbrot, c = pixel) or z = pixel (Julia, c fixed) until |z| \u003e 256 or the iteration limit; the smooth count n + 1 − log₂(log₂|z|) gives continuous colours; bounded pixels are black.\n- Deep zooms: the view centre’s orbit Zₙ is computed exactly in BigInt fixed point (precision about −log₂(pixel size) + 48 bits); each pixel iterates its offset δ in doubles, δₙ₊₁ = 2Zₙδₙ + δₙ² + δc. When |Zₙ + δₙ| \u003c |δₙ| or the reference orbit ends, the pixel continues from the start of the reference orbit with δ = Zₙ + δₙ (rebasing), which removes perturbation glitches without extra reference points.\n- Verified: escape times of single points (c = 1 escapes after 3 iterations with radius 2; c = −1 never escapes); perturbation and direct iteration agree to within 1.5 iterations on more than 99.5 % of the pixels of a shallow view; at width 1e-22 the perturbation result equals an exact 200-bit BigInt iteration of the same pixels.\n\nEach pixel shows the escape time of its centre point (no anti-aliasing); pixels that would escape after more iterations than the limit appear inside the set. Colours are a free artistic choice.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "proofline_fractal",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProoflineFractalInput"
              },
              "examples": {
                "example1": {
                  "summary": "The whole Mandelbrot set",
                  "value": {}
                },
                "example2": {
                  "summary": "Deep zoom into Seahorse Valley (width 1e-22, perturbation)",
                  "value": {
                    "centerX": "-0.743643887037158704752191506114774",
                    "centerY": "0.131825904205311970493132056385139",
                    "width": "1e-22",
                    "maxIterations": 20000,
                    "imageWidth": 240,
                    "imageHeight": 180
                  }
                },
                "example3": {
                  "summary": "Julia set for c = −0.8 + 0.156i",
                  "value": {
                    "set": "julia",
                    "centerX": "0",
                    "centerY": "0",
                    "width": "3.2",
                    "juliaRe": "-0.8",
                    "juliaIm": "0.156",
                    "palette": "fire",
                    "imageWidth": 480,
                    "imageHeight": 360
                  }
                },
                "example4": {
                  "summary": "The period-3 mini Mandelbrot on the real axis",
                  "value": {
                    "centerX": "-1.7548776662",
                    "centerY": "0",
                    "width": "0.04",
                    "maxIterations": 3000,
                    "palette": "ice",
                    "imageWidth": 400,
                    "imageHeight": 300
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProoflineFractalResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ProoflineFractalInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "set": {
            "title": "Fractal",
            "type": "string",
            "enum": [
              "mandelbrot",
              "julia"
            ],
            "default": "mandelbrot"
          },
          "centerX": {
            "title": "Centre x (real part)",
            "description": "A decimal number; deep zooms need as many digits as the zoom has zeros. For a Julia set, 0 centres the picture.",
            "type": "string",
            "maxLength": 1300,
            "default": "-0.75"
          },
          "centerY": {
            "title": "Centre y (imaginary part)",
            "type": "string",
            "maxLength": 1300,
            "default": "0"
          },
          "width": {
            "title": "View width",
            "description": "Width of the view in the complex plane, e.g. 3.5 for the whole set or 1e-30 for a deep zoom (at least 1e-250).",
            "type": "string",
            "maxLength": 40,
            "default": "3.5"
          },
          "juliaRe": {
            "title": "Julia constant c, real part",
            "type": "string",
            "maxLength": 400,
            "default": "-0.8"
          },
          "juliaIm": {
            "title": "Julia constant c, imaginary part",
            "type": "string",
            "maxLength": 400,
            "default": "0.156"
          },
          "maxIterations": {
            "title": "Maximum iterations",
            "description": "Deep zooms need more: roughly 2,000 at 1e-10, 20,000 at 1e-22.",
            "type": "integer",
            "minimum": 10,
            "maximum": 100000,
            "default": 1000
          },
          "imageWidth": {
            "title": "Image width (pixels)",
            "type": "integer",
            "minimum": 16,
            "maximum": 1600,
            "default": 640
          },
          "imageHeight": {
            "title": "Image height (pixels)",
            "type": "integer",
            "minimum": 16,
            "maximum": 1600,
            "default": 480
          },
          "method": {
            "title": "Method",
            "type": "string",
            "enum": [
              "auto",
              "direct",
              "perturbation"
            ],
            "default": "auto"
          },
          "palette": {
            "title": "Colours",
            "type": "string",
            "enum": [
              "classic",
              "fire",
              "ice",
              "grey"
            ],
            "default": "classic"
          },
          "colorDensity": {
            "title": "Colour density",
            "type": "number",
            "minimum": 0.05,
            "maximum": 50,
            "default": 1
          }
        },
        "required": []
      },
      "ProoflineFractalResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "set",
              "centerX",
              "centerY",
              "width",
              "height",
              "zoom",
              "pixelSize",
              "juliaRe",
              "juliaIm",
              "maxIterations",
              "imageWidth",
              "imageHeight",
              "method",
              "precisionBits",
              "referenceIterations",
              "referenceEscaped",
              "rebases",
              "inside",
              "escaped",
              "insideFraction",
              "minIterations",
              "maxEscapeIterations",
              "meanIterations",
              "image"
            ],
            "properties": {
              "set": {
                "type": "string",
                "enum": [
                  "mandelbrot",
                  "julia"
                ]
              },
              "centerX": {
                "type": "string"
              },
              "centerY": {
                "type": "string"
              },
              "width": {
                "type": "number"
              },
              "height": {
                "type": "number"
              },
              "zoom": {
                "type": "number"
              },
              "pixelSize": {
                "type": "number"
              },
              "juliaRe": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "juliaIm": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "maxIterations": {
                "type": "integer"
              },
              "imageWidth": {
                "type": "integer"
              },
              "imageHeight": {
                "type": "integer"
              },
              "method": {
                "type": "string",
                "enum": [
                  "direct",
                  "perturbation"
                ]
              },
              "precisionBits": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "referenceIterations": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "referenceEscaped": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "rebases": {
                "type": "integer"
              },
              "inside": {
                "type": "integer"
              },
              "escaped": {
                "type": "integer"
              },
              "insideFraction": {
                "type": "number"
              },
              "minIterations": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "maxEscapeIterations": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "meanIterations": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "image": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}