{
  "openapi": "3.1.0",
  "info": {
    "title": "CussCheck",
    "version": "0.3.2",
    "description": "English profanity word filter with obfuscation handling: detect and censor swear words. Not AI moderation. Text is never stored or logged. Anonymous 10/min and 200/day per IP; free API key 60/min and 1000/day. CussCheck Pro ($5/month, Polar): 5000/day per license.",
    "contact": {
      "email": "digitalpromohub.support@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://profanity-api.mike-tusa.workers.dev"
    }
  ],
  "security": [
    {},
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "pf_... free API key or CCPR-... CussCheck Pro license key"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "Result": {
        "type": "object",
        "properties": {
          "has_profanity": {
            "type": "boolean"
          },
          "match_count": {
            "type": "integer",
            "description": "Total number of matches in the text (not capped)."
          },
          "terms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "matches": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "term": {
                  "type": "string"
                },
                "match": {
                  "type": "string"
                },
                "start": {
                  "type": "integer"
                },
                "end": {
                  "type": "integer"
                },
                "source": {
                  "type": "string"
                },
                "obfuscated": {
                  "type": "boolean"
                }
              },
              "required": [
                "term",
                "start",
                "end"
              ]
            },
            "maxItems": 50,
            "description": "Matches in text order, at most 50 here (see match_count for the total). start/end are UTF-16 indices into your text."
          },
          "matches_returned": {
            "type": "integer"
          },
          "truncated": {
            "type": "boolean",
            "description": "True when matches lists fewer than match_count (over 50 here, or the API's own cap)."
          },
          "censored": {
            "type": "string",
            "description": "Your text with each match replaced by asterisks (same length). Omitted when censor is false."
          },
          "text_bytes": {
            "type": "integer"
          },
          "engine": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "has_profanity",
          "match_count",
          "terms",
          "matches"
        ]
      }
    }
  },
  "paths": {
    "/v1/check": {
      "post": {
        "operationId": "check",
        "summary": "Find (and optionally censor) English profanity in text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "At most 10240 UTF-8 bytes"
                  },
                  "censor": {
                    "type": "boolean",
                    "default": true
                  },
                  "allow": {
                    "type": "array",
                    "description": "Words never to flag",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "deny": {
                    "type": "array",
                    "description": "Extra words to flag",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "headers": {
              "x-api-plan": {
                "description": "anonymous or free_key",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Daily limit",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left today (approximate)",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "Unix time of the next 00:00 UTC reset",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "invalid_json, missing_text, invalid_censor, invalid_allow or invalid_deny",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "cross_origin_forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "body_too_large or text_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, ip_daily_quota, key_quota_exceeded, issuer_quota_exceeded or daily_cap_reached",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "not_configured or unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "post": {
        "operationId": "createKey",
        "summary": "Issue a free API key (1000/day, 60/min; shown once)",
        "security": [
          {}
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Key issued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "api_key": {
                      "type": "string"
                    },
                    "key_id": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "string"
                    },
                    "daily_quota": {
                      "type": "integer"
                    },
                    "per_minute": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, ip_daily_quota, key_quota_exceeded, issuer_quota_exceeded or daily_cap_reached",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "not_configured or unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "usage",
        "summary": "Today's usage for your API key",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "missing_api_key or invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited, ip_daily_quota, key_quota_exceeded, issuer_quota_exceeded or daily_cap_reached",
            "headers": {
              "retry-after": {
                "description": "Seconds to wait",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP JSON-RPC 2.0 (Streamable HTTP, stateless). Protocol versions 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05. Max body 65536 bytes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response (tool errors are results with isError)",
            "headers": {
              "x-api-plan": {
                "description": "anonymous or free_key",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Daily limit",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left today (approximate)",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "Unix time of the next 00:00 UTC reset",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "202": {
            "description": "Notification or client response accepted"
          },
          "400": {
            "description": "Parse error, invalid request, header mismatch or unsupported version"
          },
          "401": {
            "description": "invalid_api_key (no WWW-Authenticate)"
          },
          "403": {
            "description": "Origin not allowed"
          },
          "404": {
            "description": "Unknown method (2026-07-28)"
          },
          "413": {
            "description": "Body too large"
          },
          "429": {
            "description": "Too many MCP requests or key checks",
            "headers": {
              "retry-after": {
                "description": "Seconds",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "Internal error"
          },
          "503": {
            "description": "not_configured"
          }
        }
      },
      "get": {
        "operationId": "mcpGet",
        "summary": "Not supported (stateless, no SSE)",
        "responses": {
          "405": {
            "description": "Method not allowed",
            "headers": {
              "allow": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "POST, OPTIONS"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "mcpDelete",
        "summary": "Not supported (no sessions)",
        "responses": {
          "405": {
            "description": "Method not allowed",
            "headers": {
              "allow": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "POST, OPTIONS"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}