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

# Hạn mức gửi tin theo ngày của OA

> Hạn mức Zalo cấp cho từng Official Account, tính theo ngày và reset vào nửa đêm giờ Việt Nam.

Đây là trần **độc lập** với hạn mức tài khoản phía AdFlex. Zalo tự điều chỉnh hạn mức này theo chất lượng gửi của OA. Gửi lô lớn nên đối chiếu trước để chia lô cho vừa.

Không truyền `oa_id` thì trả về hạn mức của mọi OA thuộc workspace. Một OA lỗi không làm hỏng cả phản hồi — lỗi nằm ở trường `error` của riêng OA đó.

Scope: `messages:read`



## OpenAPI

````yaml https://business.adflex.vn/openapi.json get /api/v1/quota
openapi: 3.1.0
info:
  title: AdFlex ZNS API
  version: 1.0.0
  description: >-
    API gửi tin Zalo ZNS của AdFlex.


    API vận hành ở chế độ production, không có môi trường sandbox. Mỗi request
    thành công tạo một tin thật và trừ phí theo giá template.
  contact:
    name: AdFlex for Business
    url: https://business.adflex.vn
servers:
  - url: https://business.adflex.vn
    description: Production
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Template
    description: Khám phá template và OA khả dụng
  - name: Gửi tin
    description: Gửi một tin, gửi lô, gửi mã hoá đầu-cuối
  - name: Tra cứu
    description: Trạng thái tin và huỷ tin chưa gửi
paths:
  /api/v1/quota:
    get:
      tags:
        - Tra cứu
      summary: Hạn mức gửi tin theo ngày của OA
      description: >-
        Hạn mức Zalo cấp cho từng Official Account, tính theo ngày và reset vào
        nửa đêm giờ Việt Nam.


        Đây là trần **độc lập** với hạn mức tài khoản phía AdFlex. Zalo tự điều
        chỉnh hạn mức này theo chất lượng gửi của OA. Gửi lô lớn nên đối chiếu
        trước để chia lô cho vừa.


        Không truyền `oa_id` thì trả về hạn mức của mọi OA thuộc workspace. Một
        OA lỗi không làm hỏng cả phản hồi — lỗi nằm ở trường `error` của riêng
        OA đó.


        Scope: `messages:read`
      operationId: getQuota
      parameters:
        - name: oa_id
          in: query
          required: false
          schema:
            type: string
          description: Lọc theo một OA
      responses:
        '200':
          description: Hạn mức theo OA
          content:
            application/json:
              schema:
                type: object
                properties:
                  quotas:
                    type: array
                    items:
                      $ref: '#/components/schemas/OaQuota'
                  count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    OaQuota:
      type: object
      properties:
        oa_id:
          type: string
        oa_name:
          type: string
        daily_quota:
          type:
            - integer
            - 'null'
          description: Số tin OA được gửi trong ngày. null nếu không lấy được từ Zalo.
        remaining:
          type:
            - integer
            - 'null'
          description: Số tin còn lại trong ngày
        used:
          type:
            - integer
            - 'null'
        reset_at:
          type: string
          format: date-time
          description: Thời điểm hạn mức reset — nửa đêm giờ Việt Nam
        error:
          type:
            - string
            - 'null'
          description: Lý do không lấy được hạn mức của riêng OA này
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              example: 401
            message:
              type: string
              example: API key không hợp lệ hoặc đã bị thu hồi
  responses:
    Unauthorized:
      description: Thiếu API key, key sai hoặc đã bị thu hồi
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Key thiếu scope, hoặc workspace đang tạm dừng
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Không tìm thấy tài nguyên trong workspace của key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer ak_live_…'
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Cách thay thế cho Bearer. Dùng một trong hai là đủ.

````