{
  "openapi": "3.1.0",
  "info": {
    "title": "Agentic Slides REST API",
    "version": "1.0.0",
    "description": "REST door over the Agentic Slides service layer — the same operations as the MCP server, as plain HTTP endpoints for web apps, webhooks, and automations. Decks flow as canonical Agentic-Slides HTML (the single source of truth)."
  },
  "paths": {
    "/v1/decks": {
      "post": {
        "operationId": "createDeck",
        "summary": "Create a new deck",
        "responses": {
          "201": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": false,
          "description": "New-deck options.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "tenantId": {
                    "$ref": "#/components/schemas/TenantId"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listDecks",
        "summary": "List stored decks",
        "responses": {
          "200": {
            "description": "The tenant's stored decks (id + title).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "decks": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DeckSummary"
                      }
                    }
                  },
                  "required": [
                    "decks"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}": {
      "get": {
        "operationId": "getDeck",
        "summary": "Get a stored deck",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "put": {
        "operationId": "updateDeck",
        "summary": "Create or update a stored deck",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck as canonical Agentic-Slides HTML (the persisted single source of truth).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  }
                },
                "required": [
                  "deckHtml"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteDeck",
        "summary": "Delete a stored deck",
        "responses": {
          "204": {
            "description": "The deck was deleted (no content)."
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/decks/{id}/slides": {
      "post": {
        "operationId": "addSlide",
        "summary": "Append or insert a blank slide",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck plus an optional 0-based insert position (omit to append).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "index": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "deckHtml"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}/slides/{sid}": {
      "patch": {
        "operationId": "editSlide",
        "summary": "Edit one slide (HTML or AI instruction)",
        "responses": {
          "200": {
            "description": "The updated deck HTML and the per-element diff (AI edit), or the deck HTML (deterministic edit).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "html": {
                      "type": "string"
                    },
                    "diff": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ElementDiff"
                      }
                    }
                  },
                  "required": [
                    "html",
                    "diff"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Provide exactly one of `html` (deterministic replace) or `prompt` (AI edit).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "html": {
                    "type": "string",
                    "description": "Replacement slide HTML (deterministic edit)."
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Natural-language edit instruction (AI edit)."
                  },
                  "elementIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "deckHtml"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "removeSlide",
        "summary": "Remove a slide from a deck",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck as canonical Agentic-Slides HTML (the persisted single source of truth).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  }
                },
                "required": [
                  "deckHtml"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}/reorder": {
      "post": {
        "operationId": "reorderSlides",
        "summary": "Reorder a deck's slides",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck plus the full slide-id permutation in the desired final order.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "order": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Every slide id exactly once, in the desired final order."
                  }
                },
                "required": [
                  "deckHtml",
                  "order"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}/slides/{sid}/template": {
      "post": {
        "operationId": "applyTemplate",
        "summary": "Apply a catalog template to a slide",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck plus the catalog template id to rebuild the addressed slide from.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "templateId": {
                    "type": "string",
                    "description": "The catalog template id to apply."
                  }
                },
                "required": [
                  "deckHtml",
                  "templateId"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/generate": {
      "post": {
        "operationId": "generateDeck",
        "summary": "Generate a deck with AI",
        "responses": {
          "201": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "A natural-language brief; optionally an existing deck's HTML to append into.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string"
                  },
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}/brand": {
      "post": {
        "operationId": "applyBrand",
        "summary": "Apply a tenant brand to a deck",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck, an optional tenant, and an optional brand profile id (omit for the active profile).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "tenantId": {
                    "$ref": "#/components/schemas/TenantId"
                  },
                  "profileId": {
                    "type": "string"
                  }
                },
                "required": [
                  "deckHtml"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/decks/{id}/render/{sid}": {
      "get": {
        "operationId": "renderSlide",
        "summary": "Render a slide to a PNG",
        "responses": {
          "200": {
            "description": "The rendered slide as a PNG in the deck's canvas size.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/decks/{id}/export": {
      "post": {
        "operationId": "exportDeck",
        "summary": "Export a deck (pdf/png/reveal)",
        "responses": {
          "200": {
            "description": "The exported file. Content type depends on `format`.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "The deck and the export format: pdf | png (zip of PNGs) | reveal (reveal.js HTML).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "deckHtml": {
                    "$ref": "#/components/schemas/DeckHtml"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "pdf",
                      "png",
                      "reveal"
                    ]
                  }
                },
                "required": [
                  "deckHtml",
                  "format"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/validate": {
      "post": {
        "operationId": "validateSlideHtml",
        "summary": "Validate slide/deck HTML",
        "responses": {
          "200": {
            "description": "The deck as canonical Agentic-Slides HTML.",
            "content": {
              "text/html": {
                "schema": {
                  "$ref": "#/components/schemas/DeckHtml"
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "Candidate slide/deck HTML to validate.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "html": {
                    "type": "string"
                  }
                },
                "required": [
                  "html"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/spec": {
      "get": {
        "operationId": "getSpec",
        "summary": "Get the slide spec",
        "responses": {
          "200": {
            "description": "The slide spec: version, machine-readable constraints, and the human-readable markdown.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "constraints": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "markdown": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "version",
                    "constraints",
                    "markdown"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/brand": {
      "get": {
        "operationId": "getBrandState",
        "summary": "Get the tenant's brand-store state",
        "responses": {
          "200": {
            "description": "The tenant's brand-store state (profiles + active id).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "$ref": "#/components/schemas/BrandStoreState"
                    }
                  },
                  "required": [
                    "state"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "putBrandState",
        "summary": "Replace the tenant's brand-store state",
        "responses": {
          "200": {
            "description": "The persisted brand-store state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "$ref": "#/components/schemas/BrandStoreState"
                    }
                  },
                  "required": [
                    "state"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "The full replacement brand-store state (profiles + active id).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "state": {
                    "$ref": "#/components/schemas/BrandStoreState"
                  },
                  "tenantId": {
                    "$ref": "#/components/schemas/TenantId"
                  }
                },
                "required": [
                  "state"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/brand/templates": {
      "get": {
        "operationId": "listBrands",
        "summary": "List the tenant's brand profiles",
        "responses": {
          "200": {
            "description": "The tenant's brand profiles (a template IS a profile): id + name + active flag.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BrandSummary"
                      }
                    }
                  },
                  "required": [
                    "templates"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "importBrand",
        "summary": "Import a template as a brand profile",
        "responses": {
          "201": {
            "description": "The created profile's id and the new brand-store state.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "profileId": {
                      "type": "string"
                    },
                    "state": {
                      "$ref": "#/components/schemas/BrandStoreState"
                    }
                  },
                  "required": [
                    "profileId",
                    "state"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "description": "A template supplied as TEXT → a new, active brand profile (the colors/fonts are extracted).",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string",
                    "description": "Template as text: an HTML deck or HTML/CSS markup."
                  },
                  "mimeType": {
                    "type": "string",
                    "description": "MIME type of `content` (default \"text/html\")."
                  },
                  "id": {
                    "type": "string",
                    "description": "Optional explicit profile id (uniquified on collision)."
                  },
                  "tenantId": {
                    "$ref": "#/components/schemas/TenantId"
                  }
                },
                "required": [
                  "name",
                  "content"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/brand/templates/{id}": {
      "delete": {
        "operationId": "deleteBrand",
        "summary": "Delete a brand profile",
        "responses": {
          "200": {
            "description": "The brand-store state after the profile was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state": {
                      "$ref": "#/components/schemas/BrandStoreState"
                    }
                  },
                  "required": [
                    "state"
                  ]
                }
              }
            }
          },
          "4XX": {
            "description": "Client error (validation, not-found, bad request).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "5XX": {
            "description": "Unexpected engine error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "DeckHtml": {
        "type": "string",
        "description": "A deck serialized as canonical Agentic-Slides HTML (the persisted single source of truth)."
      },
      "TenantId": {
        "type": "string",
        "description": "Tenant whose stored decks/brand to use. Omit for the default tenant (PMC)."
      },
      "DeckSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title"
        ]
      },
      "ElementDiff": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "before": {
            "type": "string"
          },
          "after": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "before",
          "after"
        ]
      },
      "BrandSummary": {
        "type": "object",
        "description": "A brand profile listing entry (a template IS a profile): id + name + active flag.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "name",
          "active"
        ]
      },
      "BrandStoreState": {
        "type": "object",
        "description": "The tenant's brand-store state: the full brand-profile list (palette/fonts/logo/layout) and the id of the active profile. The single brand model shared with the browser store.",
        "properties": {
          "profiles": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "activeId": {
            "type": "string"
          }
        },
        "required": [
          "profiles",
          "activeId"
        ]
      },
      "ApiError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "not_found",
                  "invalid_input",
                  "invalid_html",
                  "engine_error",
                  "bad_request",
                  "last_profile"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}
