# Method: projects.locations.deployments.exportState

- [HTTP request](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/projects.locations.deployments/exportState#try-it)

Exports Terraform state file from a given deployment.

### HTTP request

`POST https://config.googleapis.com/v1/{parent=projects/*/locations/*/deployments/*}:exportState`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent in whose context the statefile is listed. The parent value is in the format: 'projects/{projectId}/locations/{location}/deployments/{deployment}'. It takes the form `projects/{project}/locations/{location}/deployments/{deployment}`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "draft": boolean } ``` |

| Fields ||
|---|---|
| `draft` | `boolean` Optional. If this flag is set to true, the exported deployment state file will be the draft state. This will enable the draft file to be validated before copying it over to the working state on unlock. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/infrastructure-manager/docs/reference/rest/v1/Statefile`.

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `config.googleapis.com/config.deployments.getState`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).