---
title: "Create loan product accounting profile"
method: POST
path: "/api/v1/loan-products/{id}/accounting-profiles"
tags: ["LoanProducts"]
---

# Create loan product accounting profile

`POST /api/v1/loan-products/{id}/accounting-profiles`

## Request

- Base URL: `https://identity.sandbox.lerian.net`
- URL: `https://identity.sandbox.lerian.net/api/v1/loan-products/{id}/accounting-profiles`
- Auth: none required
- TypeScript: <https://skmtc.dev/lerian/apis/identity-plugin/docs/api/v1/loan-products/:id/accounting-profiles/post.ts> (a function with typed inputs; its response is checked against the schema)

Configures the accounting profile for a loan product version that belongs to the path loan product.

## Path parameters

- `id` string, uuid, required: Loan product identifier.

## Request body

- ConfigureAccountingProfileHumaInputBody
  - `accountingMode` 'accrual' | 'cash', required: Accounting recognition mode.
  - `loanProductVersionId` string, uuid, required: Loan product version identifier.
  - `midazLedgerId` string: Optional per-product Midaz ledger the profile's postings route into; both-or-neither with midazOrganizationId. Required under multi-tenant mode; empty single-tenant profiles fall back to the env default.
  - `midazOrganizationId` string: Optional per-product Midaz organization the profile's postings route into; both-or-neither with midazLedgerId. Required under multi-tenant mode; empty single-tenant profiles fall back to the env default.
  - `postingRules` PostingRuleHumaInputBody[], required: Non-null GL account mappings per accounting event. New profiles require disbursement, repayment, prepayment, accrual, collection_unapplied, collection_reapply, and collection_refund; accrual_tax is optional.
    - `eventType` 'disbursement' | 'repayment' | 'prepayment' | 'accrual' | 'accrual_tax' | 'collection_unapplied' | 'collection_reapply' | 'collection_refund', required: Accounting event type.
    - `legs` PostingLegHumaInputBody[], required: Non-null ordered posting legs. Prepayment requires exactly five legs in this component order: cash, charge_rebate, iof_refund, principal, iof_due; cash is a required debit, principal is a required credit, and the three component legs are optional with the corresponding sides. Other events require at least one debit and one credit.
      - `account` string, required: GL account for this leg.
      - `component` string: Open withholding component code (e.g. "iof"); set this XOR role.
      - `optional` boolean: Whether a component amount may be omitted or zero at posting time. Permitted only on component legs; omitted defaults to false.
      - `role` 'principal' | 'interest' | 'iof' | 'tax' | 'cash' | 'unapplied_cash' | 'counterparty': Reserved economic role of this leg; set this XOR component.
      - `side` 'debit' | 'credit', required: Whether this leg debits or credits the account.
    - `metadata` object: Optional metadata.

## Response `201`

Created

- AccountingProfileHumaBody
  - `accountingMode` string, required: Accounting recognition mode (accrual|cash).
  - `createdAt` string, required: Creation timestamp (RFC3339, UTC).
  - `id` string, required: Server-assigned accounting profile identifier (uuid).
  - `loanProductVersionId` string, required: Loan product version this profile is configured for (uuid).
  - `postingRules` AccountingPostingRuleHumaBody[], nullable, required: Persisted GL account mappings, one per accounting event.
    - `eventType` string, required: Accounting event type (disbursement|repayment|prepayment|accrual|accrual_tax|collection_unapplied|collection_reapply|collection_refund).
    - `legs` AccountingPostingLegBody[], required: Persisted ordered posting legs.
      - `account` string, required: GL account for this leg.
      - `component` string: Open withholding component code (set XOR role).
      - `optional` boolean, required: Whether the component amount may be absent or zero for a generated posting.
      - `role` 'principal' | 'interest' | 'iof' | 'tax' | 'cash' | 'unapplied_cash' | 'counterparty': Reserved economic role of this leg (set XOR component).
      - `side` 'debit' | 'credit', required: Whether this leg debits or credits the account.
    - `metadata` object, required: Optional metadata carried with the rule.

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/lerian/apis/identity-plugin.md) - [All operations](https://skmtc.dev/lerian/apis/identity-plugin/llms.txt) - [OpenAPI document](https://skmtc.dev/lerian/apis/identity-plugin/revisions/25daba385532?raw)
