- [Resource: Document](https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#Document)
  - [JSON representation](https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#Document.SCHEMA_REPRESENTATION)
- [Type](https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#Type)
- [BoilerplateHandling](https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#BoilerplateHandling)
- [Methods](https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#METHODS_SUMMARY)

## Resource: Document

Represents the input to API methods.

| JSON representation |
|---|
| ``` { "type": enum (`https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#Type`), "language": string, "referenceWebUri": string, "boilerplateHandling": enum (`https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#BoilerplateHandling`), // Union field `source` can be only one of the following: "content": string, "gcsContentUri": string // End of list of possible types for union field `source`. } ``` |

| Fields ||
|---|---|
| `type` | ``enum (`https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#Type`)`` Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. |
| `language` | `string` 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. |
| `referenceWebUri` | `string` The web URI where the document comes from. This URI is not used for fetching the content, but as a hint for analyzing the document. |
| `boilerplateHandling` | ``enum (`https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents#BoilerplateHandling`)`` Indicates how detected boilerplate(e.g. advertisements, copyright declarations, banners) should be handled for this document. If not specified, boilerplate will be treated the same as content. |
| Union field `source`. The source of the document: a string containing the content or a Google Cloud Storage URI. `source` can be only one of the following: ||
| `content` | `string` The content of the input in string format. Cloud audit logging exempt since it is based on user data. |
| `gcsContentUri` | `string` The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucketName/object_name. For more details, see <https://cloud.google.com/storage/docs/reference-uris>. NOTE: Cloud Storage object versioning is not supported. |

## Type

The document types enum.

| Enums ||
|---|---|
| `TYPE_UNSPECIFIED` | The content type is not specified. |
| `PLAIN_TEXT` | Plain text |
| `HTML` | HTML |

## BoilerplateHandling

Ways of handling boilerplate detected in the document

| Enums ||
|---|---|
| `BOILERPLATE_HANDLING_UNSPECIFIED` | The boilerplate handling is not specified. |
| `SKIP_BOILERPLATE` | Do not analyze detected boilerplate. Reference web URI is required for detecting boilerplate. |
| `KEEP_BOILERPLATE` | Treat boilerplate the same as content. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeEntities` | Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for each entity, and other properties. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeEntitySentiment` | Finds entities, similar to `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeEntities#google.cloud.language.v1beta2.LanguageService.AnalyzeEntities` in the text and analyzes sentiment associated with each entity and its mentions. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeSentiment` | Analyzes the sentiment of the provided text. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/analyzeSyntax` | Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/annotateText` | A convenience method that provides all syntax, sentiment, entity, and classification features in one call. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/classifyText` | Classifies a document into categories. |
| ### `https://docs.cloud.google.com/natural-language/docs/reference/rest/v1beta2/documents/moderateText` | Moderates a document for harmful and sensitive categories. |