# Flat Charges API



<EndpointIndex
  names={[
  	'addCharges',
  	'reverseCharges',
  	'updateQuoteInvoiceFeeAmount',
  	'updatePolicyInvoiceFeeAmount',
  	'fetchChargesByAccount',
  	'fetchChargesByPolicy',
  	'fetchChargesByTransaction',
  ]}
  titles={{
  	addCharges: 'Add Charges',
  	reverseCharges: 'Reverse Charges',
  	updateQuoteInvoiceFeeAmount: 'Add or update invoice fee on a quote',
  	updatePolicyInvoiceFeeAmount: 'Add or update invoice fee on a policy',
  	fetchChargesByAccount: 'Fetch Charges by Account',
  	fetchChargesByPolicy: 'Fetch Charges by Policy',
  	fetchChargesByTransaction: 'Fetch Charges by Transaction',
  }}
/>

Create and Reverse [#create-and-reverse]

Add Charges [#add-charges]

<ApiEndpoint name="addCharges" title="Add Charges" />

<ApiSchema name="ChargesCreateRequest" />

<ApiSchema name="ChargeCreateRequest" />

Since charges are created with reference to an account, any `policyLocator` or
`transactionLocator` in the charge creation request must belong to the account.
If `transactionLocator` and `elementLocator` are provided, the `elementLocator`
must belong to the transaction specified by `transactionLocator`.

If the charge creation request references a specific `policyLocator`, the resulting <ApiLink name="InvoiceItemResponse">invoice item</ApiLink> or items will assume the policy's `timezone`. Otherwise, the `timezone` will be set to the tenant's `defaultTimezone`.

<ApiSchema name="ChargeResponse" />

Reverse Charges [#reverse-charges]

<ApiEndpoint name="reverseCharges" title="Reverse Charges" />

<ApiSchema name="ChargesReversalRequest" />

Add Invoice Fee to Policy or Quote [#add-invoice-fee-to-policy-or-quote]

Add or update invoice fee on a quote [#add-or-update-invoice-fee-on-a-quote]

<ApiEndpoint name="updateQuoteInvoiceFeeAmount" title="Add or update invoice fee on a quote" />

Add or update invoice fee on a policy [#add-or-update-invoice-fee-on-a-policy]

<ApiEndpoint name="updatePolicyInvoiceFeeAmount" title="Add or update invoice fee on a policy" />

<ApiSchema name="UpdateInvoiceFeeAmountRequest" />

Fetch [#fetch]

Fetch Charges by Account [#fetch-charges-by-account]

<ApiEndpoint name="fetchChargesByAccount" title="Fetch Charges by Account" />

<ApiSchema name="ListPageResponseChargeResponse" />

Fetch Charges by Policy [#fetch-charges-by-policy]

<ApiEndpoint name="fetchChargesByPolicy" title="Fetch Charges by Policy" />

Fetch Charges by Transaction [#fetch-charges-by-transaction]

<ApiEndpoint name="fetchChargesByTransaction" title="Fetch Charges by Transaction" />


## API Reference

POST /billing/{tenantLocator}/accounts/{accountLocator}/charges — addCharges
Tags: charges-controller
Permissions: write
Parameters:
  tenantLocator (uuid, path, required)
  accountLocator (ulid, path, required)
Request body (ChargesCreateRequest):
Responses:
  200 ChargeResponse[] — OK

POST /billing/{tenantLocator}/accounts/{accountLocator}/charges/reverse — reverseCharges
Tags: charges-controller
Permissions: write
Parameters:
  tenantLocator (uuid, path, required)
  accountLocator (ulid, path, required)
Request body (ChargesReversalRequest):
Responses:
  200 ChargeResponse[] — OK

PATCH /policy/{tenantLocator}/quotes/{locator}/invoiceFeeAmount — updateQuoteInvoiceFeeAmount
Tags: quotes-controller
Permissions: write
Parameters:
  tenantLocator (uuid, path, required)
  locator (ulid, path, required)
Request body (UpdateInvoiceFeeAmountRequest):
Responses:
  200 QuoteResponse — OK

PATCH /policy/{tenantLocator}/policies/{locator}/invoiceFeeAmount — updatePolicyInvoiceFeeAmount
Tags: policies-controller
Permissions: write
Parameters:
  tenantLocator (uuid, path, required)
  locator (ulid, path, required)
Request body (UpdateInvoiceFeeAmountRequest):
Responses:
  200 PolicyResponse — OK

GET /billing/{tenantLocator}/accounts/{accountLocator}/charges/list — fetchChargesByAccount
Tags: charges-controller
Permissions: read, list
Parameters:
  tenantLocator (uuid, path, required)
  accountLocator (ulid, path, required)
  offset (integer, query)
  count (integer, query)
Responses:
  200 ListPageResponseChargeResponse — OK

GET /billing/{tenantLocator}/policies/{policyLocator}/charges/list — fetchChargesByPolicy
Tags: charges-controller
Permissions: read, list
Parameters:
  tenantLocator (uuid, path, required)
  policyLocator (ulid, path, required)
  offset (integer, query)
  count (integer, query)
Responses:
  200 ListPageResponseChargeResponse — OK

GET /billing/{tenantLocator}/transactions/{transactionLocator}/charges/list — fetchChargesByTransaction
Tags: charges-controller
Permissions: read, list
Parameters:
  tenantLocator (uuid, path, required)
  transactionLocator (ulid, path, required)
  includeAll (boolean, query)
  offset (integer, query)
  count (integer, query)
Responses:
  200 ListPageResponseChargeResponse — OK

ChargesCreateRequest
Properties:
  policyLocator (ulid)
  invoicing (Enum scheduled | next | immediate)
  currency (string)
  charges (ChargeCreateRequest[], required)

ChargeCreateRequest
Properties:
  amount (number, required)
  chargeType (string, required)
  transactionLocator (ulid)
  elementLocator (ulid)
  elementStaticLocator (ulid)
  tag (string)

ChargeResponse
Properties:
  locator (ulid, required)
  amount (number, required)
  currency (string, required)
  chargeCategory (Enum none | premium | tax | fee | credit | invoiceFee | cededPremium | nonFinancial | surcharge, required)
  chargeType (string, required)
  chargeInvoicing (Enum scheduled | next | immediate, required)
  accountLocator (ulid, required)
  tag (string)
  policyLocator (ulid)
  transactionLocator (ulid)
  elementLocator (ulid)
  elementStaticLocator (ulid)
  reversalOfLocator (ulid)

ChargesReversalRequest
Properties:
  charges (ulid[], required)
  invoicing (Enum scheduled | next | immediate, required)

UpdateInvoiceFeeAmountRequest
Properties:
  invoiceFeeAmount (number, required)

ListPageResponseChargeResponse
Properties:
  listCompleted (boolean, required)
  items (ChargeResponse[], required)