{
  "openapi": "3.1.0",
  "info": {
    "title": "WritingAI API",
    "description": "Official REST API for WritingAI – Generate SEO-optimized articles programmatically using AI. Supports multiple languages, tones, and geo-targeting.",
    "version": "1.0.0",
    "contact": {
      "name": "WritingAI Support",
      "url": "https://writingai.pro/kapcsolat"
    },
    "termsOfService": "https://writingai.pro/en/terms-of-service"
  },
  "servers": [
    {
      "url": "https://fyivkyuhwrbejcevihjs.supabase.co/functions/v1",
      "description": "Production API Server"
    }
  ],
  "paths": {
    "/api-v1-generate": {
      "post": {
        "operationId": "generateArticle",
        "summary": "Generate an SEO-optimized article",
        "description": "Generate a full SEO-optimized article from a keyword. Returns HTML content, meta description, title, and FAQ items.",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["keyword"],
                "properties": {
                  "keyword": {
                    "type": "string",
                    "description": "The main keyword or topic for the article",
                    "example": "best SEO tools 2025"
                  },
                  "language": {
                    "type": "string",
                    "description": "Article language",
                    "default": "english",
                    "enum": ["magyar", "english", "deutsch"]
                  },
                  "tone": {
                    "type": "string",
                    "description": "Writing tone/style",
                    "default": "professional",
                    "enum": ["professional", "casual", "formal"]
                  },
                  "location": {
                    "type": "string",
                    "description": "Target geographic area for local SEO",
                    "example": "New York"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Article generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "title": { "type": "string", "description": "SEO-optimized article title" },
                        "metaDescription": { "type": "string", "description": "Meta description for SEO" },
                        "content": { "type": "string", "description": "Full article in HTML format (5000+ characters)" },
                        "faqItems": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "question": { "type": "string" },
                              "answer": { "type": "string" }
                            }
                          }
                        },
                        "keyword": { "type": "string" }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "used": { "type": "integer" },
                        "limit": { "type": "integer" }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "description": "Bad Request – Missing keyword parameter" },
          "401": { "description": "Unauthorized – Invalid or missing API key" },
          "402": { "description": "Payment Required – Subscription upgrade needed" },
          "429": { "description": "Too Many Requests – Rate limit exceeded" },
          "500": { "description": "Internal Server Error" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key with wai_ prefix. Generate at https://writingai.pro/vezerlopult"
      }
    }
  }
}