# Method: projects.locations.documents.create

Creates a document.

### HTTP request

`POST https://contentwarehouse.googleapis.com/v1/{parent}/documents`

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent name. Format: projects/{projectNumber}/locations/{location}. It takes the form `projects/{project}/locations/{location}`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "document": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/Document`) }, "requestMetadata": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/RequestMetadata`) }, "policy": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.ruleSets#Policy`) }, "cloudAiDocumentOption": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/CloudAIDocumentOption`) }, "createMask": string } ``` |

| Fields ||
|---|---|
| `document` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/Document`)`` Required. The document to create. |
| `requestMetadata` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/RequestMetadata`)`` The meta information collected about the end user, used to enforce access control for the service. |
| `policy` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.ruleSets#Policy`)`` Default document policy during creation. This refers to an Identity and Access (IAM) policy, which specifies access controls for the Document. Conditions defined in the policy will be ignored. |
| `cloudAiDocumentOption` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/CloudAIDocumentOption`)`` Request Option for processing Cloud AI Document in Document Warehouse. This field offers limited support for mapping entities from Cloud AI Document to Warehouse Document. Please consult with product team before using this field and other available options. |
| `createMask` | ``string (`https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask` format)`` Field mask for creating Document fields. If mask path is empty, it means all fields are masked. For the `FieldMask` definition, see <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask>. This is a comma-separated list of fully qualified names of fields. Example: `"user.displayName,photo"`. |

### Response body

Response message for DocumentService.CreateDocument.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "document": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/Document`) }, "ruleEngineOutput": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/RuleEngineOutput`) }, "metadata": { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/ResponseMetadata`) }, "longRunningOperations": [ { object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.operations#Operation`) } ] } ``` |

| Fields ||
|---|---|
| `document` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/Document`)`` Document created after executing create request. |
| `ruleEngineOutput` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/RuleEngineOutput`)`` Output from Rule Engine recording the rule evaluator and action executor's output. Refer format in: google/cloud/contentwarehouse/v1/rule_engine.proto |
| `metadata` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/ResponseMetadata`)`` Additional information for the API invocation, such as the request tracking id. |
| `longRunningOperations[]` | ``object (`https://docs.cloud.google.com/document-warehouse/docs/reference/rest/v1/projects.locations.operations#Operation`)`` post-processing LROs |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `contentwarehouse.documents.create`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).