{
  "$defs": {
    "DataRef": {
      "additionalProperties": false,
      "description": "A dataset stored next to the bundle (path relative to the bundle root).",
      "properties": {
        "crc32c": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z0-9+/]{6}==$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Crc32C"
        },
        "format": {
          "default": "arrow",
          "enum": [
            "arrow",
            "json"
          ],
          "title": "Format",
          "type": "string"
        },
        "kind": {
          "const": "data_ref",
          "title": "Kind",
          "type": "string"
        },
        "path": {
          "examples": [
            "ui/plotdata/contrib.arrow"
          ],
          "pattern": "^[A-Za-z0-9_.\\-][A-Za-z0-9_.\\-/]{0,511}$",
          "title": "Path",
          "type": "string"
        },
        "size": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Size"
        }
      },
      "required": [
        "kind",
        "path"
      ],
      "title": "DataRef",
      "type": "object"
    },
    "InlineArrow": {
      "additionalProperties": false,
      "description": "A small Arrow IPC stream embedded as base64.",
      "properties": {
        "data": {
          "maxLength": 2097152,
          "pattern": "^[A-Za-z0-9+/]*={0,2}$",
          "title": "Data",
          "type": "string"
        },
        "kind": {
          "const": "inline_arrow",
          "title": "Kind",
          "type": "string"
        },
        "rows": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Rows"
        }
      },
      "required": [
        "kind",
        "data"
      ],
      "title": "InlineArrow",
      "type": "object"
    },
    "JsonValue": {},
    "PlotBindings": {
      "additionalProperties": false,
      "description": "Role/dim template bindings, e.g. ``{x: \"dim:time\", y: \"role:target\"}``.\n\nTemplates bound this way apply to every model of a family, not one bundle.",
      "properties": {
        "band_lower": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Band Lower"
        },
        "band_upper": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Band Upper"
        },
        "color": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Color"
        },
        "column": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Column"
        },
        "facet": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Facet"
        },
        "row": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Row"
        },
        "shape": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Shape"
        },
        "size": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Size"
        },
        "tooltip": {
          "items": {
            "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
            "type": "string"
          },
          "maxItems": 32,
          "title": "Tooltip",
          "type": "array"
        },
        "x": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "X"
        },
        "y": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Y"
        },
        "y2": {
          "anyOf": [
            {
              "pattern": "^(dim|role|var|coord|stat):[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Y2"
        }
      },
      "title": "PlotBindings",
      "type": "object"
    },
    "PlotProvenance": {
      "additionalProperties": false,
      "description": "Who produced a plot: exactly one of ``recipe``, ``plugin`` or ``author``.",
      "properties": {
        "author": {
          "anyOf": [
            {
              "maxLength": 128,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Author"
        },
        "bundle_id": {
          "anyOf": [
            {
              "maxLength": 128,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bundle Id"
        },
        "generated_at": {
          "format": "date-time",
          "title": "Generated At",
          "type": "string"
        },
        "plugin": {
          "anyOf": [
            {
              "maxLength": 128,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Plugin"
        },
        "recipe": {
          "anyOf": [
            {
              "maxLength": 128,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Recipe"
        }
      },
      "required": [
        "generated_at"
      ],
      "title": "PlotProvenance",
      "type": "object"
    },
    "PlotSpec": {
      "additionalProperties": false,
      "description": "A renderable plot. ``spec`` is Vega-Lite JSON or Plotly ``{data, layout, ...}``.",
      "examples": [
        {
          "caption_plain": "The shaded band is where the model expects 90% of weeks.",
          "datasets": {
            "fan": {
              "kind": "data_ref",
              "path": "ui/plotdata/ppc_fan.arrow"
            }
          },
          "id": "core.ppc_fan",
          "kind": "vega-lite",
          "persona": "both",
          "provenance": {
            "generated_at": "2026-10-15T09:40:00Z",
            "recipe": "core.ppc_fan@1.0.0"
          },
          "schema_version": "v5",
          "spec": {
            "data": {
              "name": "fan"
            },
            "encoding": {
              "x": {
                "field": "time",
                "type": "temporal"
              },
              "y": {
                "field": "lo",
                "type": "quantitative"
              },
              "y2": {
                "field": "hi"
              }
            },
            "mark": "area"
          },
          "title": "Posterior predictive fan"
        }
      ],
      "properties": {
        "bindings": {
          "anyOf": [
            {
              "$ref": "#/$defs/PlotBindings"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "caption_plain": {
          "anyOf": [
            {
              "maxLength": 4000,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Caption Plain"
        },
        "datasets": {
          "additionalProperties": {
            "discriminator": {
              "mapping": {
                "data_ref": "#/$defs/DataRef",
                "inline_arrow": "#/$defs/InlineArrow"
              },
              "propertyName": "kind"
            },
            "oneOf": [
              {
                "$ref": "#/$defs/DataRef"
              },
              {
                "$ref": "#/$defs/InlineArrow"
              }
            ]
          },
          "maxProperties": 64,
          "title": "Datasets",
          "type": "object"
        },
        "id": {
          "pattern": "^[A-Za-z0-9_.\\-]{1,128}$",
          "title": "Id",
          "type": "string"
        },
        "kind": {
          "enum": [
            "vega-lite",
            "plotly"
          ],
          "title": "Kind",
          "type": "string"
        },
        "persona": {
          "default": "both",
          "enum": [
            "guided",
            "expert",
            "both"
          ],
          "title": "Persona",
          "type": "string"
        },
        "provenance": {
          "$ref": "#/$defs/PlotProvenance"
        },
        "schema_version": {
          "examples": [
            "v5",
            "2.35.2"
          ],
          "pattern": "^v?\\d+(\\.\\d+){0,2}$",
          "title": "Schema Version",
          "type": "string"
        },
        "spec": {
          "additionalProperties": {
            "$ref": "#/$defs/JsonValue"
          },
          "title": "Spec",
          "type": "object"
        },
        "title": {
          "maxLength": 300,
          "title": "Title",
          "type": "string"
        }
      },
      "required": [
        "id",
        "title",
        "kind",
        "spec",
        "schema_version",
        "provenance"
      ],
      "title": "PlotSpec",
      "type": "object"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/api-EmbedView.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "``GET /v1/embeds/{token}`` (public, rate-limited, cacheable until ``expires_at``):\na platform-recipe plot with every dataset inlined. Expired or revoked tokens answer\n``410 LINK_EXPIRED``; unknown ones ``404``.",
  "examples": [
    {
      "allowed_origins": [
        "https://acme.notion.site"
      ],
      "expires_at": "2027-01-13T09:30:00Z",
      "generated_at": "2026-10-15T09:30:00Z",
      "image_url": "https://storage.googleapis.com/mapi-prod-bundles/t/acme/embeds/emb_01jaf3p1q2r3s4t5v6w7x8y9z0/plot.png?X-Goog-Signature=\u2026",
      "plot": {
        "caption_plain": "The shaded band is where the model expects 90% of weeks.",
        "datasets": {
          "fan": {
            "data": "QVJST1cx",
            "kind": "inline_arrow",
            "rows": 2
          }
        },
        "id": "core.ppc_fan",
        "kind": "vega-lite",
        "persona": "both",
        "provenance": {
          "generated_at": "2026-10-15T09:40:00Z",
          "recipe": "core.ppc_fan@1.0.0"
        },
        "schema_version": "v5",
        "spec": {
          "data": {
            "name": "fan"
          },
          "encoding": {
            "x": {
              "field": "time",
              "type": "temporal"
            },
            "y": {
              "field": "lo",
              "type": "quantitative"
            },
            "y2": {
              "field": "hi"
            }
          },
          "mark": "area"
        },
        "title": "Posterior predictive fan"
      },
      "title": "EU response curves (v3)"
    }
  ],
  "properties": {
    "allowed_origins": {
      "description": "The embed's PlotEmbedCreate.allowed_origins: sites that may frame the embed page (empty: any). The embed page refuses to render elsewhere.",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "title": "Allowed Origins",
      "type": "array"
    },
    "caption_plain": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Caption Plain"
    },
    "expires_at": {
      "format": "date-time",
      "title": "Expires At",
      "type": "string"
    },
    "generated_at": {
      "format": "date-time",
      "title": "Generated At",
      "type": "string"
    },
    "image_url": {
      "anyOf": [
        {
          "maxLength": 4096,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Short-lived signed URL of a static PNG of the plot (the embed page's fallback link), once the sandbox has rendered one",
      "title": "Image Url"
    },
    "plot": {
      "$ref": "#/$defs/PlotSpec"
    },
    "title": {
      "title": "Title",
      "type": "string"
    }
  },
  "required": [
    "title",
    "plot",
    "generated_at",
    "expires_at"
  ],
  "title": "EmbedView",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
