{
  "batchPath": "batch",
  "ownerName": "Google",
  "revision": "20260810",
  "description": "The Perspective Comment Analyzer API provides information about the potential impact of a comment on a conversation (e.g. it can provide a score for the \"toxicity\" of a comment). Users can leverage the \"SuggestCommentScore\" method to submit corrections to improve Perspective over time. Users can set the \"doNotStore\" flag to ensure that all submitted comments are automatically deleted after scores are returned.",
  "ownerDomain": "google.com",
  "protocol": "rest",
  "icons": {
    "x16": "http://www.google.com/images/icons/product/search-16.gif",
    "x32": "http://www.google.com/images/icons/product/search-32.gif"
  },
  "baseUrl": "https://commentanalyzer.googleapis.com/",
  "name": "commentanalyzer",
  "version_module": true,
  "auth": {
    "oauth2": {
      "scopes": {
        "https://www.googleapis.com/auth/userinfo.email": {
          "description": "See your primary Google Account email address"
        }
      }
    }
  },
  "resources": {
    "comments": {
      "methods": {
        "suggestscore": {
          "parameters": {},
          "parameterOrder": [],
          "request": {
            "$ref": "SuggestCommentScoreRequest"
          },
          "httpMethod": "POST",
          "id": "commentanalyzer.comments.suggestscore",
          "flatPath": "v1alpha1/comments:suggestscore",
          "response": {
            "$ref": "SuggestCommentScoreResponse"
          },
          "path": "v1alpha1/comments:suggestscore",
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ],
          "description": "Suggest comment scores as training data."
        },
        "analyze": {
          "parameterOrder": [],
          "parameters": {},
          "httpMethod": "POST",
          "id": "commentanalyzer.comments.analyze",
          "flatPath": "v1alpha1/comments:analyze",
          "response": {
            "$ref": "AnalyzeCommentResponse"
          },
          "path": "v1alpha1/comments:analyze",
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ],
          "description": "Analyzes the provided text and returns scores for requested attributes.",
          "request": {
            "$ref": "AnalyzeCommentRequest"
          }
        }
      }
    }
  },
  "title": "Perspective Comment Analyzer API",
  "servicePath": "",
  "version": "v1alpha1",
  "id": "commentanalyzer:v1alpha1",
  "discoveryVersion": "v1",
  "rootUrl": "https://commentanalyzer.googleapis.com/",
  "kind": "discovery#restDescription",
  "documentationLink": "https://support.perspectiveapi.com",
  "canonicalName": "Comment Analyzer",
  "parameters": {
    "quotaUser": {
      "type": "string",
      "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.",
      "location": "query"
    },
    "upload_protocol": {
      "location": "query",
      "type": "string",
      "description": "Upload protocol for media (e.g. \"raw\", \"multipart\")."
    },
    "oauth_token": {
      "location": "query",
      "type": "string",
      "description": "OAuth 2.0 token for the current user."
    },
    "prettyPrint": {
      "default": "true",
      "type": "boolean",
      "description": "Returns response with indentations and line breaks.",
      "location": "query"
    },
    "access_token": {
      "type": "string",
      "description": "OAuth access token.",
      "location": "query"
    },
    "uploadType": {
      "type": "string",
      "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").",
      "location": "query"
    },
    "alt": {
      "type": "string",
      "description": "Data format for response.",
      "enum": [
        "json",
        "media",
        "proto"
      ],
      "enumDescriptions": [
        "Responses with Content-Type of application/json",
        "Media download with context-dependent Content-Type",
        "Responses with Content-Type of application/x-protobuf"
      ],
      "default": "json",
      "location": "query"
    },
    "$.xgafv": {
      "type": "string",
      "description": "V1 error format.",
      "enum": [
        "1",
        "2"
      ],
      "enumDescriptions": [
        "v1 error format",
        "v2 error format"
      ],
      "location": "query"
    },
    "fields": {
      "type": "string",
      "description": "Selector specifying which fields to include in a partial response.",
      "location": "query"
    },
    "key": {
      "type": "string",
      "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
      "location": "query"
    },
    "callback": {
      "type": "string",
      "description": "JSONP",
      "location": "query"
    }
  },
  "basePath": "",
  "schemas": {
    "AnalyzeCommentResponse": {
      "description": "The comment analysis response message.",
      "type": "object",
      "properties": {
        "attributeScores": {
          "additionalProperties": {
            "$ref": "AttributeScores"
          },
          "description": "Scores for the requested attributes. The map keys are attribute names (same as the requested_attribute field in AnalyzeCommentRequest, for example \"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc).",
          "type": "object"
        },
        "languages": {
          "description": "The language(s) used by CommentAnalyzer service to choose which Model to use when analyzing the comment. Might better be called \"effective_languages\". The logic used to make the choice is as follows: if !Request.languages.empty() effective_languages = Request.languages else effective_languages = detected_languages[0]",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "clientToken": {
          "description": "Same token from the original AnalyzeCommentRequest.",
          "type": "string"
        },
        "detectedLanguages": {
          "description": "Contains the languages detected from the text content, sorted in order of likelihood.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "id": "AnalyzeCommentResponse"
    },
    "AnalyzeCommentRequest": {
      "id": "AnalyzeCommentRequest",
      "description": "The comment analysis request message. Next ID: 13",
      "type": "object",
      "properties": {
        "languages": {
          "description": "The language(s) of the comment and context. If none are specified, we attempt to automatically detect the language. Specifying multiple languages means the text contains multiple lanugages. Both ISO and BCP-47 language codes are accepted. The server returns an error if no language was specified and language detection fails. The server also returns an error if the languages (either specified by the caller, or auto-detected) are not *all* supported by the service.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "requestedAttributes": {
          "additionalProperties": {
            "$ref": "AttributeParameters"
          },
          "description": "Specification of requested attributes. The AttributeParameters serve as configuration for each associated attribute. The map keys are attribute names. The available attributes may be different on each RFE installation, and can be seen by calling ListAttributes (see above). For the prod installation, known as Perspective API, see https://developers.perspectiveapi.com/s/about-the-api-model-cards.",
          "type": "object"
        },
        "sessionId": {
          "description": "Session ID. Used to join related RPCs into a single session. For example, an interactive tool that calls both the AnalyzeComment and SuggestCommentScore RPCs should set all invocations of both RPCs to the same Session ID, typically a random 64-bit integer.",
          "type": "string"
        },
        "spanAnnotations": {
          "description": "An advisory parameter that will return span annotations if the model is capable of providing scores with sub-comment resolution. This will likely increase the size of the returned message.",
          "type": "boolean"
        },
        "context": {
          "description": "The context of the comment.",
          "$ref": "Context"
        },
        "doNotStore": {
          "description": "Do not store the comment or context sent in this request. By default, the service may store comments/context for debugging purposes.",
          "type": "boolean"
        },
        "communityId": {
          "description": "Optional identifier associating this AnalyzeCommentRequest with a particular client's community. Different communities may have different norms and rules. Specifying this value enables us to explore building community-specific models for clients.",
          "type": "string"
        },
        "clientToken": {
          "description": "Opaque token that is echoed from the request to the response.",
          "type": "string"
        },
        "dropUnsupportedAttributes": {
          "description": "If specified, any requested attribute that is requested but not supported for the language detected will be dropped from the returned scores instead of returning an error.",
          "type": "boolean"
        },
        "comment": {
          "description": "The comment to analyze.",
          "$ref": "TextEntry"
        }
      }
    },
    "AttributeParameters": {
      "id": "AttributeParameters",
      "description": "Configurable parameters for attribute scoring.",
      "type": "object",
      "properties": {
        "scoreType": {
          "enumDescriptions": [
            "Unspecified. Defaults to PROBABILITY scores if available, and otherwise RAW. Every model has a RAW score.",
            "Probability scores are in the range [0, 1] and indicate level of confidence in the attribute label.",
            "Standard deviation scores are in the range (-inf, +inf).",
            "Percentile scores are in the range [0, 1] and indicate the percentile of the raw score, normalized with a test dataset. This is not generally recommended, as the normalization is dependent on the dataset used, which may not match other usecases.",
            "Raw scores are the raw values from the model, and may take any value. This is primarily for debugging/testing, and not generally recommended."
          ],
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ],
          "description": "What type of scores to return. If unset, defaults to probability scores.",
          "type": "string"
        },
        "scoreThreshold": {
          "description": "Don't return scores for this attribute that are below this threshold. If unset, a default threshold will be applied. A FloatValue wrapper is used to distinguish between 0 vs. default/unset.",
          "type": "number",
          "format": "float"
        }
      }
    },
    "SuggestCommentScoreRequest": {
      "id": "SuggestCommentScoreRequest",
      "properties": {
        "sessionId": {
          "description": "Session ID. Used to join related RPCs into a single session. For example, an interactive tool that calls both the AnalyzeComment and SuggestCommentScore RPCs should set all invocations of both RPCs to the same Session ID, typically a random 64-bit integer.",
          "type": "string"
        },
        "languages": {
          "description": "The language(s) of the comment and context. If none are specified, we attempt to automatically detect the language. Both ISO and BCP-47 language codes are accepted.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "communityId": {
          "description": "Optional identifier associating this comment score suggestion with a particular sub-community. Different communities may have different norms and rules. Specifying this value enables training community-specific models.",
          "type": "string"
        },
        "clientToken": {
          "description": "Opaque token that is echoed from the request to the response.",
          "type": "string"
        },
        "context": {
          "description": "The context of the comment.",
          "$ref": "Context"
        },
        "comment": {
          "description": "The comment being scored.",
          "$ref": "TextEntry"
        },
        "attributeScores": {
          "description": "Attribute scores for the comment. The map keys are attribute names, same as the requested_attribute field in AnalyzeCommentRequest (for example \"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc.). This field has the same type as the `attribute_scores` field in AnalyzeCommentResponse. To specify an overall attribute score for the entire comment as a whole, use the `summary_score` field of the mapped AttributeScores object. To specify scores on specific subparts of the comment, use the `span_scores` field. All SpanScore objects must have begin and end fields set. All Score objects must be explicitly set (for binary classification, use the score values 0 and 1). If Score objects don't include a ScoreType, `PROBABILITY` is assumed. `attribute_scores` must not be empty. The mapped AttributeScores objects also must not be empty. An `INVALID_ARGUMENT` error is returned for all malformed requests.",
          "type": "object",
          "additionalProperties": {
            "$ref": "AttributeScores"
          }
        }
      },
      "description": "The comment score suggestion request message.",
      "type": "object"
    },
    "SuggestCommentScoreResponse": {
      "description": "The comment score suggestion response message.",
      "type": "object",
      "properties": {
        "requestedLanguages": {
          "description": "The list of languages provided in the request.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "detectedLanguages": {
          "description": "The list of languages detected from the comment text.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "clientToken": {
          "description": "Same token from the original SuggestCommentScoreRequest.",
          "type": "string"
        }
      },
      "id": "SuggestCommentScoreResponse"
    },
    "SpanScore": {
      "description": "This is a single score for a given span of text.",
      "type": "object",
      "properties": {
        "end": {
          "type": "integer",
          "format": "int32"
        },
        "score": {
          "description": "The score value.",
          "$ref": "Score"
        },
        "begin": {
          "format": "int32",
          "description": "\"begin\" and \"end\" describe the span of the original text that the attribute score applies to. The values are the UTF-16 codepoint range. \"end\" is exclusive. For example, with the text \"Hi there\", the begin/end pair (0,2) describes the text \"Hi\". If \"begin\" and \"end\" are unset, the score applies to the full text.",
          "type": "integer"
        }
      },
      "id": "SpanScore"
    },
    "AttributeScores": {
      "id": "AttributeScores",
      "description": "This holds score values for a single attribute. It contains both per-span scores as well as an overall summary score..",
      "type": "object",
      "properties": {
        "spanScores": {
          "description": "Per-span scores.",
          "type": "array",
          "items": {
            "$ref": "SpanScore"
          }
        },
        "summaryScore": {
          "description": "Overall score for comment as a whole.",
          "$ref": "Score"
        }
      }
    },
    "TextEntry": {
      "description": "Represents a body of text.",
      "type": "object",
      "properties": {
        "text": {
          "description": "UTF-8 encoded text.",
          "type": "string"
        },
        "type": {
          "description": "Type of the text field.",
          "type": "string",
          "enumDescriptions": [
            "The content type is not specified. Text will be interpreted as plain text by default.",
            "Plain text.",
            "HTML."
          ],
          "enum": [
            "TEXT_TYPE_UNSPECIFIED",
            "PLAIN_TEXT",
            "HTML"
          ]
        }
      },
      "id": "TextEntry"
    },
    "Score": {
      "id": "Score",
      "description": "Analysis scores are described by a value and a ScoreType.",
      "type": "object",
      "properties": {
        "type": {
          "enumDescriptions": [
            "Unspecified. Defaults to PROBABILITY scores if available, and otherwise RAW. Every model has a RAW score.",
            "Probability scores are in the range [0, 1] and indicate level of confidence in the attribute label.",
            "Standard deviation scores are in the range (-inf, +inf).",
            "Percentile scores are in the range [0, 1] and indicate the percentile of the raw score, normalized with a test dataset. This is not generally recommended, as the normalization is dependent on the dataset used, which may not match other usecases.",
            "Raw scores are the raw values from the model, and may take any value. This is primarily for debugging/testing, and not generally recommended."
          ],
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ],
          "description": "The type of the above value.",
          "type": "string"
        },
        "value": {
          "description": "Score value. Semantics described by type below.",
          "type": "number",
          "format": "float"
        }
      }
    },
    "Context": {
      "id": "Context",
      "description": "Context is typically something that a Comment is referencing or replying to (such as an article, or previous comment). Note: Populate only ONE OF the following fields. The oneof syntax cannot be used because that would require nesting entries inside another message and breaking backwards compatibility. The server will return an error if more than one of the following fields is present.",
      "type": "object",
      "properties": {
        "entries": {
          "description": "A list of messages. For example, a linear comments section or forum thread.",
          "type": "array",
          "items": {
            "$ref": "TextEntry"
          }
        },
        "articleAndParentComment": {
          "description": "Information about the source for which the original comment was made, and any parent comment info.",
          "$ref": "ArticleAndParentComment"
        }
      }
    },
    "ArticleAndParentComment": {
      "id": "ArticleAndParentComment",
      "properties": {
        "parentComment": {
          "description": "Refers to text that is a direct parent of the source comment, such as in a one-deep threaded message board. This field will only be present for comments that are replies to other comments and will not be populated for direct comments on the article_text.",
          "$ref": "TextEntry"
        },
        "article": {
          "description": "The source content about which the comment was made (article text, article summary, video transcript, etc).",
          "$ref": "TextEntry"
        }
      },
      "description": "A type of context specific to a comment left on a single-threaded comment message board, where comments are either a top level comment or the child of a top level comment.",
      "type": "object"
    }
  },
  "mtlsRootUrl": "https://commentanalyzer.mtls.googleapis.com/"
}
