> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# m3ter Functions

## Bulk retrieve m3ter entities

**Function name:** `BulkGetM3terEntityFunction`
**Category:** Read
**Destination:** m3ter

Read a list of m3ter entities from a list endpoint by consuming an iterator of entity IDs

### Parameters

| Name                       | Label                         | Required | Description                                                                                                   |
| -------------------------- | ----------------------------- | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                   |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                  |    Yes   | The name of the m3ter entity                                                                                  |
| `m3terEntityIdsIterator`   | m3ter entity ID iterator name |    Yes   | The name of the iterator containing m3ter entity UUIDs                                                        |
| `stateVariable`            | Output state name             |    Yes   | Name of the variable by which the objects iterator will be stored in state                                    |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Create m3ter external mapping

**Function name:** `CreateExternalMappingFunction`
**Category:** Write
**Destination:** m3ter

Creates an external mapping between a m3ter entity and an external system

### Parameters

| Name                    | Label                        | Required | Description                                                                                        |
| ----------------------- | ---------------------------- | :------: | -------------------------------------------------------------------------------------------------- |
| `m3terEntity`           | m3ter Entity Type            |    Yes   | The name of the m3ter entity type                                                                  |
| `m3terIdPath`           | m3ter ID Path                |    Yes   | The path of the m3ter UUID to lookup in the state                                                  |
| `externalSystem`        | External System              |    Yes   | The name of the external system                                                                    |
| `externalTable`         | External Table               |    Yes   | The name of the external table                                                                     |
| `externalIdPath`        | External ID Path             |    Yes   | The path of the external ID to lookup in the state                                                 |
| `duplicateRunForEntity` | Duplicate run log for entity |    No    | If enabled, the run is also associated with the m3ter entity this external mapping was created for |

### Exits

| Exit   | Description |
| ------ | ----------- |
| `NEXT` | -           |

## Create m3ter Entity

**Function name:** `CreateM3terEntityFunction`
**Category:** Write
**Destination:** m3ter

Create a m3ter entity with a payload

### Parameters

| Name                       | Label                          | Required | Description                                                                                                   |
| -------------------------- | ------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                    |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                   |    Yes   | The name of the m3ter entity                                                                                  |
| `payloadPath`              | Path to m3ter entity payload   |    Yes   | The path to the m3ter entity create payload                                                                   |
| `responsePath`             | Path to entity create response |    No    | The path to save the m3ter entity create response                                                             |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path  |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Delete External Mapping

**Function name:** `DeleteExternalMappingsForExternalEntityFunction`
**Category:** Write
**Destination:** m3ter

Delete External Mappings for a external system, table, and external ID

### Parameters

| Name             | Label            | Required | Description                       |
| ---------------- | ---------------- | :------: | --------------------------------- |
| `externalSystem` | External System  |    Yes   | The external system               |
| `externalTable`  | External Table   |    Yes   | The external table (e.g Customer) |
| `stateVariable`  | External ID path |    Yes   | The path to the ID in the state   |

### Exits

| Exit   | Description |
| ------ | ----------- |
| `NEXT` | -           |

## Delete m3ter Entity

**Function name:** `DeleteM3terEntityFunction`
**Category:** Write
**Destination:** m3ter

Delete a m3ter entity

### Parameters

| Name                       | Label                          | Required | Description                                                                                                   |
| -------------------------- | ------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                    |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                   |    Yes   | The name of the m3ter entity                                                                                  |
| `m3terEntityIdPath`        | m3ter entity UUID path         |    Yes   | The path to the UUID of the m3ter entity to delete (e.g event.new\.id)                                        |
| `responsePath`             | Path to entity update response |    No    | The path to save the m3ter entity update response                                                             |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path  |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Lookup external ID for m3ter entity

**Function name:** `ExternalMappingExistsForM3terFunction`
**Category:** Logic
**Destination:** m3ter

Look for an external mapping for a m3ter entity and destination

### Parameters

| Name                    | Label                           | Required | Description                                                                                     |
| ----------------------- | ------------------------------- | :------: | ----------------------------------------------------------------------------------------------- |
| `m3terEntity`           | m3ter Entity Type               |    Yes   | The name of the m3ter entity type                                                               |
| `m3terIdPath`           | m3ter ID Path                   |    Yes   | The path to the m3ter UUID to lookup                                                            |
| `externalSystem`        | External System                 |    Yes   | The name of the external system                                                                 |
| `externalTable`         | External Table                  |    No    | The name of the external table                                                                  |
| `stateVariable`         | External ID State Variable Name |    No    | The name to use to save the external ID to the state                                            |
| `duplicateRunForEntity` | Duplicate run log for entity    |    No    | If enabled and an external mapping is found, the run will also associated with the m3ter entity |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `TRUE`  | -           |
| `FALSE` | -           |

## Lookup m3ter entity UUID

**Function name:** `ExternalMappingExistsForSystemFunction`
**Category:** Logic
**Destination:** m3ter

Look for an external mapping for an external service, table, and ID

### Parameters

| Name             | Label                        | Required | Description                                         |
| ---------------- | ---------------------------- | :------: | --------------------------------------------------- |
| `externalSystem` | External System              |    Yes   | The external system                                 |
| `externalTable`  | External Table               |    Yes   | The external table name                             |
| `externalIdPath` | External ID Path             |    Yes   | The path to the external ID to lookup               |
| `stateVariable`  | m3ter ID State Variable Name |    No    | The name to use to save the m3ter UUID to the state |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `TRUE`  | -           |
| `FALSE` | -           |

## Get m3ter Entity

**Function name:** `GetM3terEntityFunction`
**Category:** Read
**Destination:** m3ter

Get a m3ter entity

### Parameters

| Name                       | Label                         | Required | Description                                                                                                   |
| -------------------------- | ----------------------------- | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                   |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                  |    Yes   | The name of the m3ter entity                                                                                  |
| `m3terEntityIdPath`        | m3ter entity UUID path        |    Yes   | The path to the UUID of the m3ter entity to get (e.g event.new\.id)                                           |
| `responsePath`             | Path to entity get response   |    No    | The path to save the m3ter entity get response                                                                |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## List m3ter entities

**Function name:** `ListM3terEntityFunction`
**Category:** Read
**Destination:** m3ter

Read a list of m3ter entities from a list endpoint. The data is retrieved by pages

### Parameters

| Name                       | Label                         | Required | Description                                                                                                   |
| -------------------------- | ----------------------------- | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                   |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                  |    Yes   | The name of the m3ter entity                                                                                  |
| `stateVariable`            | Output state name             |    Yes   | Name of the variable by which the objects iterator will be stored in state                                    |
| `queryParameters`          | Query parameters              |    No    | Optional query parameters to include in the request                                                           |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Update external bill

**Function name:** `UpdateExternalReferenceOnM3terBillFunction`
**Category:** Write
**Destination:** m3ter

Updates the external reference on a m3ter bill

### Parameters

| Name                             | Label                   | Required | Description                                                          |
| -------------------------------- | ----------------------- | :------: | -------------------------------------------------------------------- |
| `m3terBillUuidStateVariable`     | m3ter Bill UUID path    |    Yes   | The path to the UUID of the m3ter bill to update (e.g event.new\.id) |
| `externalReferenceStateVariable` | External reference path |    Yes   | The path to the reference of the external Invoice.                   |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Update m3ter Entity

**Function name:** `UpdateM3terEntityFunction`
**Category:** Write
**Destination:** m3ter

Update a m3ter entity with a payload

### Parameters

| Name                       | Label                          | Required | Description                                                                                                   |
| -------------------------- | ------------------------------ | :------: | ------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials                    |    Yes   | The m3ter credentials to use.                                                                                 |
| `m3terEntity`              | m3ter Entity                   |    Yes   | The name of the m3ter entity                                                                                  |
| `m3terEntityIdPath`        | m3ter entity UUID path         |    Yes   | The path to the UUID of the m3ter entity to update (e.g event.new\.id)                                        |
| `payloadPath`              | Path to m3ter Entity Payload   |    Yes   | The path to the m3ter entity update payload                                                                   |
| `responsePath`             | Path to entity update response |    No    | The path to save the m3ter entity update response                                                             |
| `parentM3terEntityIdPath`  | Parent m3ter entity UUID path  |    No    | The path to the UUID of the parent entity for the m3ter entity targeted by this operation (e.g event.new\.id) |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |

## Upload Measurements File

**Function name:** `UploadMeasurementsFunction`
**Category:** Write
**Destination:** m3ter

Upload measurements from a list or iterator and uploads them to m3ter via presigned URL(s)

### Parameters

| Name                       | Label           | Required | Description                                                                 |
| -------------------------- | --------------- | :------: | --------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials     |    Yes   | The m3ter credentials to use.                                               |
| `source`                   | Measurements    |    Yes   | State path to a list of measurements, or the name of an iterator, to upload |
| `jobIdVariable`            | Job ID location |    No    | Optional state location to store the jobId.                                 |

### Exits

| Exit    | Description |
| ------- | ----------- |
| `NEXT`  | -           |
| `ERROR` | -           |
