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

# Files generated over time

> Media files generated per hour, day, week or month in `timezone`, split into video, image, audio and other. Every generated file counts once, when it was made (clips inside a render and since-deleted files included; uploads and cache replays not). Filters apply through the job that made the file. No comparison period.

All analytics endpoints return `{ "data": ..., "meta": ... }`. `meta` carries the resolved range
(`from` inclusive, `to` exclusive, ISO 8601 UTC), `timezone`, the comparison period, applied `filters`,
`data_as_of`, `money_unit`, `time_basis` and `attribution_scope`.

Amounts are whole credits; fields ending in `_cents` are credits (1 credit = 1 cent). Charges are counted
when they were posted to the ledger. On team accounts, non-members only see their own identity
dimensions (`attribution_scope: self`); others collapse into "Other ..." groups.

With `format=csv` the response is `text/csv`.




## OpenAPI

````yaml /openapi.yaml get /analytics/files
openapi: 3.1.0
info:
  title: varg API
  version: 2.0.0
  description: |
    Unified REST API for AI media generation at `api.varg.ai/v2`.

    One API key, ~80 models across 8 providers, async jobs, stable output URLs
    on `s3.varg.ai`, files with lineage, and transparent credit billing
    (1 credit = 1 cent = $0.01).

    **The async job pattern:** every generation request returns `202 Accepted`
    with a job object (`status: queued`). Poll `GET /jobs/{id}` until the job
    reaches a terminal status (`completed`, `failed`, or `cancelled`), then read
    `output.outputs[0].url`. Alternatively, set `options.webhook_url` in the
    request to receive an HMAC-signed callback when the job finishes.
servers:
  - url: https://api.varg.ai/v2
security:
  - bearerAuth: []
tags:
  - name: Generation
    description: >-
      Create generation jobs (image, video, speech, music, transcription,
      ffmpeg, render, pipeline)
  - name: Tools
    description: Discover tools, their schemas, and call any tool generically
  - name: Jobs
    description: Poll and manage job lifecycle
  - name: Files
    description: Upload, import, probe, and manage files
  - name: Folders
    description: Group files into folders and file generated output automatically
  - name: Lineage
    description: Resolve which job produced a file
  - name: Presets
    description: Browse and apply reusable parameter values — voices, styles
  - name: Templates
    description: Browse, publish, use and render community templates
  - name: Pricing
    description: Estimate costs and browse the price catalog
  - name: Billing
    description: Balance, usage, and transaction history
  - name: Analytics
    description: >-
      Spend, runs and files over time — summaries, time series, breakdowns,
      activity
  - name: Account
    description: Identity and API key management
paths:
  /analytics/files:
    get:
      tags:
        - Analytics
      summary: Files generated over time
      description: >
        Media files generated per hour, day, week or month in `timezone`, split
        into video, image, audio and other. Every generated file counts once,
        when it was made (clips inside a render and since-deleted files
        included; uploads and cache replays not). Filters apply through the job
        that made the file. No comparison period.


        All analytics endpoints return `{ "data": ..., "meta": ... }`. `meta`
        carries the resolved range

        (`from` inclusive, `to` exclusive, ISO 8601 UTC), `timezone`, the
        comparison period, applied `filters`,

        `data_as_of`, `money_unit`, `time_basis` and `attribution_scope`.


        Amounts are whole credits; fields ending in `_cents` are credits (1
        credit = 1 cent). Charges are counted

        when they were posted to the ledger. On team accounts, non-members only
        see their own identity

        dimensions (`attribution_scope: self`); others collapse into "Other ..."
        groups.


        With `format=csv` the response is `text/csv`.
      operationId: getAnalyticsFiles
      parameters:
        - $ref: '#/components/parameters/AnalyticsFrom'
        - $ref: '#/components/parameters/AnalyticsTo'
        - $ref: '#/components/parameters/AnalyticsTimezone'
        - $ref: '#/components/parameters/AnalyticsTool'
        - $ref: '#/components/parameters/AnalyticsModel'
        - $ref: '#/components/parameters/AnalyticsWorkspaceId'
        - $ref: '#/components/parameters/AnalyticsApiKeyId'
        - $ref: '#/components/parameters/AnalyticsMemberId'
        - $ref: '#/components/parameters/AnalyticsCreator'
        - $ref: '#/components/parameters/AnalyticsSource'
        - $ref: '#/components/parameters/AnalyticsStatus'
        - $ref: '#/components/parameters/AnalyticsBucketWidth'
        - $ref: '#/components/parameters/AnalyticsFormat'
      responses:
        '200':
          description: Result envelope (JSON) or CSV export
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsFilesResponse'
            text/csv:
              schema:
                type: string
                description: >-
                  Same rows as the JSON response, flattened. Amounts are in
                  credits.
          headers:
            Content-Disposition:
              description: Attachment filename, `varg-files-made-<from>-<to>.csv`.
              schema:
                type: string
        '400':
          description: >-
            Invalid parameter (code `invalid_request`, `invalid_range`,
            `range_too_large`, `invalid_timezone`, `invalid_filter`,
            `unsupported_group_by`, ...)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '503':
          description: Analytics is temporarily unavailable (`analytics_unavailable`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    AnalyticsFrom:
      name: from
      in: query
      required: false
      description: >
        Range start, inclusive. `YYYY-MM-DD` (local midnight in `timezone`), a
        local date-time

        (`2026-09-01T09:30`), or an ISO 8601 instant with offset. Default: `to`
        minus 30 days.

        Ranges are limited to 366 days.
      schema:
        type: string
        maxLength: 40
      example: '2026-09-01'
    AnalyticsTo:
      name: to
      in: query
      required: false
      description: Range end, exclusive. Same formats as `from`. Default is now.
      schema:
        type: string
        maxLength: 40
      example: '2026-10-01'
    AnalyticsTimezone:
      name: timezone
      in: query
      required: false
      description: >-
        IANA timezone used for date-only bounds and calendar buckets. Default
        `UTC`.
      schema:
        type: string
        maxLength: 64
      example: Europe/Berlin
    AnalyticsTool:
      name: tool
      in: query
      required: false
      description: >-
        Filter by capability. Comma-separated tool keys (`video`, `image`,
        `speech`, `music`, `render`, `pipeline`, ...) or `none`. Up to 50
        values.
      schema:
        type: string
        maxLength: 4000
      example: video,image
    AnalyticsModel:
      name: model
      in: query
      required: false
      description: Filter by model. Comma-separated model ids or `none`. Up to 50 values.
      schema:
        type: string
        maxLength: 4000
    AnalyticsWorkspaceId:
      name: workspace_id
      in: query
      required: false
      description: >-
        Filter by folder. Comma-separated folder ids or `none` (no folder). Up
        to 50 values.
      schema:
        type: string
        maxLength: 4000
    AnalyticsApiKeyId:
      name: api_key_id
      in: query
      required: false
      description: >-
        Filter by the API key that started the run. Comma-separated key ids or
        `none`. Up to 50 values.
      schema:
        type: string
        maxLength: 4000
    AnalyticsMemberId:
      name: member_id
      in: query
      required: false
      description: >-
        Filter by the person who started the run. Comma-separated user ids or
        `none`. Up to 50 values.
      schema:
        type: string
        maxLength: 4000
    AnalyticsCreator:
      name: creator
      in: query
      required: false
      description: >
        Filter by creator: `api_key:<id>` (a personal API key) or `member:<id>`
        (a person),

        comma-separated, or `none`. Up to 50 values.
      schema:
        type: string
        maxLength: 4000
    AnalyticsSource:
      name: source
      in: query
      required: false
      description: >
        Filter by how the run was started. Comma-separated values of `app` (a
        person in the web app),

        `api` (API key, SDK, CLI), `mcp` (an agent via MCP), `internal` (varg
        system keys), `unknown`.
      schema:
        type: string
        maxLength: 4000
      example: api,mcp
    AnalyticsStatus:
      name: status
      in: query
      required: false
      description: >
        Filter by the charged job's status. Comma-separated values of
        `completed`, `failed`,

        `cancelled`, `awaiting_confirmation`, `running`, `submitting`, `queued`,
        `unknown`.
      schema:
        type: string
        maxLength: 4000
    AnalyticsBucketWidth:
      name: bucket_width
      in: query
      required: false
      description: >-
        Calendar bucket size in `timezone`. `1h` is limited to ranges of 31 days
        or less. Default `1d`.
      schema:
        type: string
        enum:
          - 1h
          - 1d
          - 1w
          - 1mo
    AnalyticsFormat:
      name: format
      in: query
      required: false
      description: >
        `json` (default) returns the `{ data, meta }` envelope. `csv` returns
        the same rows as

        `text/csv` with a `Content-Disposition` attachment filename. Amounts are
        in credits.
      schema:
        type: string
        enum:
          - json
          - csv
  schemas:
    AnalyticsFilesResponse:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: '#/components/schemas/AnalyticsFiles'
        meta:
          $ref: '#/components/schemas/AnalyticsMeta'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: model_not_found
            message:
              type: string
              example: 'Unknown model: flux-shnell'
            details: {}
    AnalyticsFiles:
      type: object
      required:
        - bucket_width
        - buckets
        - total
      properties:
        bucket_width:
          type: string
          enum:
            - 1h
            - 1d
            - 1w
            - 1mo
        buckets:
          type: array
          items:
            $ref: '#/components/schemas/AnalyticsFilesBucket'
        total:
          $ref: '#/components/schemas/AnalyticsFileCounts'
    AnalyticsMeta:
      type: object
      description: Metadata describing how the numbers were computed.
      required:
        - definition_version
        - data_as_of
        - money_unit
        - time_basis
        - attribution_scope
      properties:
        definition_version:
          type: string
          description: Changes whenever a metric's meaning changes.
          example: '2026-09-28'
        from:
          type: string
          format: date-time
          description: Resolved range start (inclusive).
        to:
          type: string
          format: date-time
          description: Resolved range end (exclusive).
        timezone:
          type: string
          example: UTC
        compare:
          type:
            - object
            - 'null'
          description: The comparison period, or null when none.
          properties:
            from:
              type: string
              format: date-time
            to:
              type: string
              format: date-time
        filters:
          type: object
          description: Filters applied, keyed by query parameter name.
          additionalProperties:
            type: array
            items:
              type: string
        data_as_of:
          type: string
          format: date-time
        money_unit:
          type: string
          enum:
            - cent
          description: Amounts are whole credits, in fields ending in `_cents`.
        time_basis:
          type: string
          enum:
            - posted_at
            - lifetime
            - created_at
          description: >-
            `posted_at` = when the ledger charge was posted; `created_at` = when
            a file was made.
        attribution_scope:
          type: string
          enum:
            - full
            - self
          description: '`self` means identity dimensions show only the caller''s own values.'
    AnalyticsFilesBucket:
      allOf:
        - $ref: '#/components/schemas/AnalyticsFileCounts'
        - type: object
          required:
            - start
            - end
            - is_partial
          properties:
            start:
              type: string
              format: date-time
            end:
              type: string
              format: date-time
            is_partial:
              type: boolean
    AnalyticsFileCounts:
      type: object
      required:
        - files
        - video
        - image
        - audio
        - other
      properties:
        files:
          type: integer
        video:
          type: integer
        image:
          type: integer
        audio:
          type: integer
        other:
          type: integer
  responses:
    Unauthorized:
      description: Missing or invalid API key / JWT
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized:
              value:
                error:
                  code: unauthorized
                  message: Invalid or missing API key or JWT
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        varg API key (`varg_...`). Get one at [app.varg.ai](https://app.varg.ai)
        or run `bunx vargai login`. App sessions may alternatively send a
        Supabase JWT.

````

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