{
  "openapi": "3.0.3",
  "info": {
    "title": "Image Jinn Agentic API",
    "description": "AI Virtual Staging API for Real Estate. Programmatically stage vacant room photos in 15 seconds.",
    "version": "1.0.0",
    "contact": {
      "name": "Image Jinn Support",
      "email": "hello@imagejinn.com",
      "url": "https://imagejinn.com/developers"
    }
  },
  "servers": [
    {
      "url": "https://imagejinn.com",
      "description": "Production Live Server"
    }
  ],
  "paths": {
    "/api/v1/stage": {
      "post": {
        "summary": "Stage a vacant room photo",
        "description": "Submits a room photo (base64 string or public HTTP URL) for AI virtual staging in 15 seconds. Costs 1 credit.",
        "security": [
          { "ApiKeyAuth": [] }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["image"],
                "properties": {
                  "image": { "type": "string", "description": "Base64 data or HTTP image URL" },
                  "mimeType": { "type": "string", "default": "image/jpeg" },
                  "style": { "type": "string", "default": "Scandinavian", "enum": ["Scandinavian", "Mid-Century Modern", "Minimalist Lux", "Industrial Loft", "Bohemian", "Classic Traditional"] },
                  "roomType": { "type": "string", "default": "Living Room", "enum": ["Living Room", "Bedroom", "Dining Room", "Home Office", "Bathroom", "Outdoor Patio"] },
                  "customInstructions": { "type": "string", "description": "Optional specific staging notes" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Virtual staging completed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "stagedImage": { "type": "string", "description": "Base64 PNG data URL of staged result" },
                    "creditsRemaining": { "type": "integer" }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "message": { "type": "string" },
                    "purchase_url": { "type": "string" },
                    "checkout_api": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/user": {
      "get": {
        "summary": "Get user credit balance",
        "security": [
          { "ApiKeyAuth": [] }
        ],
        "responses": {
          "200": {
            "description": "User account info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": { "type": "string" },
                    "credits": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/checkout": {
      "post": {
        "summary": "Create programmatic credit checkout session",
        "security": [
          { "ApiKeyAuth": [] }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tier": { "type": "string", "enum": ["starter", "pro", "volume"], "default": "pro" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stripe checkout session created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "checkoutUrl": { "type": "string" },
                    "credits": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
