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

# Lines of credit

A line of credit is **revolving**: the business can draw funds up to a `credit_limit`, repay, and draw again. Model it as a single long-lived loan, record each draw as a [proceed](/api-reference/loan/loan#loan-proceed-object), and record repayments as loan payments.

## Step 1: Create the line of credit

Create a loan with `loan_type` set to `LINE_OF_CREDIT` and a `credit_limit`. Set an `external_id` so you can reference it later. You can include the first draw in `proceeds` now, or add draws later (next step).

```bash Request theme={null}
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "loan_type": "LINE_OF_CREDIT",
  "external_id": "loc-001",
  "display_name": "Revolving credit line",
  "origination_date": "2024-01-15",
  "credit_limit": 10000000
}'
```

## Step 2: Record draws

Each time the business draws on the line, add a `DISBURSEMENT` proceed with the [Create a loan proceed](/api-reference/v1/loans/create-loan-proceed) endpoint, using the loan's `id` from the create response.

```bash Request theme={null}
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}/proceeds \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "loan_proceed_type": "DISBURSEMENT",
  "external_id": "loc-001-draw-1",
  "amount": 2500000,
  "date": "2024-02-01",
  "method": "ACH"
}'
```

## Step 3: Record repayments

Each repayment is a [loan payment](/api-reference/loan/loan#loan-payment-object) split into `PRINCIPAL` and `INTEREST` (explicit `splits` are required). Because draws and repayments on a line of credit are irregular, record each payment as it happens rather than pre-creating them.

```bash Request theme={null}
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/payments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "loan_external_id": "loc-001",
  "external_id": "loc-001-payment-2024-03-01",
  "amount": 500000,
  "date": "2024-03-01",
  "splits": [
    { "split_type": "PRINCIPAL", "amount": 450000 },
    { "split_type": "INTEREST", "amount": 50000 }
  ]
}'
```
