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:
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,// Union field source can be only one of the following:"gcsSource": {object (GcsSources)}// End of list of possible types for union field source.}
Required. Document template used for importing all the documents.
importGcsCustomMetadata
boolean
Whether to import custom metadata from Google Cloud Storage. Only valid when the document source is Google Cloud Storage URI.
Union field source. Required. The source to use for importing documents.
If the source captures multiple objects, then multiple documents will be created, one corresponding to each object, and all of these documents will be created using the same document template.
Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error. source can be only one of the following:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-27 UTC."],[[["\u003cp\u003eThis method allows importing up to 350 documents from external sources into Dialogflow in a single request.\u003c/p\u003e\n"],["\u003cp\u003eThe process of importing documents is a long-running operation, providing metadata and a response upon completion.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request is a POST request to a specified endpoint with a defined path parameter \u003ccode\u003eparent\u003c/code\u003e, indicating the knowledge base destination.\u003c/p\u003e\n"],["\u003cp\u003eThe request body includes required fields such as \u003ccode\u003edocumentTemplate\u003c/code\u003e and a union field \u003ccode\u003esource\u003c/code\u003e to define the origin of the documents, with \u003ccode\u003egcsSource\u003c/code\u003e as a possible source that specifies the Google Cloud Storage location.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication for this operation requires either the \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/dialogflow\u003c/code\u003e OAuth scopes.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.knowledgeBases.documents.import\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreate 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.\n\nThis 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:\n\n- `metadata`: [KnowledgeOperationMetadata](/dialogflow/es/docs/reference/rest/v2beta1/KnowledgeOperationMetadata)\n- `response`: [ImportDocumentsResponse](/dialogflow/es/docs/reference/rest/v2beta1/ImportDocumentsResponse)\n\n### HTTP request\n\n`POST https://{endpoint}/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import`\n\nWhere `{endpoint}` is one of the [supported service endpoints](/dialogflow/es/docs/reference/rest#rest_endpoints).\n\nThe URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.operations#Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n- `\n https://www.googleapis.com/auth/dialogflow`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]