{
  "openapi": "3.0.3",
  "info": {
    "title": "Microcopy Fixer API",
    "version": "1.0.0",
    "description": "Endpoints for rewriting blocks, captions, projects, imports, and credits."
  },
  "servers": [{ "url": "https://microcopyfixer.com" }],
  "paths": {
    "/api/captions": {
      "post": {
        "summary": "Generate captions",
        "description": "Generate social captions with tone, platform, and length controls. Supports multipart when uploading images.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "projectId": { "type": "string" },
                  "instruction": { "type": "string" },
                  "platform": { "type": "string", "enum": ["instagram", "x", "linkedin"] },
                  "maxLen": { "type": "integer" },
                  "useEmojis": { "type": "boolean" },
                  "useHashtags": { "type": "boolean" },
                  "intent": { "type": "string" },
                  "tonePreset": { "type": "string" },
                  "mustInclude": { "type": "string" },
                  "prohibitedWords": { "type": "string" }
                },
                "required": ["platform"]
              },
              "examples": {
                "basic": {
                  "value": {
                    "projectId": "proj_123",
                    "instruction": "Promote our new feature",
                    "platform": "instagram",
                    "maxLen": 150,
                    "useEmojis": true,
                    "useHashtags": true,
                    "intent": "engagement",
                    "tonePreset": "project"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated captions",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/copyblocks/rewrite": {
      "post": {
        "summary": "Rewrite microcopy",
        "description": "Rewrite a text block with selected style/tone.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": { "type": "string" },
                  "tone": { "type": "string" },
                  "language": { "type": "string" }
                },
                "required": ["text"]
              },
              "examples": {
                "basic": {
                  "value": { "text": "Sign in to continue", "tone": "friendly", "language": "en" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rewrite result",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/user/generate-api-key": {
      "post": { "summary": "Generate API key", "responses": { "200": { "description": "Created" } } }
    },
    "/api/user/verify-api-key": {
      "post": { "summary": "Verify API key", "responses": { "200": { "description": "Verified" } } }
    },
    "/api/imports/bulk-rewrite": {
      "post": { "summary": "Create bulk rewrite job", "responses": { "200": { "description": "Job created" } } }
    }
  }
}
