Repay a facility
Pay down a facility and watch the waterfall apply: interest first, then fees, then principal.
Apply a repayment. CLC's waterfall is interest → fees → principal, then it restores headroom for future draws.
Scope repayment:create
Prerequisites: Facility has an outstanding balance
1. Submit a repayment
Emits repayment.applied once the waterfall has run.
If the repayment cannot be applied, repayment.failed fires instead, carrying a stable error code, and the facility balance is unchanged. Wait for one of the two rather than assuming the PENDING response above means the money moved.
curl -X POST https://api.clc.solutions/v1/facilities/fac_7a1b/repayments \
-H "X-CLC-Key-Id: $CLC_KEY_ID" \
-H "X-CLC-Timestamp: $CLC_TIMESTAMP" \
-H "X-CLC-Signature: $CLC_SIGNATURE" \
-H "Idempotency-Key: {uuid}" \
-d '{
"amount": "5000.00",
"asset": "USDC"
}'{
"id": "rep_3d1",
"facility_id": "fac_7a1b",
"status": "PENDING",
"amount": "5000.00",
"asset": "USDC",
"instructions": [
{
"operation": "transfer",
"source": "borrower",
"destination": "clc",
"amount": "5000.00",
"asset": "USDC"
}
],
"requested_at": "2026-07-21T14:38:00Z"
}A repayment never swaps
The instruction set for a repayment is one transfer, and it will never contain a swap. The borrower repays what they already hold: to repay 5000 USDC, the account has to hold 5000 USDC before you submit. CLC will not convert something else to make the amount fit.
So check the balance first. A request the account cannot cover fails — it does not become a sale.
If this repayment is curing a margin warning, send margin_warning_number with it. See Handle a margin warning.
Tell CLC you executed it
CLC learns the collateral moved from the portfolio you push, but a movement on its own is ambiguous: a draw CLC instructed, a repayment CLC instructed and the borrower depositing on their own all look identical in a portfolio diff. One report per entity resolves it — CLC does not track which holdings you sold to raise the money, only what arrived.
curl -X POST https://api.clc.solutions/v1/facilities/fac_7a1b/repayments/rep_3d1/execution \\
-H "X-CLC-Key-Id: $CLC_KEY_ID" \\
-H "X-CLC-Timestamp: $CLC_TIMESTAMP" \\
-H "X-CLC-Signature: $CLC_SIGNATURE" \\
-H "Idempotency-Key: $(uuidgen)" \\
-d '{
"status": "completed",
"delivered": {
"amount": "5000.00",
"asset": "USDC"
},
"reference": "0xbb41d902"
}'One report for the whole set, once the last instruction has settled. CLC validates it against its own receipts and the portfolio you push, so this is a report to reconcile rather than a figure taken on trust.
{
"execution_id": "exe_5b1d",
"recorded_at": "2026-07-21T14:38:25Z",
"repayment": {
"id": "rep_3d1",
"status": "APPLIED",
"amount": "5000.00",
"asset": "USDC"
}
}Keep execution_id. It is CLC's handle for this report — the raw figures exactly as they arrived — and it is what a reconciliation or a support thread quotes to point at this one.
Updated about 2 months ago