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

# Utilisation des crédits

> Ce qui a été facturé à votre compte sur une plage de dates UTC, ventilé par jour, moteur et clé d'API.

La lecture ne coûte rien. Sans paramètre, elle renvoie le mois UTC en cours jusqu'à aujourd'hui, ventilé par jour et par moteur. Ajoutez `groupBy=key` pour voir quelle clé d'API a dépensé les crédits. Le sens de chaque champ figure dans [Crédits et limites](/fr/concepts/credits-and-limits.md#consulter-votre-utilisation).


## OpenAPI

````yaml GET /v1/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/usage:
    get:
      tags:
        - Operations
      summary: Get usage
      description: >-
        What your account was charged over a range of UTC dates, split by day,
        engine and key as you choose. It counts what tasks were charged. A
        monitor's monthly competitor read is charged without a task, so it
        lowers your balance but is not in usage. Reading it costs nothing.
      operationId: getUsage
      parameters:
        - 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
        - name: groupBy
          in: query
          description: >-
            How to split the rows: a comma-separated choice of `day`, `engine`
            and `key`. Default: `day,engine`.
          schema:
            type: string
            default: day,engine
            examples:
              - engine
              - day,key
      responses:
        '200':
          description: >-
            Credit and task totals for the range, and one row per combination of
            the chosen splits that had a charge.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Usage'
              example:
                success: true
                data:
                  from: '2026-10-01'
                  to: '2026-10-20'
                  groupBy:
                    - day
                    - engine
                  credits: 66.25
                  tasks: 65
                  rows:
                    - date: '2026-10-17'
                      taskType: CHATGPT
                      credits: 42
                      tasks: 42
                    - date: '2026-10-17'
                      taskType: PERPLEXITY
                      credits: 9
                      tasks: 9
                    - date: '2026-10-20'
                      taskType: CHATGPT
                      credits: 7
                      tasks: 7
                    - date: '2026-10-20'
                      taskType: GEMINI
                      credits: 6.25
                      tasks: 5
                    - date: '2026-10-20'
                      taskType: PERPLEXITY
                      credits: 2
                      tasks: 2
        '400':
          description: >-
            A date is not a `YYYY-MM-DD` date, `to` is before `from`, the range
            spans more than 366 days, or `groupBy` names something other than
            `day`, `engine` and `key`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: >-
                    groupBy must name some of day, engine, key, separated by
                    commas
                  timestamp: '2026-10-20T00:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            The key belongs to a sub-account. A sub-account spends its parent
            account's credits and has no balance; the parent account reads its
            usage at GET /v1/sub-accounts/{id}/usage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: SUB_ACCOUNT_FORBIDDEN
                  message: >-
                    A sub-account spends its parent account's credits. The
                    parent account reads its usage at
                    /v1/sub-accounts/{id}/usage
                  timestamp: '2026-10-20T00:00:00.000Z'
components:
  schemas:
    Usage:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          const: true
        data:
          type: object
          required:
            - from
            - to
            - groupBy
            - credits
            - tasks
            - rows
          properties:
            from:
              type: string
              format: date
              description: First UTC date of the range.
            to:
              type: string
              format: date
              description: Last UTC date of the range.
            groupBy:
              type: array
              items:
                type: string
                enum:
                  - day
                  - engine
                  - key
              description: The splits applied, always in the order day, engine, key.
            credits:
              type: number
              description: >-
                Credits charged over the range, with up to two decimals. The sum
                of every row.
            tasks:
              type: integer
              description: Tasks charged over the range.
            rows:
              type: array
              items:
                $ref: '#/components/schemas/UsageRow'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorDetail'
    UsageRow:
      type: object
      required:
        - credits
        - tasks
      description: >-
        Credits and tasks charged for one combination of the splits you chose. A
        row has the fields of those splits and no others. Rows run oldest day
        first, then by engine, then API keys by name, then the other sources. A
        combination with no charge has no row.
      properties:
        date:
          type: string
          format: date
          description: The UTC date. Present with `day`.
        taskType:
          type:
            - string
            - 'null'
          description: >-
            The engine that was charged. Present with `engine`. `null` for older
            charges that were recorded without an engine.
        source:
          type:
            - string
            - 'null'
          enum:
            - api
            - monitor
            - playground
            - dashboard
            - null
          description: >-
            Where the spend came from. Present with `key`. `api` is a task sent
            with an API key. `monitor` is a monitor's runs, `playground` the
            dashboard Playground and `dashboard` other dashboard actions. `null`
            when the charge names none of them.
        apiKey:
          type:
            - object
            - 'null'
          description: >-
            The API key that sent the tasks. Present with `key`; `null` unless
            `source` is `api`.
          required:
            - id
            - keyPrefix
            - name
            - subAccountId
          properties:
            id:
              type: string
              format: uuid
            keyPrefix:
              type:
                - string
                - 'null'
              description: >-
                The first characters of the key, as the dashboard shows them.
                `null` for a key that no longer exists.
            name:
              type:
                - string
                - 'null'
              description: >-
                The name you gave the key. `null` for a key that no longer
                exists.
            subAccountId:
              type:
                - string
                - 'null'
              format: uuid
              description: The sub-account that owns the key, or `null` for your own keys.
        credits:
          type: number
          description: Credits charged, with up to two decimals.
        tasks:
          type: integer
          description: Tasks charged.
    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.