{
  "openapi": "3.1.0",
  "info": {
    "title": "jevmod",
    "description": "Moderation decisions for user content: spam, scam, harassment, adult, off-topic and your own rules. Powered by Jev (TypeSafe). Probabilities, thresholds you own, decisions you can audit.",
    "version": "0.2.0"
  },
  "paths": {
    "/v1/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_v1_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Health V1 Health Get"
                }
              }
            }
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "summary": "Metrics",
        "operationId": "metrics_metrics_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/v1/moderate": {
      "post": {
        "summary": "Moderate",
        "operationId": "moderate_v1_moderate_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModerateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModerateResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/policy": {
      "get": {
        "summary": "Get Policy",
        "operationId": "get_policy_v1_policy_get",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Policy V1 Policy Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Put Policy",
        "operationId": "put_policy_v1_policy_put",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Put Policy V1 Policy Put"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/decisions": {
      "get": {
        "summary": "Decisions",
        "operationId": "decisions_v1_decisions_get",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "title": "Response Decisions V1 Decisions Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tenant": {
      "delete": {
        "summary": "Delete Tenant",
        "description": "GDPR: forget this tenant's policy, usage and decision log.",
        "operationId": "delete_tenant_v1_tenant_delete",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "boolean"
                  },
                  "title": "Response Delete Tenant V1 Tenant Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "post": {
        "summary": "Create Key",
        "operationId": "create_key_v1_keys_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "default": "",
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Create Key V1 Keys Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DecisionOut": {
        "properties": {
          "message_id": {
            "type": "string",
            "title": "Message Id"
          },
          "action": {
            "type": "string",
            "title": "Action"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "probability": {
            "type": "number",
            "title": "Probability"
          },
          "scores": {
            "additionalProperties": {
              "type": "number"
            },
            "type": "object",
            "title": "Scores"
          },
          "judged": {
            "type": "boolean",
            "title": "Judged"
          },
          "reason": {
            "type": "string",
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "message_id",
          "action",
          "category",
          "probability",
          "scores",
          "judged",
          "reason"
        ],
        "title": "DecisionOut"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "InMessage": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "your id for the message; echoed back",
            "default": ""
          },
          "text": {
            "type": "string",
            "maxLength": 8000,
            "title": "Text"
          },
          "author": {
            "type": "string",
            "title": "Author",
            "default": ""
          },
          "channel_topic": {
            "type": "string",
            "title": "Channel Topic",
            "description": "what the channel/thread is about; used by offtopic",
            "default": ""
          },
          "author_trusted": {
            "type": "boolean",
            "title": "Author Trusted",
            "description": "true skips judgment (moderators, verified staff)",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "text"
        ],
        "title": "InMessage"
      },
      "KeyRequest": {
        "properties": {
          "tenant": {
            "type": "string",
            "maxLength": 80,
            "minLength": 1,
            "title": "Tenant"
          },
          "label": {
            "type": "string",
            "title": "Label",
            "default": ""
          }
        },
        "type": "object",
        "required": [
          "tenant"
        ],
        "title": "KeyRequest"
      },
      "ModerateRequest": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/InMessage"
            },
            "type": "array",
            "maxItems": 50,
            "minItems": 1,
            "title": "Messages"
          }
        },
        "type": "object",
        "required": [
          "messages"
        ],
        "title": "ModerateRequest"
      },
      "ModerateResponse": {
        "properties": {
          "request_id": {
            "type": "string",
            "title": "Request Id"
          },
          "decisions": {
            "items": {
              "$ref": "#/components/schemas/DecisionOut"
            },
            "type": "array",
            "title": "Decisions"
          },
          "usage": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Usage"
          }
        },
        "type": "object",
        "required": [
          "request_id",
          "decisions",
          "usage"
        ],
        "title": "ModerateResponse"
      },
      "PolicyIn": {
        "properties": {
          "thresholds": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "number"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Thresholds"
          },
          "actions": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actions"
          },
          "rules": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rules"
          },
          "rule_actions": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rule Actions"
          },
          "timeout_minutes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Timeout Minutes"
          }
        },
        "type": "object",
        "title": "PolicyIn"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}