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 webpage outlines how to import documents into Dialogflow, supporting up to 350 documents per request.\u003c/p\u003e\n"],["\u003cp\u003eThe process is a long-running operation, and the response provides metadata and import results, using an operation type.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request uses a POST method to a specific endpoint, with the parent knowledge base as a required path parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe request body includes a document template, an option to import custom metadata, and the source location, which can be from Google Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires specific OAuth scopes, such as \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\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/*/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)."]]