{
  "openapi": "3.0.0",
  "info": {
    "title": "Paxmod API",
    "version": "1.0.0",
    "description": "AI-powered chat and image moderation API for gaming communities. COPPA-compliant, real-time content filtering with 50ms response time.",
    "contact": {
      "name": "Paxmod Support",
      "email": "support@paxmod.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://www.paxmod.com/api/v1",
      "description": "Production server"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/moderate": {
      "post": {
        "summary": "Moderate text content",
        "description": "Analyze text content for toxicity, profanity, hate speech, and other harmful content. Returns moderation scores and recommendations.",
        "operationId": "moderateText",
        "tags": ["Text Moderation"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModerateRequest"
              },
              "example": {
                "text": "Hello, this is a test message!"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful moderation response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModerateResponse"
                },
                "example": {
                  "clear": true,
                  "result": "Advice: Clear - Content is safe",
                  "flagged_categories": [],
                  "message": "Hello, this is a test message!",
                  "response_time": "45ms"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/moderate/image": {
      "post": {
        "summary": "Moderate image content",
        "description": "Analyze image content for sexual, violent, self-harm, and other harmful visual content.",
        "operationId": "moderateImage",
        "tags": ["Image Moderation"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModerateImageRequest"
              },
              "example": {
                "image_url": "https://example.com/image.jpg"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful image moderation response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModerateImageResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key authentication. Get your API key from the Paxmod console."
      }
    },
    "schemas": {
      "ModerateRequest": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": {
            "type": "string",
            "description": "The text content to moderate",
            "example": "Hello, this is a test message!"
          }
        }
      },
      "ModerateResponse": {
        "type": "object",
        "properties": {
          "clear": {
            "type": "boolean",
            "description": "Whether the content is safe (true) or should be blocked (false)"
          },
          "result": {
            "type": "string",
            "description": "Human-readable recommendation for content moderation",
            "example": "Advice: Clear - Content is safe"
          },
          "flagged_categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of moderation categories that were flagged",
            "example": []
          },
          "message": {
            "type": "string",
            "description": "The original message that was moderated"
          },
          "response_time": {
            "type": "string",
            "description": "API response time",
            "example": "45ms"
          },
          "categories": {
            "type": "object",
            "description": "Detailed scores for each moderation category",
            "properties": {
              "toxicity": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "sexual": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "hate": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "violence": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "self_harm": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "harassment": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        }
      },
      "ModerateImageRequest": {
        "type": "object",
        "required": ["image_url"],
        "properties": {
          "image_url": {
            "type": "string",
            "format": "uri",
            "description": "URL of the image to moderate",
            "example": "https://example.com/image.jpg"
          }
        }
      },
      "ModerateImageResponse": {
        "type": "object",
        "properties": {
          "clear": {
            "type": "boolean",
            "description": "Whether the image is safe (true) or should be blocked (false)"
          },
          "result": {
            "type": "string",
            "description": "Human-readable recommendation for image moderation"
          },
          "flagged_categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of image moderation categories that were flagged"
          },
          "categories": {
            "type": "object",
            "description": "Detailed scores for each image moderation category",
            "properties": {
              "sexual": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "violence": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              },
              "self_harm": {
                "type": "number",
                "format": "float",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Text Moderation",
      "description": "Endpoints for moderating text content in real-time"
    },
    {
      "name": "Image Moderation",
      "description": "Endpoints for moderating image content"
    }
  ]
}

