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

# Read credit usage

> Credits your team consumed in time buckets, per tool, member, project and API key.



## OpenAPI

````yaml openapi/magnific-api-v2-openapi.yaml GET /v2/team/credit-usage
openapi: 3.1.0
info:
  title: Magnific API v2 — Team
  version: 2.0.0
  description: >-
    Read and manage your team with the Magnific API v2: members, groups, API
    keys, credit limits, the total budget (beta), tool permissions, credit usage
    and audit logs. Authenticate with a personal token or with an API key in
    `x-magnific-api-key`; each operation names the scope a personal token needs
    (`api:read`, `api:write` or `api:destructive`). Errors are JSON `{code,
    message, details?, request_id?}`. Listings page with `limit` and `cursor`,
    and answer `meta.pagination.next_cursor`.
servers:
  - description: Production V2
    url: https://api.magnific.com
security:
  - magnificApiKey: []
  - bearerAuth: []
tags:
  - description: Members and invitations of your team.
    name: Members
  - description: Groups of your team.
    name: Groups
  - description: API keys of your team.
    name: API keys
  - description: Credit limits and the total budget.
    name: Budgets
  - description: Tool permissions of the organization, groups and members.
    name: Permissions
  - description: Credit usage and project budgets.
    name: Analytics
  - description: Audit-log events and reports.
    name: Audit logs
paths:
  /v2/team/credit-usage:
    get:
      tags:
        - Analytics
      summary: Read credit usage
      description: >-
        Credits consumed by your team in time buckets, per tool, member, project
        and API key. Owners and admins see the

        whole team, anyone else their own usage. Range limits: Enterprise up to
        365 days, Business up to 180. Without dates,

        the last 7 days.


        A personal token needs `api:read`.
      operationId: team_credit_usage_get
      parameters:
        - description: >-
            Personal token only: the team the call acts on (its UUID). The
            caller must be an active member of it. Without it, the team in the
            token is used; with neither, the call is `team_required` (400).
            Ignored for an API key, which always acts on its own team.
          example: 8a5b79ee-5d57-4ce0-b3e2-a00fbfed3ba5
          in: header
          name: x-magnific-team-id
          required: false
          schema:
            format: uuid
            type: string
        - in: query
          name: granularity
          required: false
          schema:
            default: day
            enum:
              - day
              - week
              - month
              - year
            type: string
        - example: '2026-11-01'
          in: query
          name: start_date
          required: false
          schema:
            format: date
            type: string
        - example: '2026-11-30'
          in: query
          name: end_date
          required: false
          schema:
            format: date
            type: string
        - description: Only these projects (up to 100). Comma-separated.
          example: a1b2c3d4-1111-4000-8000-000000000001
          in: query
          name: project_references
          required: false
          schema:
            type: string
        - description: Only these API keys (up to 100). Comma-separated.
          example: 00000000-0000-4000-8000-000000000001
          in: query
          name: api_key_ids
          required: false
          schema:
            type: string
        - description: Only the members of these groups (up to 100). Comma-separated.
          example: 10,20
          in: query
          name: group_ids
          required: false
          schema:
            type: string
        - description: >-
            Only these people (up to 100), case-insensitive. Usage through their
            API keys is filtered with `api_key_ids`. Comma-separated.
          example: designer@example.com
          in: query
          name: user_emails
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Teamteam_credit_usage_get_200_response'
          description: The usage, one entry per time bucket.
        '400':
          $ref: '#/components/responses/Team400-team-required'
        '401':
          $ref: '#/components/responses/Team401-unauthenticated'
        '403':
          $ref: '#/components/responses/Team403-forbidden'
        '404':
          $ref: '#/components/responses/Team404-not-found'
        '422':
          $ref: '#/components/responses/Team422-validation-failed'
        '429':
          $ref: '#/components/responses/Team429-rate-limited'
        '500':
          $ref: '#/components/responses/Team500-server-error'
        '503':
          $ref: '#/components/responses/Team503-service-unavailable'
      security:
        - magnificApiKey: []
        - bearerAuth: []
components:
  schemas:
    Teamteam_credit_usage_get_200_response:
      example:
        data:
          - date: '2026-11-01 00:00:00+00:00'
            consumptions:
              - user_usages:
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                project_reference: a1b2c3d4-1111-4000-8000-000000000001
                user_credits: 1800
                tool_key: pikaso-tti-flux-dev
                user_uses: 45
                tool_label: AI Image Models
              - user_usages:
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                project_reference: a1b2c3d4-1111-4000-8000-000000000001
                user_credits: 1800
                tool_key: pikaso-tti-flux-dev
                user_uses: 45
                tool_label: AI Image Models
          - date: '2026-11-01 00:00:00+00:00'
            consumptions:
              - user_usages:
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                project_reference: a1b2c3d4-1111-4000-8000-000000000001
                user_credits: 1800
                tool_key: pikaso-tti-flux-dev
                user_uses: 45
                tool_label: AI Image Models
              - user_usages:
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                  - user_email: designer@example.com
                    user_reference: usr_a3f81c2d9e4b7f60
                    project_reference: project_reference
                    user_credits: 400
                    user_uses: 10
                    api_key_id: 00000000-0000-4000-8000-000000000001
                    api_key_name: prod-batch
                project_reference: a1b2c3d4-1111-4000-8000-000000000001
                user_credits: 1800
                tool_key: pikaso-tti-flux-dev
                user_uses: 45
                tool_label: AI Image Models
      properties:
        data:
          items:
            $ref: '#/components/schemas/Teamcredit_usage_point'
          type: array
      required:
        - data
      type: object
    Teamcredit_usage_point:
      example:
        date: '2026-11-01 00:00:00+00:00'
        consumptions:
          - user_usages:
              - user_email: designer@example.com
                user_reference: usr_a3f81c2d9e4b7f60
                project_reference: project_reference
                user_credits: 400
                user_uses: 10
                api_key_id: 00000000-0000-4000-8000-000000000001
                api_key_name: prod-batch
              - user_email: designer@example.com
                user_reference: usr_a3f81c2d9e4b7f60
                project_reference: project_reference
                user_credits: 400
                user_uses: 10
                api_key_id: 00000000-0000-4000-8000-000000000001
                api_key_name: prod-batch
            project_reference: a1b2c3d4-1111-4000-8000-000000000001
            user_credits: 1800
            tool_key: pikaso-tti-flux-dev
            user_uses: 45
            tool_label: AI Image Models
          - user_usages:
              - user_email: designer@example.com
                user_reference: usr_a3f81c2d9e4b7f60
                project_reference: project_reference
                user_credits: 400
                user_uses: 10
                api_key_id: 00000000-0000-4000-8000-000000000001
                api_key_name: prod-batch
              - user_email: designer@example.com
                user_reference: usr_a3f81c2d9e4b7f60
                project_reference: project_reference
                user_credits: 400
                user_uses: 10
                api_key_id: 00000000-0000-4000-8000-000000000001
                api_key_name: prod-batch
            project_reference: a1b2c3d4-1111-4000-8000-000000000001
            user_credits: 1800
            tool_key: pikaso-tti-flux-dev
            user_uses: 45
            tool_label: AI Image Models
      properties:
        date:
          description: Start of the time bucket.
          example: '2026-11-01 00:00:00+00:00'
          format: date-time
          type: string
        consumptions:
          items:
            $ref: '#/components/schemas/Teamcredit_usage_point_consumptions_inner'
          type: array
      type: object
    Teamerror:
      description: The body of every error of API v2.
      example:
        code: validation_failed
        details:
          required_scope: api:write
          errors:
            key:
              - errors
              - errors
        message: Validation error.
        request_id: 0f8c2c1e8d6a4b7f
      properties:
        code:
          description: >-
            Stable, for code: `team_required`, `unauthenticated`,
            `insufficient_scope`, `magnific_api_disabled`, `forbidden`,
            `not_found`, `conflict`, `validation_failed`, `upgrade_required`,
            `rate_limited`, `upstream_error`, `service_unavailable`,
            `server_error`... Each response lists the codes it carries.
          example: validation_failed
          type: string
        message:
          description: For people. The text can change.
          example: Validation error.
          type: string
        details:
          $ref: '#/components/schemas/Teamerror_details'
        request_id:
          description: >-
            The request's id, the same as the `X-Request-Id` response header.
            Share it with support.
          example: 0f8c2c1e8d6a4b7f
          type: string
      required:
        - code
        - message
      type: object
    Teamcredit_usage_point_consumptions_inner:
      example:
        user_usages:
          - user_email: designer@example.com
            user_reference: usr_a3f81c2d9e4b7f60
            project_reference: project_reference
            user_credits: 400
            user_uses: 10
            api_key_id: 00000000-0000-4000-8000-000000000001
            api_key_name: prod-batch
          - user_email: designer@example.com
            user_reference: usr_a3f81c2d9e4b7f60
            project_reference: project_reference
            user_credits: 400
            user_uses: 10
            api_key_id: 00000000-0000-4000-8000-000000000001
            api_key_name: prod-batch
        project_reference: a1b2c3d4-1111-4000-8000-000000000001
        user_credits: 1800
        tool_key: pikaso-tti-flux-dev
        user_uses: 45
        tool_label: AI Image Models
      properties:
        tool_key:
          description: >-
            Stable, opaque key of the tool billed. Rows with the same
            `tool_label`, member, project and date are distinct consumptions
            told apart by this key: sum them, never de-duplicate them. Do not
            parse it.
          example: pikaso-tti-flux-dev
          type: string
        tool_label:
          description: >-
            Display name of the tool's category. For display only; it can
            change.
          example: AI Image Models
          type: string
        user_uses:
          example: 45
          type: integer
        user_credits:
          example: 1800
          type: integer
        project_reference:
          example: a1b2c3d4-1111-4000-8000-000000000001
          type:
            - string
            - 'null'
        user_usages:
          description: >-
            Per person or API key. An entry is attributable to a person by
            `user_email` and `user_reference` (the person's `member_id`), or to
            an API key by `api_key_id` and `api_key_name`.
          items:
            $ref: >-
              #/components/schemas/Teamcredit_usage_point_consumptions_inner_user_usages_inner
          type: array
      type: object
    Teamerror_details:
      additionalProperties: true
      description: >-
        What the refusal knows: `errors` lists the validation messages by field,
        `required_scope` names the scope an `insufficient_scope` error lacks,
        `minimum_credits` the lowest total budget allowed.
      example:
        required_scope: api:write
        errors:
          key:
            - errors
            - errors
      properties:
        errors:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
        required_scope:
          example: api:write
          type: string
      type: object
    Teamcredit_usage_point_consumptions_inner_user_usages_inner:
      example:
        user_email: designer@example.com
        user_reference: usr_a3f81c2d9e4b7f60
        project_reference: project_reference
        user_credits: 400
        user_uses: 10
        api_key_id: 00000000-0000-4000-8000-000000000001
        api_key_name: prod-batch
      properties:
        user_email:
          example: designer@example.com
          type:
            - string
            - 'null'
        user_reference:
          description: The person's `member_id`, also once their account is deleted.
          example: usr_a3f81c2d9e4b7f60
          type:
            - string
            - 'null'
        api_key_id:
          example: 00000000-0000-4000-8000-000000000001
          type:
            - string
            - 'null'
        api_key_name:
          example: prod-batch
          type:
            - string
            - 'null'
        user_uses:
          example: 10
          type: integer
        user_credits:
          example: 400
          type: integer
        project_reference:
          type:
            - string
            - 'null'
          example: null
      type: object
  responses:
    Team400-team-required:
      content:
        application/json:
          example:
            code: team_required
            message: 'No team: send x-magnific-team-id with the team id (a UUID).'
            request_id: 0f8c2c1e8d6a4b7f
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `team_required`: a personal token that names no team. Send
        `x-magnific-team-id`. Answered by the gateway.
    Team401-unauthenticated:
      content:
        application/json:
          example:
            code: unauthenticated
            message: Unauthenticated.
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: '`unauthenticated`: missing, invalid or expired credentials.'
    Team403-forbidden:
      content:
        application/json:
          examples:
            insufficient_scope:
              value:
                code: insufficient_scope
                message: Forbidden
                details:
                  required_scope: api:write
            magnific_api_disabled:
              value:
                code: magnific_api_disabled
                message: Magnific API is disabled for this organization.
            forbidden:
              value:
                code: forbidden
                message: You do not have permission to perform this action.
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `insufficient_scope`: the personal token or API key lacks the
        operation's scope (`details.required_scope`). `magnific_api_disabled`:
        the organization switched the Magnific API off. `forbidden`: the
        caller's role can't do this, on this resource, or the plan has no
        analytics.
    Team404-not-found:
      content:
        application/json:
          example:
            code: not_found
            message: Not Found
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `not_found`: no such member, group, API key or report in your team, or
        the route does not exist for your credential.
    Team422-validation-failed:
      content:
        application/json:
          example:
            code: validation_failed
            message: Validation error.
            details:
              errors:
                limit:
                  - This value should be an integer between 1 and 100.
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `validation_failed`: the body or the query is not valid. Field errors
        are listed by field in `details.errors`; a field or parameter the
        operation does not take is refused as not supported. A rule the domain
        checks comes with only `message`.
    Team429-rate-limited:
      content:
        application/json:
          example:
            code: rate_limited
            message: Too many requests
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `rate_limited`: too many requests. Wait the seconds in `Retry-After`.
        Answered by the gateway.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            example: 60
            type: integer
    Team500-server-error:
      content:
        application/json:
          example:
            code: server_error
            message: Internal Server error
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `server_error`: unexpected error. Retry; if it keeps failing, share the
        `request_id` with support.
    Team503-service-unavailable:
      content:
        application/json:
          example:
            code: service_unavailable
            message: Service Unavailable
          schema:
            $ref: '#/components/schemas/Teamerror'
      description: >-
        `service_unavailable`: the credential or the team could not be checked,
        or a search timed out. Retry later.
  securitySchemes:
    magnificApiKey:
      description: >
        Your Magnific API key. Required for authentication. [Learn how to obtain
        an API key](https://docs.magnific.com/quickstart)
      in: header
      name: x-magnific-api-key
      type: apiKey
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Personal access token. Reads need the `api:read` scope; changes (team,
        budgets, audit-log exports) need `api:write`. Pick the team with
        `x-magnific-team-id`.

````

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