---
title: "POST /v2/documents:moderateText"
method: POST
path: "/v2/documents:moderateText"
tags: ["documents"]
---

# POST /v2/documents:moderateText

`POST /v2/documents:moderateText`

Moderates a document for harmful and sensitive categories.

## Request body

- ModerateTextRequest — The document moderation request message.
  - `modelVersion` 'MODEL_VERSION_UNSPECIFIED' | 'MODEL_VERSION_1' | 'MODEL_VERSION_2' — Optional. The model version to use for ModerateText.
  - `document` Document — Represents the input to API methods.
    - `languageCode` string — Optional. The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned.
    - `gcsContentUri` string — The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
    - `type` 'TYPE_UNSPECIFIED' | 'PLAIN_TEXT' | 'HTML' — Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error.
    - `content` string — The content of the input in string format. Cloud audit logging exempt since it is based on user data.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/language.md) · [All operations](https://skmtc.dev/google/apis/language/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/language/revisions/8a5bd20b70e8/schema)
