# Capital program and product Each loan belongs to a capital program and a product. For each, send one of: - **An existing one, by id:** `loan.capitalProgramId` / `loan.productId`, using an `id` from `GET /api/v1/capital-programs` or `GET /api/v1/products`. Use this for programs and products set up inside the platform. Only your own lender's records can be used; any other id is rejected with the same error as an id that doesn't exist. - **An inline block:** `loan.capitalProgram` / `loan.product`. These are **created for your lender** the first time their `externalId` is seen, and reused on later loans with the same `externalId`. Their details are set on first creation only; changing them in a later payload has no effect. You can mix the two, for example an existing program with an inline product. Sending both forms for the same one, or neither, is a field error. ```json "loan": { "externalId": "loan-002", "capitalProgramId": "65f3a8b1d5c9e4f2a1b3c4d0", "productId": "65f3a8b1d5c9e4f2a1b3c4e1", "...": "the rest as in the minimal payload" } ``` A loan can't yet be placed in a capital program that belongs to another lender, such as a Gallantree warehouse program. Talk to your Gallantree account manager if you need that. ## Fees An inline `loan.product` or `loan.capitalProgram` can carry a `fees` array. Like the rest of the block, fees are stored when the product or program is first created, and returned in `fees` on `GET /api/v1/products` and `GET /api/v1/capital-programs`. | Field | Product fee | Capital-program fee | |-------|-------------|---------------------| | `name` | Required | Required | | `calculationMethod` | Required: `flat`, `approvedPrincipal`, `currentPrincipal`, `seniorNotes`, `subordinateNotes` or `totalNotes` | Required (same values) | | `value` | Required. An amount for `flat`; otherwise a percentage of the calculation base | Required (same) | | `trigger` | Required: `application`, `establishment`, `manual` or `periodic` | Optional (same values) | | `category` | Optional: `loan` (default) or `capitalProgram` | Optional: defaults to `capitalProgram` | | `feeType` | Not used | Optional: `flat` or `percentage`. Defaults to `flat` for a `flat` calculation, `percentage` otherwise | | `minimum` | Optional | Optional | | `capitalised`, `isRequired`, `isTaxed` | Optional booleans. Default `false`, `true`, `false` | Same | A fee with a missing required field or an unrecognised value is a [field error](create.md#field-errors) (for example `loan.product.fees[0].trigger`), and nothing is written. ```json "product": { "externalId": "product-001", "name": "Construction facility", "fees": [ { "name": "Establishment fee", "trigger": "establishment", "calculationMethod": "approvedPrincipal", "value": 1.5, "capitalised": true }, { "name": "Line fee", "trigger": "periodic", "calculationMethod": "currentPrincipal", "value": 0.25 } ] } ```