# Attribute a loan to a partner

`POST /lokta-lms/api/v1/loan-attributions`

Attributes a loan to the active partner that sourced it.

One partner per loan, and this is enforced: a second attribution is a `409 sourcing/loan_already_attributed`, not a second row. Correct the existing one instead.

Only an **active** partner may be attributed: a pending partner has not finished onboarding and an inactive one has been stood down, and attributing to either creates a fee liability to a party the lender has not agreed to pay.

`source` defaults to `at_origination`. `backfill` must be stated deliberately, because a backfilled attribution is an assertion about a past nobody witnessed.

For a Direct loan, do not call this at all.

## When to use it

Use this to record which partner sourced a loan. The partner has to be active. For a Direct loan, do not call it.

## Worth knowing
- A loan has one partner. A second attribution returns 409, so correct the existing one instead.
- Send an Idempotency-Key header.

## Parameters
- `Idempotency-Key` (header, string): Per-intent key; persist it before sending and reuse it on retry

## Request body (application/json)
- `loan_id` (integer): Placeholder name, to be confirmed. The loan to attribute.
- `partner_id` (string): Placeholder name, to be confirmed. The active partner the loan is attributed to.
- `source` (string): Where the attribution came from. Defaults to at_origination; a backfill has to be stated deliberately.

## Responses
- `default`: default response

## Example request (cURL)
```bash
curl -X POST \
  'https://default.lokta.tech/lokta-lms/api/v1/loan-attributions' \
  -u '{username}:{password}' \
  -H 'Tenant-Identifier: default' \
  -H 'Content-Type: application/json' \
  -d '{
  "loan_id": 1,
  "partner_id": "string",
  "source": "at_origination"
}'
```

Interactive: https://developer.lokta.ai/reference#operation/create_3
