{
  "openapi": "3.1.0",
  "info": {
    "title": "My Vibe Design API",
    "version": "2026-08-07",
    "description": "Compile a saved taste configuration into a builder-specific design brief. Long-lived keys (mvd_live_…) are server-to-server only and must never ship in frontend code."
  },
  "servers": [
    {
      "url": "https://myvibedesign.kognexity.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "licenseKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "mvd_live_…"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "invalid_json",
                  "unauthorized",
                  "forbidden",
                  "not_found",
                  "method_not_allowed",
                  "unsupported_media_type",
                  "rate_limited",
                  "upstream_unavailable",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "CompileRequest": {
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "type": "object",
            "description": "Taste configuration (partial state is tolerated)."
          },
          "dialect": {
            "type": "string",
            "description": "Target builder dialect, e.g. lovable, v0, cursor, generic.",
            "default": "generic"
          }
        }
      },
      "CompileResponse": {
        "type": "object",
        "required": [
          "brief",
          "dialect"
        ],
        "properties": {
          "brief": {
            "type": "string"
          },
          "dialect": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/api/public/compile": {
      "post": {
        "summary": "Compile a design brief",
        "security": [
          {
            "licenseKey": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "Retrying with the same key returns the stored result instead of recompiling."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompileRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Compiled brief",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompileResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, or revoked key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (60 requests/minute/key); honour Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/mcp": {
      "post": {
        "summary": "MCP JSON-RPC endpoint (tools/list, tools/call)",
        "security": [
          {
            "licenseKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC result"
          }
        }
      }
    }
  }
}