Creates 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 imports data from external sources to create documents in Dialogflow, with a limit of 350 documents per request.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request is a POST request to a specific endpoint with a defined URL structure, using gRPC Transcoding syntax.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eparent\u003c/code\u003e path parameter is required, specifying the knowledge base for document import, and requires \u003ccode\u003edialogflow.documents.create\u003c/code\u003e IAM permission.\u003c/p\u003e\n"],["\u003cp\u003eThe request body contains a \u003ccode\u003edocumentTemplate\u003c/code\u003e object and a \u003ccode\u003esource\u003c/code\u003e field, which can be \u003ccode\u003egcsSource\u003c/code\u003e specifying the Google Cloud Storage location.\u003c/p\u003e\n"],["\u003cp\u003eThe operation requires one of two specified OAuth scopes for authorization: \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/dialogflow\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: projects.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\nCreates 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/v2/KnowledgeOperationMetadata)\n- `response`: [ImportDocumentsResponse](/dialogflow/es/docs/reference/rest/v2/ImportDocumentsResponse)\n\n### HTTP request\n\n`POST https://{endpoint}/v2/{parent=projects/*/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/v2/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)."]]