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

# Danh sách khoản vay

> Lấy danh sách các khoản vay trên tiểu khoản theo bộ lọc. Hiện tại chỉ hỗ trợ các khoản vay cơ sở.



## OpenAPI

````yaml /vi/openapi/dnse.2026-09-25.openapi.yaml get /accounts/{accountNo}/loans
openapi: 3.0.0
info:
  title: DNSE OpenAPI (2026-09-25)
  version: 2.0.0
  description: DNSE OpenAPI spec
servers:
  - url: https://openapi.dnse.com.vn
    description: Production
  - url: https://sb-openapi.dnse.com.vn
    description: Sanbox
security: []
tags:
  - name: trading
    description: Xác thực và các hoạt động đặt lệnh.
    x-group: Giao dịch
  - name: account
    description: Tài khoản, số dư, khoản vay, lệnh và vị thế.
    x-group: Tài khoản
  - name: market
    description: Thông tin mã chứng khoán, báo giá, OHLC và giao dịch.
    x-group: Dữ liệu thị trường
paths:
  /accounts/{accountNo}/loans:
    parameters:
      - name: accountNo
        in: path
        required: true
        description: Số tiểu khoản
        schema:
          type: string
        example: '0001179019'
    get:
      tags:
        - account
      summary: Danh sách khoản vay
      description: >-
        Lấy danh sách các khoản vay trên tiểu khoản theo bộ lọc. Hiện tại chỉ hỗ
        trợ các khoản vay cơ sở.
      operationId: account_getLoans
      parameters:
        - $ref: '#/components/parameters/XApiKey'
        - $ref: '#/components/parameters/XAuxDate'
        - $ref: '#/components/parameters/XSignature'
        - name: version
          in: header
          required: false
          description: API version (YYYY-MM-DD)
          schema:
            type: string
        - name: marketType
          in: query
          required: false
          description: |-
            Loại thị trường
            - STOCK: Danh sách vị thế cơ sở
            - DERIVATIVE: Danh sách vị thế phái sinh
          schema:
            $ref: '#/components/schemas/MarketType'
          example: STOCK
        - name: disbursementFrom
          in: query
          required: false
          description: Ngày giải ngân bắt đầu (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: '2026-09-01'
        - name: disbursementTo
          in: query
          required: false
          description: Ngày giải ngân kết thúc (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: '2026-09-30'
        - name: dueDateFrom
          in: query
          required: false
          description: Ngày đến hạn bắt đầu (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: '2026-12-01'
        - name: dueDateTo
          in: query
          required: false
          description: Ngày đến hạn kết thúc (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: '2026-12-31'
        - name: pageSize
          in: query
          required: false
          description: Số bản ghi trên mỗi trang
          schema:
            type: integer
            format: int32
          example: 20
        - name: pageIndex
          in: query
          required: false
          description: Vị trí của trang hiện tại
          schema:
            type: integer
            format: int32
          example: 0
        - name: positionId
          in: query
          required: false
          description: Id vị thế
          schema:
            type: integer
            format: int32
          example: 8426
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoansResponse'
              example:
                loans:
                  - id: 8117
                    accountNo: '0001179019'
                    positionId: 8426
                    symbol: ACB
                    disbursementDate: '2026-09-10'
                    dueDate: '2026-12-09'
                    initialRate: 1
                    interestRate: 0.115
                    overdueInterestRate: 0.18
                    preferentialPeriod: 0
                    preferentialInterestRate: 0
                    principal: 1191245
                    remainPrincipal: 1191245
                    remainInterest: 1501
                pagination:
                  pageIndex: 0
                  pageSize: 20
                  totalRecords: 2
                  totalPages: 1
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    XApiKey:
      name: X-Api-Key
      in: header
      required: true
      description: >-
        API key được cấp khi đăng ký dịch vụ DNSE OpenAPI.

        Ví dụ:
        `b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=`
      schema:
        type: string
    XAuxDate:
      name: X-Aux-Date
      in: header
      required: true
      description: |-
        Thời gian thực hiện request, dùng trong cơ chế ký request của DNSE.
        Ví dụ: `Sat, 01 May 2026 14:24:23 +0000`
      schema:
        type: string
    XSignature:
      name: X-Signature
      in: header
      required: true
      description: >-
        Chữ ký xác thực request được tạo từ API key secret và X-Aux-Date.

        Ví dụ: `Signature
        keyId="b3JnOmRuc2UgaWQ6MjdlZTc1MzcxZGFkNTY0NmYzYTM2NDk1ZGE3OGNiOGQgaDptdXJtdXIxMjg=",algorithm="hmac-sha256",headers="(request-target)
        x-aux-date",signature="rfbVXHDUi%2B%2FsOkLXle7O17Qm%2F05cbISSR%2BDcFrBHfqQ%3D",nonce="4add8c3264e4492b9f8ecde0cf26b523"`
      schema:
        type: string
  schemas:
    MarketType:
      type: string
      description: |-
        Loại thị trường.

        - `STOCK`: Giao dịch cơ sở
        - `DERIVATIVE`: Giao dịch phái sinh
        - `BOND`: Giao dịch trái phiếu
      enum:
        - STOCK
        - DERIVATIVE
        - BOND
      x-enum-descriptions:
        - Giao dịch cơ sở
        - Giao dịch phái sinh
        - Giao dịch trái phiếu
      x-enum-varnames:
        - STOCK
        - DERIVATIVE
        - BOND
      example: STOCK
    LoansResponse:
      type: object
      properties:
        loans:
          type: array
          description: Danh sách các khoản vay
          items:
            $ref: '#/components/schemas/Loan'
          example:
            - id: 8117
              accountNo: '0001179019'
              positionId: 8426
              symbol: ACB
              disbursementDate: '2026-09-10'
              dueDate: '2026-12-09'
              initialRate: 1
              interestRate: 0.115
              overdueInterestRate: 0.18
              preferentialPeriod: 0
              preferentialInterestRate: 0
              principal: 1191245
              remainPrincipal: 1191245
              remainInterest: 1501
        pagination:
          type: object
          description: Thông tin phân trang của danh sách kết quả.
          properties:
            pageIndex:
              type: integer
              format: int32
              example: 0
              description: Chỉ số trang hiện tại, bắt đầu từ 0
            pageSize:
              type: integer
              format: int32
              example: 20
              description: Số lượng bản ghi tối đa trên mỗi trang
            totalRecords:
              type: integer
              format: int32
              example: 2
              description: Tổng số bản ghi
            totalPages:
              type: integer
              format: int32
              example: 1
              description: Tổng số trang
    Loan:
      type: object
      properties:
        id:
          type: integer
          format: int32
          example: 8117
          description: ID khoản vay
        accountNo:
          type: string
          example: '0001179019'
          description: Số tiểu khoản
        positionId:
          type: integer
          format: int32
          example: 8426
          description: ID vị thế liên kết với khoản vay
        symbol:
          type: string
          example: ACB
          description: Mã chứng khoán
        disbursementDate:
          type: string
          format: date
          example: '2026-09-10'
          description: Ngày giải ngân khoản vay
        dueDate:
          type: string
          format: date
          example: '2026-12-09'
          description: Ngày đến hạn của khoản vay
        initialRate:
          type: integer
          format: int32
          example: 1
          description: Tỷ lệ cho vay ban đầu
        interestRate:
          type: number
          format: double
          example: 0.115
          description: Lãi suất áp dụng cho khoản vay
        overdueInterestRate:
          type: number
          format: double
          example: 0.18
          description: Lãi suất áp dụng khi khoản vay quá hạn
        preferentialPeriod:
          type: integer
          format: int32
          example: 0
          description: Thời gian áp dụng lãi suất ưu đãi
        preferentialInterestRate:
          type: integer
          format: int32
          example: 0
          description: Lãi suất ưu đãi áp dụng cho khoản vay
        principal:
          type: integer
          format: int32
          example: 1191245
          description: Giá trị dư nợ gốc ban đầu của khoản vay
        remainPrincipal:
          type: integer
          format: int32
          example: 1191245
          description: Giá trị dư nợ gốc còn lại
        remainInterest:
          type: integer
          format: int32
          example: 1501
          description: Giá trị lãi vay còn lại
    ErrorBody:
      type: object
      required:
        - status
        - code
        - message
      properties:
        status:
          type: integer
          format: int32
          description: Mã HTTP.
          example: 400
        code:
          type: string
          description: Mã lỗi DNSE.
          example: OA-003
        message:
          type: string
          description: Thông điệp lỗi.
          example: Thông tin nhập không hợp lệ
  responses:
    BadRequest:
      description: Yêu cầu không hợp lệ.
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLength'
        Date:
          $ref: '#/components/headers/Date'
        Vary:
          $ref: '#/components/headers/Vary'
        X-Ratelimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-Ratelimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-Ratelimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Tyk-Api-Expires:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: 400
            code: OA-003
            message: Thông tin nhập không hợp lệ
    InternalError:
      description: Lỗi hệ thống.
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLength'
        Date:
          $ref: '#/components/headers/Date'
        Vary:
          $ref: '#/components/headers/Vary'
        X-Ratelimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-Ratelimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-Ratelimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        X-Tyk-Api-Expires:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            status: 500
            code: OA-009
            message: Lỗi hệ thống
  headers:
    ContentLength:
      description: Response body size in bytes.
      schema:
        type: integer
      example: 430
    Date:
      description: Response date from the DNSE gateway.
      schema:
        type: string
      example: Wed, 18 Mar 2026 16:17:35 GMT
    Vary:
      description: >-
        Response header indicating the request headers used for content
        negotiation.
      schema:
        type: string
      example: Origin
    XRateLimitLimit:
      description: Maximum number of requests allowed in the current rate-limit window.
      schema:
        type: integer
      example: 300
    XRateLimitRemaining:
      description: Number of requests remaining in the current rate-limit window.
      schema:
        type: integer
      example: 299
    XRateLimitReset:
      description: Unix timestamp at which the current rate-limit window resets.
      schema:
        type: integer
      example: 1773850655
    XRequestId:
      description: Unique identifier assigned to the request by the DNSE gateway.
      schema:
        type: string
      example: unknown

````

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