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

# Clear Dues

> Clears outstanding dues for a chain by generating repayments in a waterfall: interest is paid first, then principal. Either repayment may be null if there was nothing owed in that category.



## OpenAPI

````yaml openapi-v2-0-0.json post /api/v2/liquidity/management/repayments/clear-dues
openapi: 3.0.3
info:
  title: Mansa Liquidity API — v2
  description: >
    API for managing credit limits and whitelisted wallets for cross-border
    liquidity operations.


    ## Rate Limiting

    - 100 requests per minute per API key

    - Specific endpoints may have additional limits


    ## Security

    - All endpoints require authentication

    - KYC verification may be required depending on organization policy


    ## Error Handling

    This API uses HTTP status codes and a structured error envelope in the
    response body.


    - **2xx** — The request succeeded.

    - **4xx** — The request failed due to a problem with the information
    provided.

    - **5xx** — A problem occurred on our servers or with an upstream
    dependency.


    When an error occurs, the response body has the shape:


    ```json

    {
      "error": {
        "type": "validation_error",
        "code": "missing_required_field",
        "message": "The 'amount' field is required.",
        "param": "amount",
        "doc_url": "https://docs.mansa.io/errors/missing_required_field",
        "request_id": "req_123456789"
      }
    }

    ```
  version: v2
  contact:
    name: Mansa API Support
    email: api-support@mansa.io
    url: https://docs.mansa.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.mansa.xyz
    description: Production server
  - url: https://sandbox-api.mansa.xyz
    description: Sandbox server
security:
  - ApiKeyAuth: []
    BearerAuth: []
tags:
  - name: Onboarding
    description: V2 credit limit and whitelist operations
  - name: Management
    description: V2 settlement facilities, balances, withdrawal requests, and repayments
  - name: Utilization
    description: >-
      V2 drawdown intents, settlement confirmations, proofs, and document
      uploads
paths:
  /api/v2/liquidity/management/repayments/clear-dues:
    post:
      tags:
        - Management
      summary: Clear Dues
      description: >-
        Clears outstanding dues for a chain by generating repayments in a
        waterfall: interest is paid first, then principal. Either repayment may
        be null if there was nothing owed in that category.
      operationId: v2ClearDues
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClearDuesRequest'
      responses:
        '201':
          description: Dues cleared
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClearDuesResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    ClearDuesRequest:
      type: object
      required:
        - chain_id
      properties:
        chain_id:
          type: string
          format: uuid
    ClearDuesResponse:
      type: object
      properties:
        penaltyRepayment:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ClearDuesRepaymentItem'
          description: Null if there was no outstanding penalty to repay.
        interestRepayment:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ClearDuesRepaymentItem'
          description: Null if there was no outstanding interest to repay.
        principalRepayment:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ClearDuesRepaymentItem'
          description: Null if there was no outstanding principal to repay.
        pendingPrincipalAfterInterest:
          type: boolean
          description: >-
            True if principal repayment is still pending because interest wasn't
            fully covered.
    ClearDuesRepaymentItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
        amount:
          type: number
        type:
          $ref: '#/components/schemas/RepaymentTypeEnum'
        orgId:
          type: string
          format: uuid
        transactionHash:
          type: string
        status:
          $ref: '#/components/schemas/TransactionLifecycleStatus'
        chainId:
          type: string
          format: uuid
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      description: Standard error envelope
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
      required:
        - error
      additionalProperties: false
      example:
        error:
          type: validation_error
          code: missing_required_field
          message: The 'amount' field is required.
          param: amount
          doc_url: https://docs.mansa.io/errors/missing_required_field
          request_id: req_123456789
    RepaymentTypeEnum:
      type: string
      enum:
        - interest
        - principal
        - penalty
    TransactionLifecycleStatus:
      type: string
      enum:
        - SUBMITTED
        - PENDING_SCREENING
        - PENDING_ENRICHMENT
        - PENDING_AUTHORIZATION
        - QUEUED
        - PENDING_SIGNATURE
        - PENDING_3RD_PARTY_MANUAL_APPROVAL
        - PENDING_3RD_PARTY
        - BROADCASTING
        - CONFIRMING
        - COMPLETED
        - CANCELLING
        - CANCELLED
        - BLOCKED
        - REJECTED
        - FAILED
    ErrorObject:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/ErrorTypeEnum'
        code:
          type: string
          nullable: true
          description: Programmatic error code
        message:
          type: string
          nullable: true
          description: Human-readable error message
        param:
          type: string
          nullable: true
          description: Parameter related to the error, if applicable
        doc_url:
          type: string
          format: uri
          nullable: true
          description: Link to docs for this error
        request_id:
          type: string
          nullable: true
          description: Internal request identifier for support
      required:
        - type
      additionalProperties: false
    ErrorTypeEnum:
      type: string
      enum:
        - api_error
        - validation_error
        - auth_error
        - idempotency_error
        - rate_limit_error
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_param:
              value:
                error:
                  type: validation_error
                  code: missing_required_field
                  message: The 'amount' field is required.
                  param: amount
                  doc_url: https://docs.mansa.io/errors/missing_required_field
    Unauthorized:
      description: Authentication required or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_token:
              value:
                error:
                  type: auth_error
                  code: invalid_token
                  message: Bearer token is missing or invalid.
    UnprocessableEntity:
      description: Request was syntactically correct but semantically invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            semantic_validation:
              value:
                error:
                  type: validation_error
                  code: business_rule_violation
                  message: Requested amount exceeds allowed corridor maximum.
    RateLimited:
      description: Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          description: Request limit per window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Remaining requests in window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: UNIX epoch seconds when the rate limit resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            too_many_requests:
              value:
                error:
                  type: rate_limit_error
                  code: too_many_requests
                  message: Too many requests. Please retry with exponential backoff.
    ServerError:
      description: Internal server or upstream error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            upstream_failure:
              value:
                error:
                  type: api_error
                  code: upstream_dependency_error
                  message: A dependency failed to process the request.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token following RFC001 specification

````