Skip to main content

Loans API

Endpoints for managing peer-to-peer loans.

Create Loan Request

Request a new loan based on your Trust Score.
curl -X POST "https://api.usmewe.com/v1/loans" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 50,
    "duration": 14,
    "purpose": "Emergency expense"
  }'

Request Parameters

ParameterTypeRequiredDescription
amountnumberYesUSDC amount to borrow
durationnumberYesLoan term in days (7-90)
purposestringNoReason for loan

Get Loan Details

Retrieve details of a specific loan.
curl -X GET "https://api.usmewe.com/v1/loans/{loanId}" \
  -H "Authorization: Bearer YOUR_TOKEN"

List User Loans

Get all loans for the authenticated user.
curl -X GET "https://api.usmewe.com/v1/loans?status=active&limit=10" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query Parameters

ParameterTypeDescription
statusstringFilter by status
limitnumberResults per page (default: 20)
offsetnumberPagination offset

Loan Statuses

StatusDescription
pendingAwaiting funding
activeLoan is active
repaidSuccessfully repaid
overduePast due date
defaultedDefault declared
cancelledCancelled before funding

Check Eligibility

Check loan eligibility before requesting.
curl -X GET "https://api.usmewe.com/v1/loans/eligibility" \
  -H "Authorization: Bearer YOUR_TOKEN"

Eligibility Restrictions

CodeDescription
SCORE_TOO_LOWTrust Score below minimum
MAX_LOANS_REACHEDAlready at loan limit
OVERDUE_LOANHas overdue loan
RECENT_DEFAULTDefaulted within 90 days

Repay Loan

Make a loan repayment.
curl -X POST "https://api.usmewe.com/v1/loans/{loanId}/repay" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 51.35
  }'

Partial Repayment

curl -X POST "https://api.usmewe.com/v1/loans/{loanId}/repay" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"amount": 25}'

Calculate Early Payoff

Get early payoff amount with interest savings.
curl -X GET "https://api.usmewe.com/v1/loans/{loanId}/payoff" \
  -H "Authorization: Bearer YOUR_TOKEN"

Cancel Loan Request

Cancel a pending loan request.
curl -X POST "https://api.usmewe.com/v1/loans/{loanId}/cancel" \
  -H "Authorization: Bearer YOUR_TOKEN"
Only pending loans can be cancelled. Funded loans must be repaid.

Request Extension

Request a loan extension (if eligible).
curl -X POST "https://api.usmewe.com/v1/loans/{loanId}/extension" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "days": 7,
    "reason": "Medical emergency"
  }'

Webhook Events

// Loan funded
{
  "event": "loan.funded",
  "data": {
    "loanId": "loan_xyz789",
    "amount": 50,
    "netAmount": 45
  }
}

// Loan repaid
{
  "event": "loan.repaid",
  "data": {
    "loanId": "loan_xyz789",
    "totalPaid": 51.35
  }
}

// Loan overdue
{
  "event": "loan.overdue",
  "data": {
    "loanId": "loan_xyz789",
    "daysOverdue": 1
  }
}

Error Responses

CodeErrorDescription
400INVALID_AMOUNTAmount exceeds limit
400INVALID_DURATIONDuration out of range
403NOT_ELIGIBLEUser not eligible for loan
404LOAN_NOT_FOUNDLoan does not exist
409ALREADY_REPAIDLoan already repaid