Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please callagent.trainand wait for the operation it returns in order to train explicitly.
This method is along-running operation. The returnedOperationtype has the following method-specific fields:
Required. The project that the agent to restore is associated with. Format:projects/<Project ID>.
Authorization requires the followingIAMpermission on the specified resourceparent:
dialogflow.agents.restore
Request body
The request body contains data with the following structure:
JSON representation
{// Union fieldagentcan be only one of the following:"agentUri":string,"agentContent":string// End of list of possible types for union fieldagent.}
Fields
Union fieldagent. Required. The agent to restore.agentcan be only one of the following:
agentUri
string
The URI to a Google Cloud Storage file containing the agent to restore. Note: The URI must start with "gs://".
Dialogflow performs a read operation for the Cloud Storage object on the caller's behalf, so your request authentication must have read permissions for the object. For more information, seeDialogflow access control.
[[["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 operation restores a Dialogflow agent from a ZIP file, replacing the current version and deleting all existing intents and entity types.\u003c/p\u003e\n"],["\u003cp\u003eRestoring an agent triggers automatic training, but the training process may not be immediately complete, requiring a separate \u003ccode\u003eagent.train\u003c/code\u003e call and waiting for its completion.\u003c/p\u003e\n"],["\u003cp\u003eThe HTTP request for agent restoration is a \u003ccode\u003ePOST\u003c/code\u003e request to a specific endpoint with the necessary path parameters, including the project ID.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must contain either the URI of a Google Cloud Storage file (\u003ccode\u003eagentUri\u003c/code\u003e) or the zip-compressed raw content of the agent (\u003ccode\u003eagentContent\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe operation is a long-running process and uses specific fields like \u003ccode\u003emetadata\u003c/code\u003e and \u003ccode\u003eresponse\u003c/code\u003e, along with specific OAuth scopes for authorization.\u003c/p\u003e\n"]]],[],null,["# Method: projects.agent.restore\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\nRestores the specified agent from a ZIP file.\n\nReplaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [agent.train](/dialogflow/es/docs/reference/rest/v2/projects.agent/train#google.cloud.dialogflow.v2.Agents.TrainAgent) and wait for the operation it returns in order to train explicitly.\n\nThis method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:\n\n- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)\n- `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)\n\nThe operation only tracks when restoring is complete, not when it is done training.\n\nNote: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).\n\n### HTTP request\n\n`POST https://{endpoint}/v2/{parent=projects/*}/agent:restore`\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)."]]