- [HTTP request](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#body.request_body)
- [Response body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#body.aspect)
- [Try it!](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents/create#try-it)

Creates a new document.

This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields:

- `metadata`: `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/KnowledgeOperationMetadata`
- `response`: `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents#Document`

### HTTP request

Choose an endpoint:
global   
`POST https://dialogflow.googleapis.com/v2/{parent=projects/*/agent/knowledgeBases/*}/documents`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

**OR**

`POST https://{endpoint}/v2/{parent=projects/*/agent/knowledgeBases/*}/documents`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest#rest_endpoints).

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The knowledge base to create a document for. Format: `projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `dialogflow.documents.create` |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.agent.knowledgeBases.documents#Document`.

### Response body

If successful, the response body contains a newly created instance of `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2/projects.locations.operations#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

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

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