{
  "openapi": "3.0.3",
  "info": {
    "title": "Image Intelligence",
    "description": "Analyze any image in one call: blur/sharpness, exposure, brightness, saturation, contrast, dominant colors, a quality score, and on-device NSFW moderation with category tags.",
    "version": "1.0.0"
  },
  "components": {
    "schemas": {}
  },
  "paths": {
    "/analyze": {
      "post": {
        "summary": "Full image analysis report",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Decode an image and return a complete technical analysis: dimensions/format, blur/sharpness, brightness, exposure (clipping), saturation, contrast, dominant colors, and an overall quality score. Pure compute, no model.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/blur": {
      "post": {
        "summary": "Detect blur / sharpness",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Returns the Laplacian variance, a 0–100 sharpness score, and an isBlurry flag. Higher variance = sharper image.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/exposure": {
      "post": {
        "summary": "Exposure, brightness & contrast",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Returns mean luminance, clipped shadow/highlight percentages, an under/over/balanced label, plus brightness and contrast.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/saturation": {
      "post": {
        "summary": "Saturation analysis",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Returns mean HSV saturation (0–100) and a label from grayscale to oversaturated.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/colors": {
      "post": {
        "summary": "Dominant colors / palette",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Returns the top dominant colors (hex + rgb + fraction) via a fast color histogram. Set 'colors' (1–12) for how many.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  },
                  "colors": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12,
                    "default": 5,
                    "example": 5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/quality": {
      "post": {
        "summary": "Overall quality score",
        "tags": [
          "Image Intelligence"
        ],
        "description": "A 0–100 composite quality score from sharpness, exposure, and contrast, with the component sub-scores.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/moderate": {
      "post": {
        "summary": "NSFW / content-moderation scan",
        "tags": [
          "Image Intelligence"
        ],
        "description": "Classify an image for not-safe-for-work content with an on-device model (the image is never sent to a third party). Returns category tags with scores (Neutral, Drawing, Sexy, Hentai, Porn), a combined nsfwScore, and a safe/nsfw verdict. Set 'threshold' (0–1, default 0.5) for the cutoff. Best-effort signal — not a compliance or CSAM tool.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public image URL (fetched via an SSRF-hardened client).",
                    "example": "https://picsum.photos/600"
                  },
                  "base64": {
                    "type": "string",
                    "description": "Base64-encoded image (data URI prefix allowed)."
                  },
                  "threshold": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "default": 0.5,
                    "example": 0.5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://web-toolbox-api-production.up.railway.app/vision",
      "description": "Production"
    }
  ]
}