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

# Read a loan with its pending instructions

> The same loan view as the `loan` of the application view and of every `POST /v1/events` answer:
the schedule, `instructions` (pending only, oldest first) and `deduction` (the current deduction
instruction, null until the first payout). Read it every 30
seconds while `status` is pending_disbursement or `instructions` is not empty, and perform what is
listed. Read it once more 1 minute after the loan leaves pending_disbursement, and 1 minute after
every `deposit.settled` that was sent. Otherwise read each open loan once a day after 06:00
Colombia time. 404 for an unknown loan, a malformed id, or another partner's loan.




## OpenAPI

````yaml /api-reference/lending-openapi.yaml get /v1/loans/{loan_id}
openapi: 3.1.0
info:
  title: Cr3dentials Lending API
  version: 1.0.0
  description: >
    The partner API for Cr3dentials lending: applications, money steps,
    repayments and credit profiles. Money is integer USD cents.

    Every POST takes an Idempotency-Key header. Repeating a request with the
    same key and body

    replays the first response. Reusing a key with a different request is a 409.


    Webhooks (see `webhooks`): Cr3dentials POSTs outcomes that happen after a
    response to the partner's

    webhook URL as JSON `{event_id, type, created_at, data}`.

    - Signature: `X-Timestamp` is unix seconds; `X-Signature` is `v1=<lowercase
    hex HMAC-SHA256(secret, "<X-Timestamp>." + raw body)>`.
      The key is the whole `whsec_...` secret string. Verify against the raw body bytes before parsing.
    - The signing secret is shared once, when your webhook URL is registered.
    Rotating it ends the old
      secret at once.
    - Delivery is at least once: deduplicate by `event_id`. Answer 2xx to
    acknowledge. 408, 429, 5xx and
      network errors are retried with backoff for about 3 hours; any other 4xx stops delivery of that event.
    - Order is not guaranteed. `GET /v1/applications/{id}` is the source of
    truth.
servers: []
security:
  - bearerAuth: []
paths:
  /v1/loans/{loan_id}:
    get:
      summary: Read a loan with its pending instructions
      description: >
        The same loan view as the `loan` of the application view and of every
        `POST /v1/events` answer:

        the schedule, `instructions` (pending only, oldest first) and
        `deduction` (the current deduction

        instruction, null until the first payout). Read it every 30

        seconds while `status` is pending_disbursement or `instructions` is not
        empty, and perform what is

        listed. Read it once more 1 minute after the loan leaves
        pending_disbursement, and 1 minute after

        every `deposit.settled` that was sent. Otherwise read each open loan
        once a day after 06:00

        Colombia time. 404 for an unknown loan, a malformed id, or another
        partner's loan.
      operationId: getLoan
      parameters:
        - name: loan_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The loan view
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoanView'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    LoanView:
      type: object
      required:
        - loan_id
        - status
        - currency
        - principal_cents
        - interest_cents
        - hold_cents
        - outstanding_cents
        - installments
        - instructions
        - deduction
      properties:
        loan_id:
          type: string
          format: uuid
        status:
          type: string
        currency:
          type: string
          enum:
            - USD
        principal_cents:
          type: integer
        interest_cents:
          type: integer
        hold_cents:
          type: integer
        outstanding_cents:
          type: integer
          description: >-
            Contractual balance, the sum of amount due less amount paid over the
            current installments. It is 0 while the loan is pending_disbursement
            or cancelled, because nothing is owed until the payout is confirmed;
            each installment's `amount_due_cents` still shows the schedule.
        installments:
          type: array
          items:
            $ref: '#/components/schemas/LoanInstallment'
        instructions:
          type: array
          description: Pending instructions only, oldest first.
          items:
            $ref: '#/components/schemas/Instruction'
        deduction:
          description: >-
            The stored deduction instruction, never recomputed; null until the
            first payout.
          oneOf:
            - $ref: '#/components/schemas/DeductionInstruction'
            - type: 'null'
    LoanInstallment:
      type: object
      required:
        - seq
        - amount_due_cents
        - principal_due_cents
        - interest_due_cents
        - amount_paid_cents
        - due_date
        - provisional_due_date
        - paid_at
        - status
      properties:
        seq:
          type: integer
        amount_due_cents:
          type: integer
        principal_due_cents:
          type: integer
        interest_due_cents:
          type: integer
        amount_paid_cents:
          type: integer
        due_date:
          type:
            - string
            - 'null'
          format: date
        provisional_due_date:
          type:
            - string
            - 'null'
          format: date
        paid_at:
          type:
            - string
            - 'null'
          format: date-time
        status:
          type: string
    Instruction:
      type: object
      required:
        - instruction_id
        - kind
        - amount_cents
        - currency
        - issued_at
      properties:
        instruction_id:
          type: string
          format: uuid
        kind:
          type: string
          enum:
            - place_hold
            - pay_out
            - release_hold
            - refund
        amount_cents:
          type: integer
        currency:
          const: USD
        issued_at:
          type: string
          format: date-time
    DeductionInstruction:
      type: object
      required:
        - instruction_version
        - status
        - installment_seq
        - amount_cents
        - currency
        - deposit_filter
        - max_deposit_pct
      properties:
        instruction_version:
          type: integer
          minimum: 1
        status:
          type: string
          enum:
            - active
            - cancelled
        installment_seq:
          type:
            - integer
            - 'null'
        amount_cents:
          type: integer
        currency:
          const: USD
        deposit_filter:
          const: inbound_bank_transfer_from_outside
        max_deposit_pct:
          const: 100
    Error:
      type: object
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          required:
            - code
            - message
            - details
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items: {}
        request_id:
          type: string
  responses:
    Unauthenticated:
      description: UNAUTHENTICATED
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: NOT_FOUND, also for another partner's application
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token from POST /v1/oauth/token (client credentials)

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.