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

# サブアカウントの使用量を取得

> 1つのサブアカウントのクレジットとタスクを UTC 日・エンジン別に取得します。



## OpenAPI

````yaml GET /v1/sub-accounts/{id}/usage
openapi: 3.1.0
info:
  title: querying.ai
  description: >-
    One API for every AI answer engine. Every task is asynchronous: submit, then
    collect the result via webhook or polling.
  version: 1.0.0
servers:
  - url: https://api.querying.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/sub-accounts/{id}/usage:
    get:
      tags:
        - Sub-accounts
      summary: Daily usage of a sub-account
      description: >-
        Credits and tasks charged to one sub-account per UTC day and engine.
        taskType OTHER is a charge that is not a task, such as a monitor's
        competitor analysis.
      operationId: getSubAccountUsage
      parameters:
        - name: id
          in: path
          required: true
          description: The sub-account id.
          schema:
            type: string
            format: uuid
        - name: from
          in: query
          description: >-
            First UTC date, inclusive. Default: the first day of the current UTC
            month.
          schema:
            type: string
            format: date
        - name: to
          in: query
          description: >-
            Last UTC date, inclusive. Default: today (UTC). The range spans at
            most 366 days, from and to included.
          schema:
            type: string
            format: date
      responses:
        '200':
          description: >-
            Credit and task totals for the range, and one row per UTC date and
            engine that had a charge.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubAccountDailyUsageResponse'
        '400':
          description: >-
            from or to is not a YYYY-MM-DD date, to is before from, or the range
            spans more than 366 days.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: to must not be before from
                  timestamp: '2026-10-09T09:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            The key cannot manage sub-accounts: it has an engine scope or a
            daily credit limit, it is a sub-account's key, or it is an operator
            key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: SUB_ACCOUNT_FORBIDDEN
                  message: >-
                    Managing sub-accounts needs an API key without an engine
                    scope or a daily credit limit
                  timestamp: '2026-10-09T09:00:00.000Z'
        '404':
          description: No sub-account with this id belongs to your account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No sub-account with that id
                  timestamp: '2026-10-09T09:00:00.000Z'
components:
  schemas:
    SubAccountDailyUsageResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          required:
            - id
            - from
            - to
            - credits
            - tasks
            - days
          properties:
            id:
              type: string
              format: uuid
            from:
              type: string
              format: date
            to:
              type: string
              format: date
            credits:
              type: number
              description: Total over days.
            tasks:
              type: integer
              description: Total over days.
            days:
              description: >-
                One row per UTC date and taskType that had a charge, oldest
                first. Days without charges are left out.
              type: array
              items:
                type: object
                required:
                  - date
                  - taskType
                  - credits
                  - tasks
                properties:
                  date:
                    type: string
                    format: date
                  taskType:
                    type: string
                    description: The engine, or OTHER for a charge that is not a task.
                  credits:
                    type: number
                  tasks:
                    type: integer
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorDetail'
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable, safe to branch on. See the Errors guide for the full list.
        message:
          type: string
          description: For humans. May change.
        details:
          description: >-
            Context for the error. An array of `{field, message}` on most
            `VALIDATION_ERROR`s; an object elsewhere (for example `{id}` on
            `RESOURCE_NOT_FOUND`, `retryAfterSec` on 429 and 503 codes). Omitted
            when there is nothing to add.
          oneOf:
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
            - type: object
              additionalProperties: true
        timestamp:
          type: string
          format: date-time
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: MISSING_API_KEY
              message: Missing or invalid API key
              timestamp: '2026-07-09T04:12:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````

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