> ## 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.

# Screen a borrower and open an application

> Takes the borrower's data from the inline `data` block. `data` and `consent` are required, and a
missing one is a 400 with details [{"field": "data"}] or [{"field": "consent"}].
Runs the screening rules and stores the decision. Returns 201 with an offer, or 200 with a decline.
A body that does not parse is a 400 with a fixed message and no details.
The body is limited to 1 MiB, which is about 2,500 entries in `data.transactions` with every field filled
(more when optional fields are left out); a larger body is a 413 PAYLOAD_TOO_LARGE.




## OpenAPI

````yaml /api-reference/lending-openapi.yaml post /v1/applications
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/applications:
    post:
      summary: Screen a borrower and open an application
      description: >
        Takes the borrower's data from the inline `data` block. `data` and
        `consent` are required, and a

        missing one is a 400 with details [{"field": "data"}] or [{"field":
        "consent"}].

        Runs the screening rules and stores the decision. Returns 201 with an
        offer, or 200 with a decline.

        A body that does not parse is a 400 with a fixed message and no details.

        The body is limited to 1 MiB, which is about 2,500 entries in
        `data.transactions` with every field filled

        (more when optional fields are left out); a larger body is a 413
        PAYLOAD_TOO_LARGE.
      operationId: createApplication
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewApplication'
      responses:
        '200':
          description: Screened and declined
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationView'
        '201':
          description: Screened and offered
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationView'
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '409':
          description: >-
            IDEMPOTENCY_KEY_REUSED, REQUEST_IN_PROGRESS or
            APPLICATION_IN_PROGRESS. The last one has details
            [{"application_id"}].
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: PAYLOAD_TOO_LARGE. The body is over 1 MiB.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: ORIGINATION_PAUSED or POLICY_NOT_READY
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: 1 to 255 visible ASCII characters
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    NewApplication:
      type: object
      additionalProperties: false
      required:
        - partner_account_id
      properties:
        partner_account_id:
          type: string
          minLength: 1
          maxLength: 128
        consent:
          $ref: '#/components/schemas/Consent'
        data:
          $ref: '#/components/schemas/CustomerData'
    ApplicationView:
      type: object
      required:
        - application_id
        - partner_account_id
        - step
        - status
        - is_first_loan
        - expires_at
        - offer
        - decline
        - loan
      properties:
        application_id:
          type: string
          format: uuid
        partner_account_id:
          type: string
        step:
          type: string
          enum:
            - screening
            - prequalified
            - additional_income
            - selection
            - final_checks
            - funding
        status:
          type: string
          enum:
            - in_progress
            - funded
            - declined
            - expired
            - withdrawn
            - funding_failed
        is_first_loan:
          type: boolean
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        offer:
          oneOf:
            - $ref: '#/components/schemas/Offer'
            - type: 'null'
        decline:
          oneOf:
            - $ref: '#/components/schemas/Decline'
            - type: 'null'
        loan:
          oneOf:
            - $ref: '#/components/schemas/LoanView'
            - type: 'null'
    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
    Consent:
      type: object
      additionalProperties: false
      required:
        - reference
        - granted_at
      properties:
        reference:
          type: string
          minLength: 1
          maxLength: 32
        granted_at:
          type: string
          format: date-time
          description: No more than 5 minutes ahead of the server clock
    CustomerData:
      type: object
      additionalProperties: false
      required:
        - customer
        - balance
        - security
      description: >-
        A 400 names each invalid field as `{"field":
        "data.transactions[0].amount_cents"}`, never its value.
      properties:
        customer:
          type: object
          additionalProperties: false
          required:
            - full_name
            - country
          properties:
            full_name:
              type: string
              minLength: 1
            national_id:
              type: string
            phone:
              type: string
            email:
              type: string
            country:
              type: string
            account_opened_on:
              type: string
              format: date
            active:
              type: boolean
            kyc_verified:
              type: boolean
        balance:
          type: object
          additionalProperties: false
          required:
            - holdable_cents
          properties:
            holdable_cents:
              type: integer
              minimum: 0
        transactions:
          type: array
          description: >-
            Without it the application is declined with
            SYS_PARTNER_DATA_UNAVAILABLE
          items:
            type: object
            additionalProperties: false
            required:
              - id
              - direction
              - amount_cents
              - currency
              - transfer_type
            properties:
              id:
                type: string
                minLength: 1
                maxLength: 128
              direction:
                type: string
                enum:
                  - in
                  - out
              amount_cents:
                type: integer
                minimum: 1
              currency:
                type: string
                const: USD
              settled_at:
                type:
                  - string
                  - 'null'
                format: date-time
              transfer_type:
                type: string
                enum:
                  - bank_transfer
                  - card
                  - internal
                  - crypto
                  - other
              from_outside_institution:
                type: boolean
              into_own_account:
                type: boolean
              payer_name:
                type:
                  - string
                  - 'null'
              intermediary:
                type:
                  - string
                  - 'null'
              beneficiary_name:
                type:
                  - string
                  - 'null'
              counterparty_name:
                type:
                  - string
                  - 'null'
              merchant_name:
                type:
                  - string
                  - 'null'
              merchant_category:
                type:
                  - string
                  - 'null'
              balance_after_cents:
                type:
                  - integer
                  - 'null'
        account_events:
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - kind
              - 'on'
            properties:
              kind:
                type: string
                enum:
                  - overdraft
                  - returned_payment
                  - insufficient_funds
                  - negative_balance
              'on':
                type: string
                format: date
        security:
          type: object
          additionalProperties: false
          properties:
            credential_changes:
              type: array
              items:
                type: object
                additionalProperties: false
                required:
                  - kind
                  - 'on'
                properties:
                  kind:
                    type: string
                    enum:
                      - phone
                      - email
                      - password
                      - two_factor
                  'on':
                    type: string
                    format: date
            devices:
              type: array
              items:
                type: object
                additionalProperties: false
                required:
                  - id
                  - first_seen_on
                properties:
                  id:
                    type: string
                  first_seen_on:
                    type: string
                    format: date
            withdrawal_destinations_added:
              type: array
              items:
                type: object
                additionalProperties: false
                required:
                  - 'on'
                properties:
                  'on':
                    type: string
                    format: date
    Offer:
      type: object
      required:
        - offer_id
        - kind
        - currency
        - max_amount_cents
        - interest_cents
        - hold_cents
        - installment_count
        - credit_level
        - income_base_cents
        - max_payment_cents
        - installments
        - income_verification
      properties:
        offer_id:
          type: string
          format: uuid
        kind:
          type: string
          enum:
            - prequalified
            - recalculated
        currency:
          type: string
          enum:
            - USD
        max_amount_cents:
          type: integer
        interest_cents:
          type: integer
        hold_cents:
          type: integer
        installment_count:
          type: integer
        credit_level:
          type: integer
        income_base_cents:
          type: integer
        max_payment_cents:
          type: integer
        installments:
          type: array
          items:
            $ref: '#/components/schemas/OfferInstallment'
        income_verification:
          type: object
          required:
            - platforms
          properties:
            platforms:
              type: array
              items:
                type: string
    Decline:
      type: object
      required:
        - reasons
      properties:
        reasons:
          type: array
          items:
            $ref: '#/components/schemas/DeclineReason'
    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'
    OfferInstallment:
      type: object
      required:
        - seq
        - amount_due_cents
        - principal_cents
        - interest_cents
      properties:
        seq:
          type: integer
        amount_due_cents:
          type: integer
        principal_cents:
          type: integer
        interest_cents:
          type: integer
    DeclineReason:
      type: object
      required:
        - code
        - borrower_message
        - how_to_improve
      properties:
        code:
          type: string
        borrower_message:
          type: string
        how_to_improve:
          type: string
    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
  responses:
    ValidationFailed:
      description: VALIDATION_FAILED
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthenticated:
      description: UNAUTHENTICATED
      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.