Method: projects.knowledgeBases.documents.import

Stay organized with collections Save and categorize content based on your preferences.

Create documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

HTTP request

POST https://{endpoint}/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import

Where {endpoint} is one of the supported service endpoints.

The URLs use gRPC Transcoding syntax.

Path parameters



Required. The knowledge base to import documents into. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

Authorization requires the following IAM permission on the specified resource parent:

  • dialogflow.documents.create

Request body

The request body contains data with the following structure:

JSON representation
  "documentTemplate": {
    object (ImportDocumentTemplate)
  "importGcsCustomMetadata": boolean,
  "gcsSource": {
    object (GcsSources)

object (ImportDocumentTemplate)

Required. Document template used for importing all the documents.



Whether to import custom metadata from Google Cloud Storage. Only valid when the document source is Google Cloud Storage URI.


object (GcsSources)

The Google Cloud Storage location for the documents. The path can include a wildcard.

These URIs may have the forms gs://<bucket-name>/<object-name>. gs://<bucket-name>/<object-path>/*.<extension>.

Response body

If successful, the response body contains an instance of Operation.

Authorization Scopes

Requires one of the following OAuth scopes:


For more information, see the Authentication Overview.