---
title: "Add billing automations"
method: POST
path: "/api/connector/v1/billingAutomations/add"
tags: ["Billing automations"]
---

# Add billing automations

`POST /api/connector/v1/billingAutomations/add`

Adds billing automations.

## Request body

- MultipleBillingAutomationAddParameters
  - `ClientToken` string, required — Token identifying the client application.
  - `AccessToken` string, required — Access token of the client application.
  - `Client` string, required — Name and version of the client application.
  - `EnterpriseId` string, uuid, nullable — Unique identifier of the enterprise. Required when using [Portfolio Access Tokens](https://mews-systems.gitbook.io/connector-api/concepts/multi-property), ignored otherwise.
  - `BillingAutomations` BillingAutomationAddParameters[], required — Parameters of the new billing automations to be created.
    - `Name` string, required — Name of the billing automation.
    - `Description` string, nullable — Description of the billing automation.
    - `CompaniesWithRelations` CompanyWithBillingAutomationRelation[], nullable — List of companies with relations indicating whether the company is considered a travel agency or a company in the reservation. Can only be empty if `AssignmentTargetType` is `CompanyAsDetails` or `NoCompany`.
      - `CompanyId` string, uuid, required — Unique identifier of the company.
      - `CompanyRelations` CompanyRelationsParameters, required
        - `PartnerCompany` boolean — Indicates whether the billing automation will apply if the company added to a reservation is a partner company.
        - `TravelAgency` boolean — Indicates whether the billing automation will apply if the company added to a reservation is a travel agency.
    - `Prepayment` 'All' | 'Prepaid', required — All (All) Prepaid (Prepaid)
    - `AssignmentTargetType` 'CompanyAsDetails' | 'CompanyAsOwner' | 'NoCompany', required — CompanyAsDetails (The company will be the associated account in the resulting routed bill, and the customer is the owner.) CompanyAsOwner (The company will be the owner in the resulting routed bill, and the customer might be the associated account.) NoCompany (The customer will be owner of the bill.)
    - `TriggerType` 'Continuous' | 'Recurring' | 'Legacy', required — Continuous (Billing automation is continuously triggered by reservation actions, such as creation, updates, and rebates.) Recurring (Billing automation is executed monthly.) Legacy (Billing automation is executed on reservation creation only. Items added later are not transfered to any bill.)
    - `BillAggregationType` 'OnePerReservation' | 'AggregateByCustomer' | 'AggregateAll' | 'AggregatePerReservationGroup', required — OnePerReservation (Create a separate bill for each reservation.) AggregateByCustomer (Create a separate bill for each reservation owner.) AggregateAll (Group all moved items on one bill.) AggregatePerReservationGroup (Create a separate bill for each reservation group.)
    - `OrderItemConsumptionPeriod` 'MonthBefore' | 'SameMonthAndMonthBefore' | 'SameMonth' | 'SameMonthAndMonthAfter' | 'MonthAfter' — MonthBefore (Only items with a consumption date within the previous month will be routed.) SameMonthAndMonthBefore (Only items with a consumption date within this and the previous month will be routed.) SameMonth (Only items with a consumption date within this month will be routed.) SameMonthAndMonthAfter (Only items with a consumption date within this and the next month will be routed.) MonthAfter (Only items with a consumption date within the next month will be routed.)
    - `ProcessingStartOffset` string, nullable — Specifies the processing start offset. This is required if the billing automation `TriggerType` is set to `Reccuring`.
    - `Assignments` BillingAutomationAssignmentAddParameters[], required — List of billing automation assignments.
      - `ServiceId` string, uuid, required — Unique identifier of the related service.
      - `RoutedItemTypes` BillingAutomationItemTypesParameters, required
        - `SpaceOrder` boolean, required — Space order
        - `CityTax` boolean, required — City tax
        - `AllProducts` boolean, required — All products
        - `Deposits` boolean, required — Deposits
        - `AdditionalExpenses` boolean, required — Additional expenses
        - `AllCustomItems` boolean, required — All custom items
      - `RateIds` string[], nullable — Unique identifiers of `Rates` that will be applied as billing automation condition.
      - `ProductCategoryIds` string[], nullable — Unique identifiers of `Product Categories` that will be applied as billing automation condition.
      - `ProductIds` string[], nullable — Unique identifiers of `Products` that will be applied as billing automation condition.
      - `AccountingCategories` BillingAutomationAccountingCategoryAssignment[], nullable — List of accounting categories that will be applied as billing automation condition.
        - `AccountingCategoryId` string, uuid, required — Unique identifier of the accounting category.
        - `ItemTypes` AccountingCategoryRoutedItemTypes, required
          - `Products` boolean, required — Specifies whether products under the given accounting category are routed.
          - `CustomItems` boolean, required — Specifies whether custom items under the given accounting category are routed.

## Response `200`

OK

- BillingAutomationModificationResult
  - `BillingAutomations` BillingAutomation[], nullable — Billing automations affected by the operation.
    - `Id` string, uuid, required — Unique identifier of the billing automation.
    - `EnterpriseId` string, uuid, required — Unique identifier of the enterprise.
    - `Name` string, required — Name of the billing automation.
    - `Description` string, nullable — Description of the billing automation.
    - `CompaniesWithRelations` CompanyWithBillingAutomationRelation[], required — List of companies with relations to the billing automation.
      - `CompanyId` string, uuid, required — Unique identifier of the company.
      - `CompanyRelations` CompanyRelationsParameters, required
        - `PartnerCompany` boolean — Indicates whether the billing automation will apply if the company added to a reservation is a partner company.
        - `TravelAgency` boolean — Indicates whether the billing automation will apply if the company added to a reservation is a travel agency.
    - `Prepayment` 'All' | 'Prepaid', required — All (All) Prepaid (Prepaid)
    - `AssignmentTargetType` 'CompanyAsDetails' | 'CompanyAsOwner' | 'NoCompany', required — CompanyAsDetails (The company will be the associated account in the resulting routed bill, and the customer is the owner.) CompanyAsOwner (The company will be the owner in the resulting routed bill, and the customer might be the associated account.) NoCompany (The customer will be owner of the bill.)
    - `TriggerType` 'Continuous' | 'Recurring' | 'Legacy', required — Continuous (Billing automation is continuously triggered by reservation actions, such as creation, updates, and rebates.) Recurring (Billing automation is executed monthly.) Legacy (Billing automation is executed on reservation creation only. Items added later are not transfered to any bill.)
    - `BillAggregationType` 'OnePerReservation' | 'AggregateByCustomer' | 'AggregateAll' | 'AggregatePerReservationGroup', required — OnePerReservation (Create a separate bill for each reservation.) AggregateByCustomer (Create a separate bill for each reservation owner.) AggregateAll (Group all moved items on one bill.) AggregatePerReservationGroup (Create a separate bill for each reservation group.)
    - `CreatedUtc` string, date-time, required — Creation date and time of the billing automation in UTC timezone in ISO 8601 format.
    - `UpdatedUtc` string, date-time, required — Last update date and time of the billing automation in UTC timezone in ISO 8601 format.
    - `CreatorProfileId` string, uuid, required — Unique identifier of the user who created the billing automation.
    - `UpdaterProfileId` string, uuid, required — Unique identifier of the user who last updated the billing automation.
    - `ProcessingStartOffset` string, nullable — Processing start offset. Applicable only if the billing automation `TriggerType` is set to `Reccuring`.
    - `OrderItemConsumptionPeriod` 'MonthBefore' | 'SameMonthAndMonthBefore' | 'SameMonth' | 'SameMonthAndMonthAfter' | 'MonthAfter' — MonthBefore (Only items with a consumption date within the previous month will be routed.) SameMonthAndMonthBefore (Only items with a consumption date within this and the previous month will be routed.) SameMonth (Only items with a consumption date within this month will be routed.) SameMonthAndMonthAfter (Only items with a consumption date within this and the next month will be routed.) MonthAfter (Only items with a consumption date within the next month will be routed.)
    - `Assignments` BillingAutomationAssignment[], nullable — List of billing automation assignments.
      - `Id` string, uuid, required — Unique identifier of the billing automation assignment.
      - `BillingAutomationId` string, uuid, required — Unique identifier of the billing automation.
      - `ServiceId` string, uuid, required — Unique identifier of the related service.
      - `RoutedItemTypes` BillingAutomationItemTypesParameters, required
        - `SpaceOrder` boolean, required — Space order
        - `CityTax` boolean, required — City tax
        - `AllProducts` boolean, required — All products
        - `Deposits` boolean, required — Deposits
        - `AdditionalExpenses` boolean, required — Additional expenses
        - `AllCustomItems` boolean, required — All custom items
      - `RateIds` string[], nullable — Unique identifiers of `Rates` used in billing automation conditions.
      - `ProductCategoryIds` string[], nullable — Unique identifiers of `Product Categories` used in billing automation conditions.
      - `ProductIds` string[], nullable — Unique identifiers of `Products` used in billing automation conditions.
      - `AccountingCategoryAssignments` BillingAutomationAccountingCategoryAssignment[], nullable — List of accounting category assignments used in billing automation conditions.
        - `AccountingCategoryId` string, uuid, required — Unique identifier of the accounting category.
        - `ItemTypes` AccountingCategoryRoutedItemTypes, required
          - `Products` boolean, required — Specifies whether products under the given accounting category are routed.
          - `CustomItems` boolean, required — Specifies whether custom items under the given accounting category are routed.

## Other responses

- `204` — Server has successfully fulfilled the request and there is no additional information to send back.
- `400` — Error caused by the client app, e.g. in case of malformed request or invalid identifier of a resource. In most cases, such an error signifies a bug in the client app (consumer of the API).
- `401` — Error caused by usage of invalid ClientToken, AccessToken, or you may not have the necessary permission to use the endpoint.
- `403` — Server error that should be reported to the end user of the client app. Happens for example when the server-side validation fails or when a business-logic check is violated.
- `408` — Error caused by heavy request that takes too long to process (typically tens of seconds). To get around this, request data in smaller batches. For more information, see [Request timeouts](https://mews-systems.gitbook.io/connector-api/guidelines/requests#request-timeouts)
- `429` — Error caused by too many requests sent in a given amount of time. Response contains `Retry-After` header indicating how long the user agent should wait before making a follow-up request. For more information, see [Request limits](https://mews-systems.gitbook.io/connector-api/guidelines/requests#request-limits).
- `500` — Unexpected error on the Mews side. This may be due to a software fault. If such a situation occurs, the error will be logged and the development team notified, however you can raise an issue through GitHub on our [documentation repository](https://github.com/MewsSystems/gitbook-connector-api).

---

[API](https://skmtc.net/mews/apis/connector-api.md) · [All operations](https://skmtc.net/mews/apis/connector-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mews/connector-api/versions/81933a8ff730/schema)
