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

# Get Api Usage

> Summary + daily / per-key / per-operation aggregates for the caller's team.

Role-scoped: admins/owners see every row in the team; members see only
rows attributable to their own API keys plus their own MCP-origin rows.
Max range 90 days; defaults to the last 7 days when unspecified.



## OpenAPI

````yaml /openapi/moda-public-api.yaml get /usage
openapi: 3.1.0
info:
  title: Moda Public API
  description: >
    Programmatic access to Moda's canvas design platform. Create designs, export
    assets, manage brand kits, and run AI design tasks.


    ## Versioning


    Pin response shapes with a calendar-dated `Moda-Version` header (e.g.
    `2026-05-01`). **The pin is global** — it applies to every endpoint in the
    request, not just the one you adopted it for, so raising it to use a new
    endpoint also moves your other responses to that version's shapes.


    ### Migrating `2026-04-12` → `2026-05-01`


    - **Tasks** move from the flat `JobResponse` (`job_id`, `canvas_url`,
    `can_export`) to the canonical `Task` envelope. The export artifact is now
    under `result.export` as `{url, format, page_count}`; update any code that
    read the export URL from the old top-level fields.

    - **Multi-page PNG/JPEG exports are delivered as a single `.zip`** of
    per-page files (`page-1.png`, …), so `result.export.format` is `zip`. For
    one bundled document instead, request `format=pdf` or `pptx`; for a single
    image, pass `page_number`.
  version: 1.0.0
  x-moda-api-version: '2026-05-01'
servers:
  - url: https://api.moda.app/v1
    description: Production
security: []
tags:
  - name: canvases
    description: List, search, read, export, and share canvases
  - name: tasks
    description: Start and monitor AI design tasks
  - name: organizations
    description: List organizations and teams
  - name: credits
    description: Check credit balance and usage
  - name: brand-kits
    description: Manage brand kits
  - name: remix
    description: Duplicate and edit canvases
  - name: share-links
    description: Resolve share URLs to canvas identifiers
  - name: uploads
    description: Upload files for use as attachments
  - name: usage
    description: Aggregate API usage stats for the caller's team
  - name: embed
    description: Signed iframe embed sessions
  - name: web
    description: 'Metered web research: search and page reading'
  - name: websites
    description: >-
      Create, update, publish, screenshot, and manage hosted multi-page static
      sites
  - name: drive
    description: >-
      Organize the workspace: folders, the folder tree, and item
      move/rename/visibility/delete for folders, canvases, and files
paths:
  /usage:
    get:
      tags:
        - usage
      summary: Get Api Usage
      description: >-
        Summary + daily / per-key / per-operation aggregates for the caller's
        team.


        Role-scoped: admins/owners see every row in the team; members see only

        rows attributable to their own API keys plus their own MCP-origin rows.

        Max range 90 days; defaults to the last 7 days when unspecified.
      operationId: getApiUsage
      parameters:
        - name: api_key_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Optional API-key UUID filter. Narrows all aggregates to the given
              key.
            title: Api Key Id
          description: >-
            Optional API-key UUID filter. Narrows all aggregates to the given
            key.
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: ISO8601 UTC lower bound (inclusive). Defaults to ``to - 7d``.
            title: From
          description: ISO8601 UTC lower bound (inclusive). Defaults to ``to - 7d``.
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            description: ISO8601 UTC upper bound (exclusive). Defaults to ``now``.
            title: To
          description: ISO8601 UTC upper bound (exclusive). Defaults to ``now``.
        - $ref: '#/components/parameters/ModaVersion'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Permission denied for this scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Conflict (idempotency / resource state).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Internal error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      security:
        - API Key: []
components:
  parameters:
    ModaVersion:
      name: Moda-Version
      in: header
      required: false
      description: >-
        Calendar-dated API version pin. New integrations should pin `2026-05-01`
        to opt into the newest response shapes. For back-compat the server also
        accepts requests with no header and resolves them to the current default
        (today: `2026-04-12`); that default advances on each [sunset
        date](/api-reference/versioning). Any unsupported value returns 400
        `unsupported_version`.
      example: '2026-05-01'
      schema:
        type: string
        enum:
          - '2026-04-12'
          - '2026-05-01'
        default: '2026-05-01'
        example: '2026-05-01'
  schemas:
    UsageResponse:
      properties:
        period:
          $ref: '#/components/schemas/UsagePeriod'
        summary:
          $ref: '#/components/schemas/UsageSummary'
        daily:
          items:
            $ref: '#/components/schemas/UsageDaily'
          type: array
          title: Daily
        by_api_key:
          items:
            $ref: '#/components/schemas/UsageByApiKey'
          type: array
          title: By Api Key
        by_operation:
          items:
            $ref: '#/components/schemas/UsageByOperation'
          type: array
          title: By Operation
      type: object
      required:
        - period
        - summary
        - daily
        - by_api_key
        - by_operation
      title: UsageResponse
    ErrorEnvelope:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          type: string
          title: Code
          description: >-
            Stable machine string keyed to doc_url. Never changes once
            published.
        message:
          type: string
          title: Message
          description: >-
            Human-readable message, for developers. Not localized, not
            user-facing.
        doc_url:
          type: string
          title: Doc Url
          description: Permalink to the docs page for this code.
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: Correlator for logs/Sentry/audit.
        causes:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorEnvelope'
              type: array
            - type: 'null'
          title: Causes
          description: Aggregated upstream failures (e.g. per-page export errors).
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Code-specific detail payload (e.g. validation field list). Callers
            should pass ``None`` rather than ``{}`` to omit the key from the
            response.
        retry_after_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Retry After Ms
          description: Hint for rate-limited or transient errors.
        retryable:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Retryable
          description: >-
            Explicit retryability for this code, from the error-code registry:
            ``false`` means retrying the same request cannot succeed (fix the
            input / resource first); ``true`` means the condition is transient
            and a retry (with backoff / after the blocker clears) can succeed.
            Omitted for codes whose retryability is context-dependent — do not
            derive it from ``type`` or the HTTP status when this field is
            present.
      type: object
      required:
        - type
        - code
        - message
        - doc_url
      title: ErrorEnvelope
      description: >-
        Canonical error payload, nested under the top-level ``{"error": ...}``
        key.
    UsagePeriod:
      properties:
        start:
          type: string
          format: date-time
          title: Start
          description: Resolved lower bound of the range, ISO8601 UTC.
        end:
          type: string
          format: date-time
          title: End
          description: Resolved upper bound of the range, ISO8601 UTC.
      type: object
      required:
        - start
        - end
      title: UsagePeriod
    UsageSummary:
      properties:
        events_total:
          type: integer
          title: Events Total
          description: Total events in the range.
        events_succeeded:
          type: integer
          title: Events Succeeded
          description: Events with HTTP status 200-399.
        events_failed:
          type: integer
          title: Events Failed
          description: Events with HTTP status >= 400.
        credits_used:
          anyOf:
            - type: integer
            - type: 'null'
          title: Credits Used
          description: >-
            Sum of ``credits_charged`` across billable events in the range.
            ``null`` when no event in the window has finalized credits yet
            (follows the ENG-2516 'never fabricate' billing policy -- we don't
            want to display ``0`` when the honest answer is 'we don't know
            yet').
        success_rate:
          type: number
          title: Success Rate
          description: >-
            ``events_succeeded / events_total`` rounded to 4 decimals; 0.0 when
            total is 0.
      type: object
      required:
        - events_total
        - events_succeeded
        - events_failed
        - credits_used
        - success_rate
      title: UsageSummary
    UsageDaily:
      properties:
        date:
          type: string
          title: Date
          description: UTC calendar date (``YYYY-MM-DD``).
        events:
          type: integer
          title: Events
        credits:
          type: integer
          title: Credits
        failed:
          type: integer
          title: Failed
      type: object
      required:
        - date
        - events
        - credits
        - failed
      title: UsageDaily
    UsageByApiKey:
      properties:
        api_key_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Api Key Id
          description: >-
            Raw UUID of the API key; ``null`` when the key was deleted or the
            row was MCP-origin.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            Human-readable key name; ``null`` when the underlying key row is
            gone.
        events:
          type: integer
          title: Events
        credits:
          type: integer
          title: Credits
        last_used_at:
          type: string
          format: date-time
          title: Last Used At
          description: Most recent event timestamp for this key.
      type: object
      required:
        - api_key_id
        - name
        - events
        - credits
        - last_used_at
      title: UsageByApiKey
    UsageByOperation:
      properties:
        operation_id:
          type: string
          title: Operation Id
        events:
          type: integer
          title: Events
        credits:
          type: integer
          title: Credits
      type: object
      required:
        - operation_id
        - events
        - credits
      title: UsageByOperation
    ErrorType:
      type: string
      enum:
        - invalid_request
        - authentication
        - permission
        - not_found
        - conflict
        - rate_limited
        - idempotency_conflict
        - unprocessable
        - upstream_error
        - internal_error
      title: ErrorType
      description: Closed set of high-level categories SDKs branch on.
  securitySchemes:
    API Key:
      type: http
      description: API key from Settings > Developer > REST API
      scheme: bearer

````