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

# List Repayments

> Retrieves a paginated list of all repayments for a loan or across all loans.

Fetches a paginated list of repayment records, allowing managers to view and track all loan repayments. Can be filtered by loan application ID to show repayments for a specific loan.

## Request Headers

<ParamField header="X-Auth-Token" type="string" required>
  The **JWT Access Token** obtained from the `/login` or `/refresh-token` endpoint.
</ParamField>

<ParamField header="x-idempotency-key" type="string" required>
  Unique idempotency key for the request to prevent duplicate processing.
</ParamField>

<ParamField header="x-fapi-auth-date" type="string" required>
  The date and time at which the request was initiated (ISO 8601 format).
</ParamField>

<ParamField header="x-fapi-customer-ip-address" type="string" required>
  The IP address of the customer making the request.
</ParamField>

<ParamField header="x-fapi-interaction-id" type="string" required>
  Unique identifier for the interaction/session.
</ParamField>

## Query Parameters

<ParamField query="loanApplicationId" type="string">
  Optional filter to show repayments for a specific loan application.
</ParamField>

<ParamField query="status" type="string">
  Optional filter by repayment status. Options: `PENDING_VERIFICATION`, `VERIFIED`, `REJECTED`, `ALL`.
</ParamField>

<ParamField query="page" type="number" default="1">
  Page number for pagination (starts from 1).
</ParamField>

<ParamField query="size" type="number" default="10">
  Number of items per page (maximum recommended: 50).
</ParamField>

<ParamField query="startDate" type="string">
  Optional start date filter (ISO 8601 format) to show repayments from a specific date.
</ParamField>

<ParamField query="endDate" type="string">
  Optional end date filter (ISO 8601 format) to show repayments up to a specific date.
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://remitjunction.fincode.software/api/v6/services/admin/repayments/list?page=1&size=10&status=VERIFIED' \
  --header 'X-Auth-Token: YOUR_JWT_ACCESS_TOKEN' \
  --header 'x-idempotency-key: unique-key-12345' \
  --header 'x-fapi-auth-date: 2024-01-15T10:30:00Z' \
  --header 'x-fapi-customer-ip-address: 192.168.1.1' \
  --header 'x-fapi-interaction-id: interaction-12345'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  const BASE_URL = 'https://remitjunction.fincode.software/api/v6/services/admin/repayments';

  async function listRepayments(accessToken, filters = {}) {
    try {
      const params = {
        page: filters.page || 1,
        size: filters.size || 10,
      };

      if (filters.loanApplicationId) {
        params.loanApplicationId = filters.loanApplicationId;
      }
      if (filters.status) {
        params.status = filters.status;
      }
      if (filters.startDate) {
        params.startDate = filters.startDate;
      }
      if (filters.endDate) {
        params.endDate = filters.endDate;
      }

      const response = await axios.get(`${BASE_URL}/list`, {
        params,
        headers: {
          'X-Auth-Token': accessToken,
          'x-idempotency-key': `key-${Date.now()}`,
          'x-fapi-auth-date': new Date().toISOString(),
            'x-fapi-customer-ip-address': '192.168.1.1',
            'x-fapi-interaction-id': `interaction-${Date.now()}`,
        },
      });

      const repayments = response.data.data.content;
      console.log(`Found ${repayments.length} repayments`);
      console.log(`Total: ${response.data.data.totalElements} repayments`);
      console.log(`Page ${response.data.data.currentPage} of ${response.data.data.totalPages}`);

      repayments.forEach((repayment) => {
        console.log(
          `- ${repayment.repaymentId}: ${repayment.repaymentAmount} ` +
          `(${repayment.paymentMethod}) - Status: ${repayment.status}`
        );
      });

      return response.data.data;
    } catch (error) {
      console.error(
        'Failed to list repayments:',
        error.response?.data || error.message
      );
      throw error;
    }
  }

  ```
</CodeGroup>


## OpenAPI

````yaml GET /admin/repayments/list
openapi: 3.0.0
info:
  title: FinCode API
  version: v6
servers:
  - url: https://{tenant}.fincode.software/api/v6/services
    description: API v6
    variables:
      tenant:
        default: remitjunction
        description: Enter your tenant subdomain
  - url: https://{tenant}.fincode.software/api/v1/services
    description: API v1
    variables:
      tenant:
        default: finlend
        description: Enter your tenant subdomain
  - url: https://api.stag.songhaiexchange.io
    description: Songhai Exchange API
security: []
paths:
  /admin/repayments/list:
    get:
      tags:
        - Lending
      summary: List Repayments
      description: Retrieves a paginated list of all repayments.
      parameters:
        - name: page
          in: query
          schema:
            type: integer
            default: 1
        - name: size
          in: query
          schema:
            type: integer
            default: 10
        - name: loanApplicationId
          in: query
          schema:
            type: string
        - name: status
          in: query
          schema:
            type: string
        - name: startDate
          in: query
          schema:
            type: string
        - name: endDate
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Repayments retrieved successfully

````