Loans

Loans are a fundamental aspect of financial services, providing customers with the funds they need for various purposes. On this page, we’ll dive into the different loan endpoints you can use to manage loans programmatically. We'll look at how to query, create, update, and delete loan records.

The loan model

The loan model contains all the information related to a loan, including the loan amount, interest rate, and repayment details.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the loan record.

  • Name
    customer_id
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    loan_amount
    Type
    number
    Description

    Amount of the loan.

  • Name
    interest_rate
    Type
    number
    Description

    Interest rate of the loan.

  • Name
    term
    Type
    number
    Description

    Term of the loan in months.

  • Name
    repayment_schedule
    Type
    string
    Description

    Schedule for loan repayment (e.g., monthly, quarterly).

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the loan record was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the loan record was last updated.


GET/v1/loans

List all loans

This endpoint allows you to retrieve a paginated list of all your loan records. By default, a maximum of ten records are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of loan records returned.

  • Name
    customer_id
    Type
    string
    Description

    Only show records for the specified customer.

  • Name
    interest_rate
    Type
    number
    Description

    Only show records with the specified interest rate.

Request

GET
/v1/loans
curl -G https://api.finx.ai/v1/loans \
  -H "Authorization: Bearer {token}" \
  -d limit=10

Response

{
  "has_more": false,
  "data": [
    {
      "id": "xgQQXg3hrtjh7AvZ",
      "customer_id": "WAz8eIbvDR60rouK",
      "loan_amount": 50000,
      "interest_rate": 5.5,
      "term": 60,
      "repayment_schedule": "monthly",
      "created_at": 705103200,
      "updated_at": 705103200
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    }
  ]
}

POST/v1/loans

Create a loan

This endpoint allows you to add a new loan record. You need to provide the customer ID, loan amount, interest rate, term, and repayment schedule to create a loan record.

Required attributes

  • Name
    customer_id
    Type
    string
    Description

    Unique identifier for the customer.

  • Name
    loan_amount
    Type
    number
    Description

    Amount of the loan.

  • Name
    interest_rate
    Type
    number
    Description

    Interest rate of the loan.

  • Name
    term
    Type
    number
    Description

    Term of the loan in months.

  • Name
    repayment_schedule
    Type
    string
    Description

    Schedule for loan repayment (e.g., monthly, quarterly).

Request

POST
/v1/loans'
curl https://api.finx.ai/v1/loans \
  -H "Authorization: Bearer {token}" \
  -d 'customer_id'="WAz8eIbvDR60rouK" \
  -d 'loan_amount'=50000 \
  -d 'interest_rate'=5.5 \
  -d 'term'=60 \
  -d 'repayment_schedule'="monthly"

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "loan_amount": 50000,
  "interest_rate": 5.5,
  "term": 60,
  "repayment_schedule": "monthly",
  "created_at": 705103200,
  "updated_at": 705103200
}

GET/v1/loans/:id

Retrieve a loan

This endpoint allows you to retrieve a loan record by providing the record id. Refer to the list at the top of this page to see which properties are included with loan objects.

Request

GET
/v1/loans/xgQQXg3hrtjh7AvZ
curl https://api.finx.ai/v1/loans/xgQQXg3hrtjh7AvZ \
  -H "Authorization: Bearer {token}"

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "loan_amount": 50000,
  "interest_rate": 5.5,
  "term": 60,
  "repayment_schedule": "monthly",
  "created_at": 705103200,
  "updated_at": 705103200
}

PUT/v1/loans/:id

Update a loan

This endpoint allows you to perform an update on a loan record. Examples of updates are changing the loan amount, updating the interest rate, or modifying the repayment schedule.

Optional attributes

  • Name
    loan_amount
    Type
    number
    Description

    Updated amount of the loan.

  • Name
    interest_rate
    Type
    number
    Description

    Updated interest rate of the loan.

  • Name
    term
    Type
    number
    Description

    Updated term of the loan in months.

  • Name
    repayment_schedule
    Type
    string
    Description

    Updated schedule for loan repayment (e.g., monthly, quarterly).

Request

PUT
/v1/loans/xgQQXg3hrtjh7AvZ
curl -X PUT https://api.finx.ai/v1/loans/xgQQXg3hrtjh7AvZ \
  -H "Authorization: Bearer {token}" \
  -d 'interest_rate'=6.0

Response

{
  "id": "xgQQXg3hrtjh7AvZ",
  "customer_id": "WAz8eIbvDR60rouK",
  "loan_amount": 50000,
  "interest_rate": 6.0,
  "term": 60,
  "repayment_schedule": "monthly",
  "created_at": 705103200,
  "updated_at": 705103200
}

DELETE/v1/loans/:id

Delete a loan

This endpoint allows you to delete your loan records in Fin X. Note: This will permanently delete the record and all its data — ensure this is the desired action before proceeding.

Request

DELETE
/v1/loans/xgQQXg3hrtjh7AvZ
curl -X DELETE https://api.finx.ai/v1/loans/xgQQXg3hrtjh7AvZ \
  -H "Authorization: Bearer {token}"

Was this page helpful?