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

# Đăng nhập

> API đăng nhập, trả về JWT token dùng cho tất cả các API khác (hiệu lực 8 giờ).



## OpenAPI

````yaml /vi/openapi/entrade-v1.yaml post /v2/auth
openapi: 3.1.0
info:
  title: Entrade Open API
  version: 1.0.0
  description: Đặc tả được trích xuất từ các request Bruno trong `collections/Entrade`.
servers:
  - url: https://services.entrade.com.vn/entrade-api
    description: Môi trường production
  - url: https://services-staging.entrade.com.vn/papertrade-entrade-api
    description: Môi trường staging
security:
  - BearerAuth: []
tags:
  - name: authentication
    description: API đăng nhập và cấp JWT token.
    x-group: Xác thực
  - name: account
    description: Thông tin tài khoản, tài sản và cấu hình rủi ro.
    x-group: Tài khoản
  - name: derivatives
    description: Giao dịch, sức mua, gói vay và vị thế phái sinh.
    x-group: Phái sinh
  - name: smart-order
    description: Lệnh điều kiện trên dịch vụ Smart Order.
    x-group: Smart Order
paths:
  /v2/auth:
    post:
      tags:
        - authentication
      summary: Đăng nhập
      description: >-
        API đăng nhập, trả về JWT token dùng cho tất cả các API khác (hiệu lực 8
        giờ).
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: Email hoặc số điện thoại
                password:
                  type: string
                  description: Mật khẩu
      responses:
        '200':
          description: Đăng nhập thành công
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthToken'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
      security: []
components:
  schemas:
    AuthToken:
      type: object
      properties:
        token:
          type: string
          description: JWT token (có hiệu lực trong 8 tiếng)
    Error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        status:
          type: number
  responses:
    BadRequest:
      description: Yêu cầu không hợp lệ
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Lỗi máy chủ
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token lấy từ API đăng nhập.

````

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