---
title: "Trigger data export."
method: POST
path: "/organizations/{orgId}/dataexports/adhoc"
tags: ["ExportAdHoc"]
---

# Trigger data export.

`POST /organizations/{orgId}/dataexports/adhoc`

Trigger an ad-hoc Data Export. Each ad-hoc Export can be configured for exporting *only one of* either Usage or Operational data:

**Operational Data Exports**.
* **Entity Types**. Use the `operationalDataTypes` parameter to specify the entities whose operational data you want to include in the ad-hoc export.
* **Export Files**. For each of the entity types you select, when the ad-hoc export runs a separate file is compiled containing the operational data for all entities of that type that exist in your Organization

**Usage Data Exports**.
* Select the Meters and Accounts whose usage data you want to include in the ad-hoc export.
* You can use the `dimensionFilters` parameter to filter the usage data returned for export by adding specific values of non-numeric Dimension data fields on included Meters. Only the data collected for the values you've added for the selected Dimension fields will be included in the export.
* You can use the `aggregations` to apply aggregation methods the usage data returned for export. This restricts the range of usage data returned for export to only the data collected by aggregated fields on selected Meters. Nothing is returned for any non-aggregated fields on Meters. The usage data for Meter fields is returned as the values resulting from applying the selected aggregation method. See the [Aggregations for Queries - Options and Consequences](https://www.m3ter.com/docs/guides/data-explorer/usage-data-explorer-v2#aggregations-for-queries---understanding-options-and-consequences) for more details.
* If you've applied `aggregations` to the usage returned for export, you can then use the `groups` parameter to group the data by *Account*, *Dimension*, or *Time*.

**Date Range for Operational Data Exports**. To restrict the operational data included in the ad-hoc export by a date/time range, use the `startDate` date/time request parameter to specify the start of the time period. The export will include all operational data from the specified `startDate` up until the date/time the export job runs.

**Date Range for Usage Data Exports**. To restrict the usage data included in the ad-hoc export by date/time range, use the `startDate` and `endDate` date/time parameters:
* Both `startDate` and `endDate` are required.
* `endDate` must be after `startDate`.
* `endDate` cannot be after tomorrow at midnight UTC. For example if today is May 20th 2025, you can only choose `endDate` to be equal or before 2025-05-21T00:00:00.000Z.

**NOTE:** You can use the ExportJob `id` returned to check the status of the triggered ad-hoc export. See the [ExportJob](https://www.m3ter.com/docs/api#tag/ExportJob) section of this API Reference.

## Path parameters

- `orgId` string, required

## Request body

- union
  - AdHocOperationalDataExportConfigurationRequest
    - `sourceType` 'OPERATIONAL', required — The type of data to export. Possible values are: OPERATIONAL, USAGE.
    - `operationalDataTypes` OperationalDataType[], required — The list of the operational data types should be exported for.
    - `destinationIds` string[] — The destination ids. **Note:** If you omit a Destination, this means that when the Export job runs and has succeeded, you can download the data export file locally. For details, see the [Get Data Export File Download URL](https://www.m3ter.com/docs/api#tag/ExportDestination/operation/GenerateDataExportFileDownloadUrl) endpoint in this API Reference.
    - `exportFileFormat` 'CSV' | 'JSONL' — The export file format.
    - `startDate` string, date-time — The inclusive start date for the data export.
    - `version` integer — The version number of the entity: - **Create entity:** Not valid for initial insertion of new entity - *do not use for Create*. On initial Create, version is set at 1 and listed in the response. - **Update Entity:** On Update, version is required and must match the existing version because a check is performed to ensure sequential versioning is preserved. Version is incremented by 1 and listed in the response.
  - AdHocUsageDataExportConfigurationRequestV2
    - `sourceType` 'USAGE', required — The type of data to export. Possible values are: OPERATIONAL, USAGE.
    - `endDate` string, date-time — The exclusive end date for the data export.
    - `meterIds` string[] — List of meter IDs for which the usage data will be exported.
    - `accountIds` string[] — List of account IDs for which the usage data will be exported.
    - `dimensionFilters` DataExplorerDimensionFilter[] — List of dimension filters to apply
      - `meterId` string, required — Meter ID
      - `fieldCode` string, required — Field code
    - `aggregations` DataExplorerAggregation[] — List of aggregations to apply
      - `meterId` string, required — Meter ID
      - `fieldCode` string, required — Field code
    - `groups` DataExplorerGroup[] — List of groups to apply
      - `groupType` 'ACCOUNT' | 'DIMENSION' | 'TIME' — Type of group
    - `destinationIds` string[] — The destination ids. **Note:** If you omit a Destination, this means that when the Export job runs and has succeeded, you can download the data export file locally. For details, see the [Get Data Export File Download URL](https://www.m3ter.com/docs/api#tag/ExportDestination/operation/GenerateDataExportFileDownloadUrl) endpoint in this API Reference.
    - `exportFileFormat` 'CSV' | 'JSONL' — The export file format.
    - `startDate` string, date-time — The inclusive start date for the data export.
    - `version` integer — The version number of the entity: - **Create entity:** Not valid for initial insertion of new entity - *do not use for Create*. On initial Create, version is set at 1 and listed in the response. - **Update Entity:** On Update, version is required and must match the existing version because a check is performed to ensure sequential versioning is preserved. Version is incremented by 1 and listed in the response.

## Response `200`

Returns the job id for the ah-hoc data export.

- AdHocResponse — Response containing data export ad-hoc jobId
  - `jobId` string — The id of the job

## Other responses

- `4XX` — Error message
- `5XX` — Error message

---

[API](https://skmtc.net/m3ter-com/apis/m3ter-api.md) · [All operations](https://skmtc.net/m3ter-com/apis/m3ter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/m3ter-com/m3ter-api/revisions/ac93d1a9e6d9/schema)
