# Method: folders.locations.usageHistories.export

- [HTTP request](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/folders.locations.usageHistories/export#body.aspect_1)

Exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

### HTTP request

`POST https://capacityplanner.googleapis.com/v1beta/{parent=folders/*/locations/*}/usageHistories:export`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The compute engine resource and location for the time series values to return. The format is: projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location} |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "isSpot": boolean, "machineFamily": string, "machineShape": { object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/MachineShape`) }, "diskType": string, "gpuType": string, "tpuType": string, "resourceType": string, "usageAggregationMethod": enum (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/AggregationMethod`), "startDate": { object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/Date`) }, "endDate": { object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/Date`) }, "outputConfig": { object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/OutputConfig`) } } ``` |

| Fields ||
|---|---|
| `isSpot` | `boolean` Optional. The isSpot flag is used to fetch the usage data for preemptible Resources. |
| `machineFamily` | `string` Optional. The machine family for the `UsageHistory` values to return. Possible values include "n1", and "n2d". See <https://cloud.google.com/compute/docs/machine-types> for more examples. |
| `machineShape` | ``object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/MachineShape`)`` Optional. The machine shape for the time series values to export. |
| `diskType` | `string` Optional. The diskType for the `UsageHistory` values to return request with persistent-disk resourceType. Possible values include "pd-ssd", "pd-standard", "pd-balanced", and "pd-extreme". |
| `gpuType` | `string` Optional. The GPU type for the `UsageHistory` values to return. Sample values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See <https://cloud.google.com/compute/docs/gpus> for a list. Empty gpuType will return results matching all GPUs. |
| `tpuType` | `string` Optional. The TPU type for the `UsageHistory` values to return. Empty tpuType will return results matching all TPUs. |
| `resourceType` | `string` Required. The resource for the `UsageHistory` values to return. Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk", "gce-gpu" and "gce-tpu". |
| `usageAggregationMethod` | ``enum (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/AggregationMethod`)`` Optional. The method that should be used to convert sampled usage data to daily usage values. AGGREGATION_METHOD_UNSPECIFIED will return results matching all the aggregation methods. |
| `startDate` | ``object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/Date`)`` Optional. The start date of usage. |
| `endDate` | ``object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/Date`)`` Optional. The end date of usage. |
| `outputConfig` | ``object (`https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/OutputConfig`)`` Required. Output configuration indicating where the results will be output to. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/capacity-planner/docs/reference/rest/v1beta/Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

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

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:

- `capacityplanner.usageHistories.list`

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