# Data model Before you start reading and writing loans, spend two minutes on how the resources hang together. The API's shape follows the mental model — if this feels unfamiliar, most integration questions will actually be modelling questions in disguise. ## The core shape Everything an external integrator touches sits under a **lender**. Your API key resolves to exactly one lender, and every response is scoped to what that lender owns. There is no cross-lender surface — the tenant boundary is invisible to you because you can only ever see your side of it. Inside a lender: ``` Lender ├── CapitalProgram(s) ← the fund / mandate / warehouse │ ├── Product(s) ← the loan template a program offers │ └── BaseRate ← the reference rate for pricing │ ├── Loan(s) ← what you're mostly here for │ ├── capitalProgram ← which fund it belongs to │ ├── product ← which template it follows │ ├── borrowingEntity ← the borrower (an Organisation) │ └── collaterals[] ← what secures it │ ├── Organisation(s) ← every non-individual counterparty │ └── (roles: borrower, guarantor, servicer, valuer, broker, …) │ └── Individual(s) ← natural persons └── organisationAssociations[] ← links to Organisations, with a role ``` **Read that top-to-bottom once.** The three levels — CapitalProgram → Product → Loan — are why the API returns `capitalProgramId` and `productId` on every loan: those pointers tell you *which* pool of money funded it and *which* template's rules it follows. ## What each resource is ### CapitalProgram The **fund**, **mandate**, or **warehouse** — whatever your organisation calls the pool of capital that individual loans are drawn from. Every loan belongs to exactly one capital program. Programs carry the domicile, currency, governing law, payment frequency, total facility size, and program-level fees (trustee, management, arranger). There's no standalone create or update endpoint: a program is created the first time a loan names it inline in `POST /api/v1/loans`, and otherwise managed inside the platform by treasury. Key fields on the DTO: `name`, `category`, `domicile`, `currency`, `totalAmount`, `status`, `stage`, `paymentFrequency`, `baseRateId`, `fees`. Guide: [Capital programs](../guides/resources/capital-programs/README.md). Reference: [`GET /api/v1/capital-programs`](../reference/openapi.md), [`GET /api/v1/capital-programs/{id}`](../reference/openapi.md). ### Product The **loan template** a capital program offers. Bounds the loans that can sit under it — min/max amount, min/max LVR, min/max term, allowed origination types, day-count convention. A product also carries the fees a borrower is charged (application, establishment, line fees and so on). A capital program can offer multiple products (e.g. a CRE program with senior + mezzanine tranches). Like programs, products are created the first time a loan names one inline; there's no standalone create or update endpoint. Key fields on the DTO: `name`, `type`, `category`, `currency`, `loanMin`/`loanMax`, `minimumLVR`/`maximumLVR`, `minimumTerm`/`maximumTerm`, `fees`. Guide: [Products](../guides/resources/products/README.md). Reference: [`GET /api/v1/products`](../reference/openapi.md), [`GET /api/v1/products/{id}`](../reference/openapi.md). ### Loan The **star of the show**. A loan is what a borrower actually owes. It references its `capitalProgram`, its `product`, its `borrowingEntity` (an Organisation), and its `collaterals[]`. It carries a `category` (CRE, corporate credit, home loan, etc.), a `status` that walks through the origination-through-repayment lifecycle, and denormalised financial fields (principal, LVR, maturity). Loans can be read and created through the API; there's no update or delete yet, and re-sending a loan with the same `externalId` reuses it unchanged. See [Loans](../guides/resources/loans/README.md). ### Organisation **Every counterparty that isn't a natural person** — borrowers, corporate guarantors, trustees, servicers, brokers, valuers, legal firms, auditors. What role an organisation plays in a specific loan is defined by its `roles[]` list. A single organisation record can carry multiple roles (a company that borrows on one loan and guarantees another). KYB (Know Your Business) status lives on `kybStatus` — a seven-value traffic light: `not_started` / `in_progress` / `verified` / `expiring` / `expired` / `refused` / `blocked`. The source of truth for the underlying verification evidence lives elsewhere; the status field is what's exposed publicly. See [Organisations](../guides/resources/organisations/README.md). ### Individual **Natural persons** — directors, guarantors, beneficial owners, shareholders. Every individual is associated with at least one organisation (a director *of* something, a guarantor *of* someone) — hence the `organisationAssociations[]` field, which carries both the organisation id and the individual's role within it. KYC (Know Your Customer) status uses the same seven-value traffic light as KYB. See [Individuals](../guides/resources/individuals/README.md). ### Collateral **What secures a loan.** Most commonly a property (CRE, home loan, etc.), but the shape supports non-property collateral too. Carries its values (current, original, as-if-complete), property type, purpose and status, net lettable area, owners, and — for income-producing property — DSCR, ICR, WALE and the tenancies behind them, plus its valuations. LVR is on the loan, not the collateral. Collaterals are created inside `POST /api/v1/loans`; see [Loans → Collaterals](../guides/resources/loans/create-collaterals.md). Reference: [`GET /api/v1/collaterals`](../reference/openapi.md), [`GET /api/v1/collaterals/{id}`](../reference/openapi.md). ### BaseRate **Reference rates for pricing** — SOFR, BBSW, RBA cash rate, etc. Referenced by capital programs and products so that variable-rate loans have a known source of truth for the periodic rate reset. Read-only. Reference: [`GET /api/v1/base-rates`](../reference/openapi.md). ## How the resources compose **Reading a loan tells you almost the whole story.** The DTO gives you the resource ids for the loan's capital program, product, borrowing entity, and collaterals. Follow the pointers when you need the detail: ```bash # 1. Get a loan curl -sS -H "x-api-key: $KEY" \ https://developers.gallantreecapital.com/api/v1/loans/ # 2. Follow to its capital program curl -sS -H "x-api-key: $KEY" \ "https://developers.gallantreecapital.com/api/v1/capital-programs/$CAPITAL_PROGRAM_ID" # 3. Follow to its product curl -sS -H "x-api-key: $KEY" \ "https://developers.gallantreecapital.com/api/v1/products/$PRODUCT_ID" # 4. Follow to its borrower curl -sS -H "x-api-key: $KEY" \ "https://developers.gallantreecapital.com/api/v1/organisations/$BORROWING_ENTITY_ID" ``` There is no `?expand=...` parameter that inlines related resources — each is its own fetch. That keeps the response shape stable and gives you control over what you actually need. If your integration is polling for changes, subscribe to [webhooks](../guides/webhooks/subscribe.md) instead of walking the graph repeatedly. ## What "lender-scoped" means in practice - Your key **cannot** see another lender's data. `GET /api/v1/loans` returns only your loans; you cannot query, filter, or discover other lenders' data through the API. - Writes are tagged to your lender: everything you create through the API belongs to your lender, and `externalId`s you send are scoped to your lender, so they never collide with another lender's. - The 404 responses on missing resources are deliberately indistinguishable from "you don't have access to this resource" — the API does not confirm the existence of records outside your tenant. If your organisation manages multiple lenders (a multi-tenant integration), register a separate app per lender. Each app gets its own scoped API keys. ## Where to go next - Ready to create a loan? **[Loans](../guides/resources/loans/README.md)** — the create flow is a superset of the ADR006 handover shape, so you can build the whole thing in one request. - Adding borrowers? **[Organisations](../guides/resources/organisations/README.md)** and **[Individuals](../guides/resources/individuals/README.md)**. - Need the full field list? The **[API reference](../reference/openapi.md)** enumerates every field on every DTO.