---
title: "How do I create a fee type?"
slug: "how-do-i-create-a-fee-type"
updated: 2025-02-11T12:48:49Z
published: 2025-02-11T12:48:49Z
canonical: "support.lusid.com/how-do-i-create-a-fee-type"
---

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

# How do I create a fee type?

Providing you have suitable [access control permissions](/v1/docs/identity-management-and-access-control-iam), you can create a *fee type* describing a particular class of fees for a fund, for example legal fees or management fees. [Work through a tutorial on fees](/v1/docs/adding-fees-to-a-fund-and-automatically-posting-fee-transactions).

A fee type is designed to determine how LUSID should record both fee accruals and fee payments by automatically generating appropriate transactions [each time a fund valuation is finalised](/v1/docs/valuing-a-fund-calculating-gav-nav-and-other-pricing-data).

Once a fee type is created, you can [add a fee of this type](/v1/docs/how-do-i-add-a-fee-to-a-fund) to a particular fund, optionally nominating a portfolio in which to generate fee transactions.

## Using the LUSID web app

*Coming soon.*

## Using Luminesce

You can use the `Lusid.FeeType.Writer` provider. [More information](/v1/docs/lusidfeetypewriter).

## Using the LUSID API

1. [Obtain an API access token](/v1/docs/how-do-i-obtain-and-use-a-short-lived-api-access-token-from-okta).
2. Call the [CreateFeeType](https://www.lusid.com/docs/api#operation/CreateFeeType) API, specifying a scope in the URL and, in the body of the request:
  - A `code` that, together with the scope, uniquely identifies the fee type in LUSID.
  - A `displayName` and, optionally, a `description`.
  - In the `componentTransactions` array, a template for at least one kind of transaction, for example transactions representing fee accruals. You can specify more than one transaction template to generate different kinds of transaction, for example transactions representing corresponding fee payables as well (this is recommended). Each template:
    - Must have a `displayName`.
    - Can have a `condition`. If omitted, a transaction is always generated. Note a condition uses LUSID's [filter syntax](/v1/docs/filtering-information-retrieved-from-lusid), and expressions can be chained using the `and` and `or` operators.
    - Must have a `transactionFieldMap` object that provides instructions for populating the [mandatory fields for a transaction](https://lusid-sdk-csharp.readthedocs.io/en/latest/classLusid_1_1Sdk_1_1Model_1_1TransactionFieldMap.html#properties) in LUSID. You can specify a static value (of an appropriate data type) for each field, or use Mustache template syntax to insert the following variables:

```json
{{FundFee.feeInstrument}}
{{FundFee.valuationPointDate}}
{{FundFee.defaultFeeTransactionId}}
{{FundFee.name}}
{{FundFee.code}}
{{FundFee.description}}
{{FundFee.origin}}
{{FundFee.feeCurrency}}
{{FundFee.totalAnnualAccrualAmount}}
{{FundFee.feeRatePercentage}}
{{FundFee.startDate}}
{{FundFee.endDate}}
{{FundFee.amount}}
{{FundFee.previousAccrual}}
{{FundFee.totalAccrual}}
```

This set may be extended in future. You can call the [GetFeeTemplateSpecifications](https://www.lusid.com/docs/api#operation/GetFeeTemplateSpecifications) API to see the definitive list.
    - Can have a `transactionPropertyMap` object that creates [properties](/v1/docs/properties) in the `Transaction` domain to extend the data model of fee transactions.

> **Note**: Once created, you can edit a fee type using the [UpdateFeeType](https://www.lusid.com/docs/api#operation/UpdateFeeType) API.

Consider the following example, of a fee type with a scope of `MyFeeTypes` (in the URL) and code of `LegalFees` (in the body). There are two transaction templates, one for fee accruals and one for fee payables:

```json
curl -X POST 'https://<your-domain>.lusid.com/api/api/feetypes/MyFeeTypes'
  -H 'Content-Type: application/json-patch+json'
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "code": "LegalFees",
  "displayName": "Legal fees",
  "description": "Generating transactions to accrue and settle legal fees for funds",
  "componentTransactions": [
    {
      "displayName": "Transaction for legal fee accruals",
      "transactionFieldMap": {
        "transactionId": "{{FundFee.defaultFeeTransactionId}}-Accrual",
        "type": "FeeAccrual",
        "source": "default",
        "instrument": "{{FundFee.feeInstrument}}",
        "transactionDate": "{{FundFee.valuationPointDate}}",
        "settlementDate": "{{FundFee.valuationPointDate}}",
        "units": "{{FundFee.amount}}",
        "transactionPrice": {
          "price": "1.0",
          "type": "Price"
        },
        "transactionCurrency": "{{FundFee.feeCurrency}}",
        "exchangeRate": "1.0",
        "totalConsideration": {
          "currency": "{{FundFee.feeCurrency}}",
          "amount": "{{FundFee.amount}}"
        }
      },
      "transactionPropertyMap": []
    },
    {
      "displayName": "Transaction for legal fee payables",
      "transactionFieldMap": {
        "transactionId": "{{FundFee.defaultFeeTransactionId}}-Payable",
        "type": "FeePayment",
        "source": "default",
        "instrument": "{{FundFee.feeInstrument}}",
        "transactionDate": "{{FundFee.valuationPointDate}}",
        "settlementDate": "{{FundFee.valuationPointDate}}",
        "units": "{{FundFee.amount}}",
        "transactionPrice": {
          "price": "1.0",
          "type": "Price"
        },
        "transactionCurrency": "{{FundFee.feeCurrency}}",
        "exchangeRate": "1.0",
        "totalConsideration": {
          "currency": "{{FundFee.feeCurrency}}",
          "amount": "{{FundFee.amount}}"
        }
      },
      "transactionPropertyMap": []
    }
  ]
}'
```

Note the following:

- The first template in the `componentTransactions` collection defines transactions for fee accruals. The second template defines transactions for fee payments.
- The `transactionId` must be unique in a portfolio. The `{{FundFee.defaultFeeTransactionId}}` variable consists of the fee code and the valuation point date, which *should* be unique.
- The `type` must be a [transaction type](/v1/docs/what-is-a-transaction-type) that exists in the named `source` and confers a suitable economic impact on holdings and [journal entry lines](/v1/docs/valuing-a-fund-calculating-gav-nav-and-other-pricing-data).
- The `transactionDate` and `settlementDate` are set to the datetime of the finalised [valuation point](https://support.lusid.com/knowledgebase/article/KA-02334/) that triggers LUSID to automatically generate fee transactions.

Providing the request is successful, the response confirms that the fee type's unique identifier consists of its scope and code:

```json
{
  "id": {
    "scope": "MyFeeTypes",
    "code": "LegalFees"
  },
  "displayName": "Legal fees",
  "description": "Generating transactions to accrue and settle legal fees for funds",
  "componentTransactions": [
    ...
}
```
