> ## 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.

# Bills

## List Bills

**Function name:** `m3ter_ListBills`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Retrieve a list of Bills.

This endpoint retrieves a list of all Bills for the given Account within the specified Organization. Optional filters can be applied such as by date range, lock status, or other attributes. The list can also be paginated for easier management.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                | Constraints                                                                                                                                                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST                                                                                                                                 |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.      | -                                                                                                                                                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request | allowedValues: accountId,locked,excludeLineItems,includeBillTotal,status,billDate,billDateStart,billDateEnd,externalInvoiceDateStart,externalInvoiceDateEnd,ids,billJobId,additional,billingFrequency |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Bill Statement in JSON Format

**Function name:** `m3ter_GetBillJsonStatement`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve a Bill Statement in JSON format for a given Bill ID.

Bill Statements are backing sheets to the invoices sent to your customers. Bill Statements provide a breakdown of the usage responsible for the usage charge line items shown on invoices.

The response to this call returns a pre-signed `downloadUrl`, which you use with a `GET` call to obtain the Bill Statement.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                                                            | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                                          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill for which you want to retrieve the Statement. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.                                                  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Debit Line Item

**Function name:** `m3ter_GetDebitLineItem`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve the Debit line item with the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                  | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | -------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the bill.                            | -                                                                     |
| `id`                       | id          | LookupParameter        |    Yes   | The UUID of the debit line item to retrieve. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.        | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Update Debit Line Item

**Function name:** `m3ter_PutDebitLineItem`
**Category:** WRITE
**HTTP method:** PUT
**Destination:** m3ter

Update the Debit line item with the given UUID.

### Parameters

| Name                       | Label        | Type                   | Required | Description                                | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId       | LookupParameter        |    Yes   | UUID of the bill.                          | -                                                                     |
| `id`                       | id           | LookupParameter        |    Yes   | The UUID of the debit line item to update. | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request.     | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.      | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Delete Debit Line Item

**Function name:** `m3ter_DeleteDebitLineItem`
**Category:** WRITE
**HTTP method:** DELETE
**Destination:** m3ter

Delete the Debit line item with the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                           | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.         | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the bill.                     | -                                                                     |
| `id`                       | id          | LookupParameter        |    Yes   | UUID of the debit line item.          | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response. | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Credit Line Item

**Function name:** `m3ter_GetCreditLineItem`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve the Credit line item with the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                   | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | --------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                 | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the Bill.                             | -                                                                     |
| `id`                       | id          | LookupParameter        |    Yes   | The UUID of the Credit line item to retrieve. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.         | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Update Credit Line Item

**Function name:** `m3ter_PutCreditLineItem`
**Category:** WRITE
**HTTP method:** PUT
**Destination:** m3ter

Update the Credit line item with the given UUID.

### Parameters

| Name                       | Label        | Type                   | Required | Description                                 | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | ------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.               | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId       | LookupParameter        |    Yes   | UUID of the bill.                           | -                                                                     |
| `id`                       | id           | LookupParameter        |    Yes   | The UUID of the credit line item to update. | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request.      | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.       | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Delete Credit Line Item

**Function name:** `m3ter_DeleteCreditLineItem`
**Category:** WRITE
**HTTP method:** DELETE
**Destination:** m3ter

Delete the Credit line item with the given UUID.

### Parameters

| Name                       | Label       | Type                   | Required | Description                             | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | --------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.           | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the bill.                       | -                                                                     |
| `id`                       | id          | LookupParameter        |    Yes   | UUID of the credit line item to delete. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.   | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Line Item

**Function name:** `m3ter_GetBillLineItem`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieves a specific line item within a Bill.

This endpoint retrieves the line item given by its unique identifier (UUID) from a specific Bill.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                                         | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                                       | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId           | LookupParameter         |    Yes   | The unique identifier (UUID) of the Bill containing the line item.  | -                                                                     |
| `id`                       | id               | LookupParameter         |    Yes   | The unique identifier (UUID) of the line item you want to retrieve. | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.                               | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request                          | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Line Item Usage in JSON Format

**Function name:** `m3ter_GetBillLineItemJsonUsage`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve the line item with the given UUID in JSON format.

This endpoint retrieves detailed usage information for a specific billing line item in JSON format. It is designed to provide granular insights into the consumption pattern for the given line item.

The response includes a pre-signed `downloadUrl`, which must be used with a separate `GET` call to download the Bill line item. This ensures secure access to the requested information.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                                                         | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                                       | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the Bill                                                                    | -                                                                     |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill line item for which to retrieve the usage. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.                                               | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Download Bills URL

**Function name:** `m3ter_DownloadBillsCsvUrl`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Generate a URL for downloading a CSV file containing a comprehensive list of Bills data  for the specified organization for a specified period. This endpoint facilitates easy exporting of billing data for external analysis and reporting.

The response to this call returns a pre-signed `downloadUrl`, which you then enter into your browser to download the CSV file of the Bill entities.

You can use the `externalSystem` request parameter to control the format of the Bills data in the CSV file:

* **STANDARD** A wider range of Bills data columns is given.
* **XERO** A more limited range of data columns is given and compatible with loading into your 3rd-party Xero system.

**NOTES:**

* **Download Limits**. You can only download Bills for a period of up to 31 days or up to a maximum of 5000 Bills. If you attempt a download that exceeds either of these two limits, you'll receive an error message
* **Empty Bills**. The CSV formatted file is compiled for download by taking each of the line items found in Bills that exist in your Organization for the specified period. The Bill for each line item record is given, along with Bill Total and other billing attributes. However, this means that if you have an *empty Bill* that exists for the specified period - one for which *no line items currently exist* - then no line item records will be shown for this Bill in the CSV file you download.

### Parameters

| Name                       | Label        | Type                   | Required | Description                            | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | -------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request. | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Approve Bills

**Function name:** `m3ter_ApproveBills`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Approve multiple Bills for the specified Organization based on the given criteria.

This endpoint allows you to change currently *Pending* Bills to *Approved* status for further processing.

Query Parameters:

* Use `accountIds` to approve Bills for specifed Accounts.

Request Body Schema Parameter:

* Use `billIds` to specify a collection of Bills for batch approval.

**Important!** If you use the `billIds` Request Body Schema parameter, any Query parameters you might have also used are ignored when the call is processed.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                | Constraints                                                               |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------ | ------------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST     |
| `requestPath`              | Request Path     | StateVariableParameter  |    Yes   | State variable containing the request.     | -                                                                         |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.      | -                                                                         |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request | allowedValues: externalInvoiceDateStart,externalInvoiceDateEnd,accountIds |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Search Bills

**Function name:** `m3ter_SearchBills`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Search for Bill entities.

This endpoint executes a search query for Bills based on the user specified search criteria. The search query is customizable, allowing for complex nested conditions and sorting. The returned list of Bills can be paginated for easier management.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.      | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request | allowedValues: searchQuery,fromDocument,operator,sortBy,sortOrder     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve latest Bill

**Function name:** `m3ter_GetLatestBill`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve the latest Bill for the given Account.

This endpoint retrieves the latest Bill for the given Account in the specified Organization. It facilitates tracking of the most recent charges and consumption details.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                                                                | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                                                              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `accountId`                | accountId        | LookupParameter         |    Yes   | The unique identifier (UUID) of the Account for which the latest Bill should be retrieved. | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.                                                      | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request                                                 | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Update Bill Status

**Function name:** `m3ter_UpdateBillStatus`
**Category:** WRITE
**HTTP method:** PUT
**Destination:** m3ter

Updates the status of a specified Bill with the given Bill ID.

This endpoint allows you to transition a Bill's status through various stages, such as from "Pending" to "Approved".

### Parameters

| Name                       | Label        | Type                   | Required | Description                                                               | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | ------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                             | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id           | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill whose status you want to update. | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request.                                    | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.                                     | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Bill Statement in CSV Format

**Function name:** `m3ter_GetBillCsvStatement`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve a specific Bill Statement for the given Bill UUID in CSV format.

Bill Statements are backing sheets to the invoices sent to your customers. Bill Statements provide a breakdown of the usage responsible for the usage charge line items shown on invoices.

The response includes a pre-signed `downloadUrl`, which must be used with a separate `GET` call to download the actual Bill Statement. This ensures secure access to the requested information.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                                                                 | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                                               | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill for which to retrieve the Statement in CSV format. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.                                                       | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Create Bill Statement in CSV Format

**Function name:** `m3ter_CreateBillCsvStatement`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Generate a specific Bill Statement for the provided Bill UUID in CSV format.

Bill Statements are backing sheets to the invoices sent to your customers. Bill Statements provide a breakdown of the usage responsible for the usage charge line items shown on invoices.

The response to this call returns a pre-signed `downloadUrl`, which you then use with a `GET` call to obtain the Bill statement in CSV format.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                                                                          | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                                                        | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill for which you want to generate the Statement in CSV format. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.                                                                | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## List Credit Line Items

**Function name:** `m3ter_ListCreditLineItems`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

List the Credit line items for the given Bill.

### Parameters

| Name                       | Label       | Type                   | Required | Description                           | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.         | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the bill.                     | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response. | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Create Credit Line Item

**Function name:** `m3ter_PostCreditLineItem`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Create a new Credit line item for the given Bill.

When creating Credit line items for Bills, use the Credit Reasons created for your Organization. See [CreditReason](https://www.m3ter.com/docs/api#tag/CreditReason).

### Parameters

| Name                       | Label        | Type                   | Required | Description                            | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | -------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId       | LookupParameter        |    Yes   | UUID of the bill.                      | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request. | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Bills in Billing Period

**Function name:** `m3ter_GetAllBillsInBillingPeriod`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Retrieve all Bills within a specified billing period. This endpoint allows you to retrieve Bills on various frequencies, such as daily, weekly, monthly, or annually. Specify the last day of the period to define the range.

For example, to retrieve all Bills on monthly billing up to September with due date of 1st of month, use the last day of September, which is September 30th.

The list can also be paginated for easier management.

### Parameters

| Name                       | Label                   | Type                    | Required | Description                                                                                                                     | Constraints                                                           |
| -------------------------- | ----------------------- | ----------------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials             | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                                                                                                   | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `lastDateInBillingPeriod`  | lastDateInBillingPeriod | LookupParameter         |    Yes   | The last date of the billing period for which you want to retrieve Bills. This date defines the range of Bills to be retrieved. | -                                                                     |
| `billingFrequency`         | billingFrequency        | LookupParameter         |    Yes   | The billing frequency for the specified period. Valid options are daily, weekly, monthly, or annually.                          | -                                                                     |
| `statePath`                | State Path              | StateVariableParameter  |    No    | State variable to store the response.                                                                                           | -                                                                     |
| `queryParams`              | Query Parameters        | KeyValueLookupParameter |    No    | Query parameters to include in the request                                                                                      | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## List Line Items

**Function name:** `m3ter_ListBillLineItems`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Lists all the line items for a specific Bill.

This endpoint retrieves a list of line items for the given Bill within the specified Organization. The list can also be paginated for easier management. The line items returned in the list include individual charges, discounts, or adjustments within a Bill.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                                                         | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                                                       | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId           | LookupParameter         |    Yes   | The unique identifier (UUID) of the Bill for which you want to list the line items. | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.                                               | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request                                          | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Lock Bill

**Function name:** `m3ter_LockBill`
**Category:** WRITE
**HTTP method:** PUT
**Destination:** m3ter

Lock the specific Bill identified by the given UUID. Once a Bill is locked, no further changes can be made to it.

**NOTE:** You cannot lock a Bill whose current status is `PENDING`. You will receive an error message if you try to do this. You must first use the [Approve Bills](https://docs.m3ter.com/api/bill/approve-bills) call to approve a Bill before you can lock it.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                       | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                     | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill to lock. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.             | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Approve Bills in Billing Period

**Function name:** `m3ter_ApproveAllBillsInBillingPeriod`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Approve all Bills within a specified billing period. This endpoint allows you to approve Bills on various frequencies, such as daily, weekly, monthly, or annually. Specify the last day of the period to define the range.

For example, to approve all Bills on monthly billing up to September with due date of 1st of month, use the last day of September, which is September 30th.

### Parameters

| Name                       | Label                   | Type                   | Required | Description                                                                                                                   | Constraints                                                           |
| -------------------------- | ----------------------- | ---------------------- | :------: | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials             | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                                                                                                 | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `lastDateInBillingPeriod`  | lastDateInBillingPeriod | LookupParameter        |    Yes   | The last date of the billing period for which you want to approve Bills. This date defines the range of Bills to be approved. | -                                                                     |
| `billingFrequency`         | billingFrequency        | LookupParameter        |    Yes   | The billing frequency for the specified period. Valid options are daily, weekly, monthly, or annually.                        | -                                                                     |
| `statePath`                | State Path              | StateVariableParameter |    No    | State variable to store the response.                                                                                         | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Preview Bill

**Function name:** `m3ter_PreviewBill`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Preview the current Bill for a specific account.

This endpoint is designed to provide a preview of the Bill for exactly one account, allowing you to review charges, frequencies, and other details before finalization. Required parameters include:

* `accountIds` - exactly 1 account must be specified for previewing a Bill.
* `billingFrequency`
* `billFrequencyInterval`

Other request parameters are optional. If `version` is not specified, the latest version of the Bill is previewed.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ------------------------------------------ | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.              | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `requestPath`              | Request Path     | StateVariableParameter  |    Yes   | State variable containing the request.     | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.      | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request | allowedValues: debug                                                  |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Bill

**Function name:** `m3ter_GetBill`
**Category:** READ
**HTTP method:** GET
**Destination:** m3ter

Retrieve the Bill with the given UUID.

This endpoint retrieves the Bill with the given unique identifier (UUID) and specific Organization.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                           | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | ----------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                         | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id               | LookupParameter         |    Yes   | The unique identifier (UUID) of the Bill to retrieve. | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.                 | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request            | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Delete Bill

**Function name:** `m3ter_DeleteBill`
**Category:** WRITE
**HTTP method:** DELETE
**Destination:** m3ter

Delete the Bill with the given UUID.

This endpoint deletes the specified Bill with the given unique identifier. Use with caution since deleted Bills cannot be recovered. Suitable for removing incorrect or obsolete Bills, and for Bills that have not been sent to customers.  Where end-customer invoices for Bills have been sent to customers, Bills should not be deleted to ensure you have an audit trail of how the invoice was created.

### Parameters

| Name                       | Label       | Type                   | Required | Description                                         | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | --------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.                       | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `id`                       | id          | LookupParameter        |    Yes   | The unique identifier (UUID) of the Bill to delete. | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response.               | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Retrieve Bills for an Account ID

**Function name:** `m3ter_GetAllBillsForAccount`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

Retrieve all Bills for the given Account.

This endpoint retrieves all Bills associated with a specific Account ID in a specified organization. The list can also be paginated for easier management.

This is useful for obtaining an overview of all billing activities for an Account.

### Parameters

| Name                       | Label            | Type                    | Required | Description                                                                       | Constraints                                                           |
| -------------------------- | ---------------- | ----------------------- | :------: | --------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials      | M3terEntityParameter    |    Yes   | The m3ter credentials to use.                                                     | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `accountId`                | accountId        | LookupParameter         |    Yes   | The unique identifier (UUID) of the Account for which you want to retrieve Bills. | -                                                                     |
| `statePath`                | State Path       | StateVariableParameter  |    No    | State variable to store the response.                                             | -                                                                     |
| `queryParams`              | Query Parameters | KeyValueLookupParameter |    No    | Query parameters to include in the request                                        | allowedValues: additional                                             |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## List Debit Line Items

**Function name:** `m3ter_ListDebitLineItems`
**Category:** READ
**HTTP method:** GET (paginated)
**Destination:** m3ter

List the Debit line items for the given bill.

### Parameters

| Name                       | Label       | Type                   | Required | Description                           | Constraints                                                           |
| -------------------------- | ----------- | ---------------------- | :------: | ------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials | M3terEntityParameter   |    Yes   | The m3ter credentials to use.         | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId      | LookupParameter        |    Yes   | UUID of the bill.                     | -                                                                     |
| `statePath`                | State Path  | StateVariableParameter |    No    | State variable to store the response. | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |

## Create Debit Line Item

**Function name:** `m3ter_PostDebitLineItem`
**Category:** WRITE
**HTTP method:** POST
**Destination:** m3ter

Create a new Debit line item for the given bill.

When creating Debit line items for Bills, use the Debit Reasons created for your Organization. See [DebitReason](https://www.m3ter.com/docs/api#tag/DebitReason).

### Parameters

| Name                       | Label        | Type                   | Required | Description                            | Constraints                                                           |
| -------------------------- | ------------ | ---------------------- | :------: | -------------------------------------- | --------------------------------------------------------------------- |
| `integrationCredentialsId` | Credentials  | M3terEntityParameter   |    Yes   | The m3ter credentials to use.          | m3terEntity: IntegrationCredentials, authType: M3TER\_SIGNED\_REQUEST |
| `billId`                   | billId       | LookupParameter        |    Yes   | UUID of the bill.                      | -                                                                     |
| `requestPath`              | Request Path | StateVariableParameter |    Yes   | State variable containing the request. | -                                                                     |
| `statePath`                | State Path   | StateVariableParameter |    No    | State variable to store the response.  | -                                                                     |

### Exits

| Exit    | Description                                                                      |
| ------- | -------------------------------------------------------------------------------- |
| `NEXT`  | The API call succeeded.                                                          |
| `ERROR` | The API call failed. Error details are stored in the `m3shError` state variable. |
