{
  "openapi": "3.1.0",
  "info": {
    "title": "SVG Micro Factory",
    "version": "1.0.0",
    "description": "Production SVG generator, optimizer, converter, and editor. Create, optimize, and transform vector graphics with a powerful API and intuitive UI.\n\nSVG Micro Factory is the canonical SVG/vector utility layer for the PlatPhormNews web mesh. Public-safe generation, optimization, validation, stats, data URL generation, templates, gallery browsing, and read-only MCP introspection are public. Protected mutations and reports require PLATPHORM_API_KEY.",
    "contact": {
      "name": "Michael Barbine",
      "email": "Michael@Barbineworldwide.com"
    }
  },
  "servers": [
    {
      "url": "https://svg.platphormnews.com",
      "description": "Production"
    }
  ],
  "security": [],
  "paths": {
    "/api/health": {
      "get": {
        "summary": "Public health summary",
        "tags": [
          "System"
        ],
        "responses": {
          "200": {
            "description": "Health payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "summary": "Public v1 health summary",
        "tags": [
          "System"
        ],
        "responses": {
          "200": {
            "description": "Health payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/generate": {
      "post": {
        "summary": "Generate SVG",
        "description": "Generate real SVG icons, patterns, avatars, badges, and QR codes.",
        "tags": [
          "SVG"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "icon",
                      "pattern",
                      "avatar",
                      "badge",
                      "qr"
                    ]
                  },
                  "template": {
                    "type": "string"
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated SVG",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/optimize": {
      "post": {
        "summary": "Optimize SVG",
        "description": "Optimize a safe SVG with SVGO using safe, balanced, aggressive, or custom presets.",
        "tags": [
          "SVG"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "svg"
                ],
                "properties": {
                  "svg": {
                    "type": "string"
                  },
                  "preset": {
                    "type": "string",
                    "enum": [
                      "safe",
                      "balanced",
                      "aggressive",
                      "custom",
                      "minimal",
                      "default"
                    ]
                  },
                  "options": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Optimized SVG",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/validate": {
      "post": {
        "summary": "Validate SVG",
        "tags": [
          "SVG"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "svg"
                ],
                "properties": {
                  "svg": {
                    "type": "string"
                  },
                  "strict": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stats": {
      "post": {
        "summary": "Inspect SVG stats",
        "tags": [
          "SVG"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "svg"
                ],
                "properties": {
                  "svg": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SVG statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/data-url": {
      "post": {
        "summary": "Convert SVG to data URL",
        "tags": [
          "SVG"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "svg"
                ],
                "properties": {
                  "svg": {
                    "type": "string"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "svg",
                      "base64"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Data URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/convert": {
      "post": {
        "summary": "Raster conversion status",
        "description": "Backend raster tracing honestly reports degraded in Phase 1. Browser posterize conversion is available in the public converter UI.",
        "tags": [
          "SVG"
        ],
        "responses": {
          "501": {
            "description": "Backend conversion degraded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/templates": {
      "get": {
        "summary": "List public templates",
        "tags": [
          "Templates"
        ],
        "responses": {
          "200": {
            "description": "Template catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/gallery": {
      "get": {
        "summary": "List public gallery items",
        "tags": [
          "Gallery"
        ],
        "responses": {
          "200": {
            "description": "Gallery items",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "summary": "MCP metadata",
        "tags": [
          "MCP"
        ],
        "responses": {
          "200": {
            "description": "MCP metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "MCP JSON-RPC endpoint",
        "description": "Accepts JSON-RPC 2.0 object or batch. Read-only introspection is public; protected report tools require PLATPHORM_API_KEY.",
        "tags": [
          "MCP"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/api/webhooks": {
      "post": {
        "summary": "Register webhook subscription",
        "tags": [
          "Protected"
        ],
        "security": [
          {
            "PlatPhormApiKey": []
          },
          {
            "PlatPhormBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook registered"
          },
          "401": {
            "description": "Auth required"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PlatPhormBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Use Authorization: Bearer $PLATPHORM_API_KEY"
      },
      "PlatPhormApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-PlatPhorm-API-Key",
        "description": "Use X-PlatPhorm-API-Key: $PLATPHORM_API_KEY"
      }
    }
  },
  "tags": [
    {
      "name": "System",
      "description": "Health and route compliance"
    },
    {
      "name": "SVG",
      "description": "SVG generation, optimization, validation, stats, conversion, and export"
    },
    {
      "name": "Templates",
      "description": "Public template catalog"
    },
    {
      "name": "Gallery",
      "description": "Public gallery items"
    },
    {
      "name": "MCP",
      "description": "JSON-RPC MCP endpoint"
    },
    {
      "name": "Protected",
      "description": "PLATPHORM_API_KEY protected actions"
    }
  ]
}