{
  "openapi": "3.1.0",
  "info": {
    "title": "ImaZGen Free AI Image Prompt Library API",
    "version": "1.1.0",
    "description": "Search, enhance, and sample curated AI image generation prompts with preview image URLs, customizable {{variables}}, and AI model compatibility."
  },
  "servers": [
    {
      "url": "https://imazgen.xyz",
      "description": "Production server"
    }
  ],
  "components": {
    "parameters": {
      "GeminiApiKeyHeader": {
        "name": "X-Gemini-Api-Key",
        "in": "header",
        "required": false,
        "schema": { "type": "string" },
        "description": "Optional caller-supplied Google AI Studio API key (AIza...) used transiently in memory for 768-dimensional semantic vector embedding; never logged or stored."
      }
    }
  },
  "paths": {
    "/api/v1/search": {
      "get": {
        "operationId": "searchPrompts",
        "summary": "Search curated AI image prompts by concept, category, model, or use case (max 5 results).",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Search query describing subject, style, camera optics, or lighting"
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Canonical category slug (e.g. portraits, fashion-style, product, cinematic-film, cultural-traditional, urban-street)"
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "AI model slug (midjourney, nano-banana, stable-diffusion, dall-e, leonardo)"
          },
          {
            "name": "useCase",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Outcome slug (ecommerce-product, youtube-thumbnail, linkedin-headshot, fashion-lookbook)"
          },
          {
            "$ref": "#/components/parameters/GeminiApiKeyHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Top matching curated prompts with preview URLs, {{variables}}, and sourceUrl attribution"
          }
        }
      }
    },
    "/api/v1/enhance": {
      "post": {
        "operationId": "enhancePromptIdea",
        "summary": "Enhance a rough image idea using few-shot ground-truth examples from the ImaZGen library.",
        "parameters": [
          {
            "$ref": "#/components/parameters/GeminiApiKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["idea"],
                "properties": {
                  "idea": {
                    "type": "string",
                    "maxLength": 300,
                    "description": "Short description of the desired visual scene (e.g. 'minimalist amber glass serum bottle on wet travertine stone')"
                  },
                  "model": {
                    "type": "string",
                    "description": "Optional target AI image generator slug (midjourney, nano-banana, stable-diffusion, dall-e, leonardo)"
                  },
                  "category": {
                    "type": "string",
                    "description": "Optional canonical category slug to scope retrieved reference examples"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Synthesized suggestedPrompt plus up to 4 ground-truth referenceExamples from ImaZGen"
          },
          "400": {
            "description": "Missing or invalid 'idea' string in JSON body"
          }
        }
      }
    },
    "/api/v1/random": {
      "get": {
        "operationId": "getRandomPrompt",
        "summary": "Get 1 curated random AI image prompt for visual inspiration.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Optional canonical category slug"
          },
          {
            "name": "useCase",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Optional business outcome slug"
          }
        ],
        "responses": {
          "200": {
            "description": "A single curated AI image prompt with preview image URL and customizable variables"
          }
        }
      }
    }
  }
}
