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

# API Key usage

> Interface description: Use `X-Api-Key` to retrieve call counts grouped by quota group for the API Key associated with the current credential. If `period` is omitted, the current UTC calendar month is returned. Pass `YYYY-MM` to query one specific previous month per request.

This endpoint returns quota usage, not successful publication counts, AI tokens, or detailed credit consumption. If no usage was recorded for a month, `used` is 0 for every group. Only the current API Key can be queried; arbitrary keys cannot be selected through request parameters.



## OpenAPI

````yaml /openapi/en/aitoearn.openapi.json get /api/api-key/current/usage
openapi: 3.0.1
info:
  title: AiToEarn Open Platform API
  description: >-
    AiToEarn Open Platform API. You can switch between the China and
    international sites for testing. Business success is determined by whether
    the response body has code === 0.
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: China site
  - url: https://aitoearn.ai
    description: International site
security: []
tags:
  - name: AI Services
  - name: AI Services/Video Generation
  - name: AI Services/Image Generation
  - name: Channel Management
  - name: Channel Management/Accounts
  - name: Channel Management/Publishing
  - name: Channel Management/Platforms
  - name: Channel Management/Works
  - name: Channel Management/Account Groups
  - name: Channel Management/Authorization
  - name: Asset Management
  - name: AI Services/Large Language Models
  - name: AI Services/Real-person Verification
  - name: AI Services/Virtual Portrait Assets
  - name: AI Services/Agent
  - name: Account & Keys/API Key
paths:
  /api/api-key/current/usage:
    get:
      tags:
        - Account & Keys/API Key
      summary: API Key usage
      description: >-
        Interface description: Use `X-Api-Key` to retrieve call counts grouped
        by quota group for the API Key associated with the current credential.
        If `period` is omitted, the current UTC calendar month is returned. Pass
        `YYYY-MM` to query one specific previous month per request.


        This endpoint returns quota usage, not successful publication counts, AI
        tokens, or detailed credit consumption. If no usage was recorded for a
        month, `used` is 0 for every group. Only the current API Key can be
        queried; arbitrary keys cannot be selected through request parameters.
      operationId: ApiKeyController_getCurrentUsage
      parameters:
        - name: period
          in: query
          required: false
          description: >-
            Usage period in YYYY-MM format. Optional; defaults to the current
            UTC calendar month. Example: 2026-09.
          schema:
            type: string
            pattern: ^\d{4}-\d{2}$
            example: 2026-09
            description: >-
              Usage period in YYYY-MM format. Optional; defaults to the current
              UTC calendar month. Example: 2026-09.
          example: 2026-09
      responses:
        '200':
          description: >-
            The request has been processed by the service. Business success is
            determined by whether the response body has code === 0.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      period:
                        type: string
                        description: Usage period in YYYY-MM format.
                        example: 2026-09
                      apiKeyId:
                        type: string
                        description: API Key ID。
                      userId:
                        type: string
                        description: ID of the user who owns this API key.
                      groups:
                        type: array
                        description: Usage grouped by quota group.
                        items:
                          type: object
                          properties:
                            groupId:
                              type: string
                              description: Quota group ID.
                            name:
                              type: string
                              description: Quota group name.
                            used:
                              type: number
                              description: Number of calls made in this period.
                          required:
                            - groupId
                            - name
                            - used
                          additionalProperties: false
                    required:
                      - period
                      - apiKeyId
                      - userId
                      - groups
                    additionalProperties: false
                  code:
                    type: integer
                    description: >-
                      Business status code. 0 means success; non-zero means a
                      business error.
                  message:
                    type: string
                    description: Response message.
                  requestId:
                    type: string
                    description: Request ID.
                  timestamp:
                    type: integer
                    description: Error response timestamp in Unix milliseconds.
                required:
                  - code
                  - message
              examples:
                success:
                  summary: Success
                  value:
                    code: 0
                    message: Request succeeded
                    data:
                      period: 2026-09
                      apiKeyId: key-id-1
                      userId: user-id-1
                      groups:
                        - groupId: publish-api
                          name: Publish API
                          used: 17
                    requestId: request-id-1
                unauthorized401:
                  summary: Unauthenticated or invalid API Key
                  value:
                    code: 401
                    message: Unauthorized
                    data: {}
                    timestamp: 1772099056662
      security:
        - apikey-header-X-Api-Key: []
components:
  securitySchemes:
    apikey-header-X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Need to get API Key from AiToEarn. Click to go to ["API Key Obtaining
        Tutorial"](/en/use/api-key).

````

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