Patricia Usage API

The usage API from Patricia — 3 operation(s) for usage.

GitHub OpenAPI

Operations 3

GET /v1/runs-stats Aggregate run/usage stats #
GET /v1/runs-stats/by-client Run usage by Client #
GET /v1/runs-stats/by-member Per-member run/usage breakdown #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/patricia-app:patricia-app-usage-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

patricia-app-usage-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Patricia Usage API
  version: 0.1.0
tags:
- name: Usage
paths:
  /v1/runs-stats:
    get:
      tags:
      - Usage
      summary: Aggregate run/usage stats
      description: 'Tenant-scoped run/usage aggregate over a UTC window: a zero-filled timeline, window totals (runs, credits, terminal-only success rate; tokens for internal callers), a by-source split, and, when `compare` is set, the prior window''s totals. Usage is reported in credits (metered COGS → whole credits); the raw dollar figure is never surfaced. `start` and `end` are required, timezone-aware ISO-8601 (normalized to UTC); `end` must be after `start` and the window must not exceed 366 days (else 422). Requires `usage:read`.'
      operationId: get_runs_stats_v1_runs_stats_get
      security:
      - HTTPBearer: []
      parameters:
      - name: start
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window start (inclusive). Required, timezone-aware ISO-8601; normalized to UTC.
          title: Start
        description: Window start (inclusive). Required, timezone-aware ISO-8601; normalized to UTC.
      - name: end
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window end (exclusive). Required, timezone-aware ISO-8601; normalized to UTC.
          title: End
        description: Window end (exclusive). Required, timezone-aware ISO-8601; normalized to UTC.
      - name: granularity
        in: query
        required: false
        schema:
          $ref: '#/components/schemas/StatsGranularity'
          description: 'Timeline bucket size: day (default) / week / month.'
          default: day
        description: 'Timeline bucket size: day (default) / week / month.'
      - name: compare
        in: query
        required: false
        schema:
          anyOf:
          - $ref: '#/components/schemas/StatsCompare'
          - type: 'null'
          description: Prior-window selector that populates `previous_totals` (omit for none).
          title: Compare
        description: Prior-window selector that populates `previous_totals` (omit for none).
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Tenant-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunStatsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 'Forbidden. Inspect response body `code` for the specific reason (for example: PERMISSION_DENIED, EMAIL_NOT_VERIFIED, TENANT_ACCESS_REQUIRED, ROLE_UNRESOLVED)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /v1/runs-stats/by-client:
    get:
      tags:
      - Usage
      summary: Run usage by Client
      description: Overview run consumption split between authorized Clients and Other work. The total and split use one database snapshot. Requires usage:read.
      operationId: get_runs_stats_by_client_v1_runs_stats_by_client_get
      security:
      - HTTPBearer: []
      parameters:
      - name: start
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window start, inclusive and timezone-aware.
          title: Start
        description: Window start, inclusive and timezone-aware.
      - name: end
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window end, exclusive and timezone-aware.
          title: End
        description: Window end, exclusive and timezone-aware.
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Tenant-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunStatsByClientResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 'Forbidden. Inspect response body `code` for the specific reason (for example: PERMISSION_DENIED, EMAIL_NOT_VERIFIED, TENANT_ACCESS_REQUIRED, ROLE_UNRESOLVED)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /v1/runs-stats/by-member:
    get:
      tags:
      - Usage
      summary: Per-member run/usage breakdown
      description: 'Tenant-scoped per-member usage over a UTC window: runs and credits (metered COGS → whole credits, never dollars; tokens carried for internal callers) attributed per teammate by the run''s actor, most credits first. Runs with no actor (scheduled / system work) collapse into a single null-actor slice the dashboard labels ''Automated''; members with no runs in the window are omitted. `start` and `end` are required, timezone-aware ISO-8601 (normalized to UTC); `end` must be after `start` and the window must not exceed 366 days (else 422). Requires `usage:read`.'
      operationId: get_runs_stats_by_member_v1_runs_stats_by_member_get
      security:
      - HTTPBearer: []
      parameters:
      - name: start
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window start (inclusive). Required, timezone-aware ISO-8601; normalized to UTC.
          title: Start
        description: Window start (inclusive). Required, timezone-aware ISO-8601; normalized to UTC.
      - name: end
        in: query
        required: true
        schema:
          type: string
          format: date-time
          description: Window end (exclusive). Required, timezone-aware ISO-8601; normalized to UTC.
          title: End
        description: Window end (exclusive). Required, timezone-aware ISO-8601; normalized to UTC.
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Tenant-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunStatsByMemberResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 'Forbidden. Inspect response body `code` for the specific reason (for example: PERMISSION_DENIED, EMAIL_NOT_VERIFIED, TENANT_ACCESS_REQUIRED, ROLE_UNRESOLVED)'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    StatsGranularity:
      type: string
      enum:
      - day
      - week
      - month
      title: StatsGranularity
      description: 'Timeline bucket size. Each bucket''s ``date`` is its truncated UTC start

        (``week`` → Monday, ``month`` → the 1st).'
    RunStatsClientSlice:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Authorized Client id.
        name:
          type: string
          title: Name
          description: Current Client name.
        archived:
          type: boolean
          title: Archived
          description: Whether the Client is archived.
        credits:
          type: integer
          title: Credits
          description: Run consumption credits attributed to this Client in the window.
        run_count:
          type: integer
          title: Run Count
          description: Runs attributed to this Client in the window.
      type: object
      required:
      - id
      - name
      - archived
      - credits
      - run_count
      title: RunStatsClientSlice
    RunStatsByMemberResponse:
      properties:
        members:
          items:
            $ref: '#/components/schemas/RunStatsMemberSlice'
          type: array
          title: Members
          description: Per-actor slices, most credits first (then tokens, runs, actor_id); active members only.
      type: object
      required:
      - members
      title: RunStatsByMemberResponse
      description: 'Per-member run/usage breakdown for a tenant over a UTC date window.


        Backs the Usage → "Per team" table: usage attributed per teammate (per actor),

        in **credits** (never dollars; pricing-v2 §8a), most credits first. Members with

        no runs in the window are omitted (the table shows only who was active).'
    ErrorResponse:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        errors:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Errors
      type: object
      required:
      - code
      - message
      title: ErrorResponse
      description: Standard error envelope, matching exception handler output.
    RunStatsByClientResponse:
      properties:
        total_credits:
          type: integer
          title: Total Credits
          description: Overview run consumption credits from the snapshot used for this split.
        clients:
          items:
            $ref: '#/components/schemas/RunStatsClientSlice'
          type: array
          title: Clients
          description: Authorized Client slices, ordered by credits, name and id.
        other_work_credits:
          type: integer
          title: Other Work Credits
          description: Run consumption credits outside the authorized Client slices.
      type: object
      required:
      - total_credits
      - clients
      - other_work_credits
      title: RunStatsByClientResponse
    StatsCompare:
      type: string
      enum:
      - previous
      - same_last_month
      - same_last_year
      title: StatsCompare
      description: Prior-window selector that populates ``previous_totals`` for period-over-period deltas.
    RunStatsBucketSource:
      properties:
        source:
          type: string
          title: Source
          description: Run trigger code (mention / dm / message / cron / heartbeat / …).
        runs:
          type: integer
          title: Runs
          description: Runs from this source in this bucket.
        credits:
          type: integer
          title: Credits
          description: Sum of this source's per-run whole credits in the bucket; source slices sum to the bucket's `credits`.
      type: object
      required:
      - source
      - runs
      - credits
      title: RunStatsBucketSource
      description: 'One run-source (``trigger_code``) slice of a single timeline bucket.


        Each slice sums the same per-run whole-credit expression as the parent bucket.

        A run uses its frozen credit snapshot when present, otherwise its COGS converted at the live peg.

        Source slices therefore partition the bucket exactly; their credits sum to the bucket total.

        ``runs`` counts the runs from this source in this bucket.'
    RunStatsResponse:
      properties:
        timeline:
          items:
            $ref: '#/components/schemas/RunStatsBucket'
          type: array
          title: Timeline
          description: Per-period buckets, zero-filled across the whole window.
        totals:
          $ref: '#/components/schemas/RunStatsTotals'
          description: Window totals for the KPI cards.
        by_source:
          items:
            $ref: '#/components/schemas/RunStatsSourceSlice'
          type: array
          title: By Source
          description: Split by run source, most runs first.
        previous_totals:
          anyOf:
          - $ref: '#/components/schemas/RunStatsTotals'
          - type: 'null'
          description: Totals for the shifted prior window, populated only when `compare` is set, else null.
      type: object
      required:
      - timeline
      - totals
      - by_source
      - previous_totals
      title: RunStatsResponse
      description: Aggregate run/usage stats for a tenant over a UTC date window.
    RunStatsSourceSlice:
      properties:
        source:
          type: string
          title: Source
          description: Run trigger code (mention / dm / message / cron / heartbeat / …).
        runs:
          type: integer
          title: Runs
          description: Runs created from this source in the window.
        credits:
          type: integer
          title: Credits
          description: Credits consumed by this source (metered COGS converted to whole credits).
        tokens:
          type: integer
          title: Tokens
          description: Summed input + output tokens for this source (internal/admin; dashboard uses credits).
      type: object
      required:
      - source
      - runs
      - credits
      - tokens
      title: RunStatsSourceSlice
      description: Run count + usage for one run source (``trigger_code``).
    RunStatsMemberSlice:
      properties:
        actor_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Actor Id
          description: The run actor's id, or null for unattributed (automated / system) runs.
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: The actor's display name; null for the automated slice or a removed member.
        handle:
          anyOf:
          - type: string
          - type: 'null'
          title: Handle
          description: The actor's chat handle (e.g. Slack @handle) when known, else null.
        email:
          anyOf:
          - type: string
          - type: 'null'
          title: Email
          description: The actor's email when known, else null.
        runs:
          type: integer
          title: Runs
          description: Runs this teammate triggered in the window.
        credits:
          type: integer
          title: Credits
          description: Credits consumed by this teammate's runs (metered COGS converted to whole credits).
        total_tokens:
          type: integer
          title: Total Tokens
          description: Summed input + output tokens for this teammate's runs (internal/admin; dashboard uses credits).
      type: object
      required:
      - actor_id
      - name
      - handle
      - email
      - runs
      - credits
      - total_tokens
      title: RunStatsMemberSlice
      description: 'One teammate''s run count + token usage over the window (the "Per team" breakdown).


        Runs are attributed by ``AgentRun.actor_id``, the platform identity that

        triggered the run. Runs with no actor (e.g. scheduled / system work) collapse

        into a single ``actor_id = null`` slice the dashboard labels "Automated". A run

        whose actor was later removed (soft-deleted) keeps its own ``actor_id`` slice

        but with null ``name`` / ``handle`` / ``email`` (rendered as "Former member").'
    RunStatsTotals:
      properties:
        runs:
          type: integer
          title: Runs
          description: Total runs created in the window.
        credits:
          type: integer
          title: Credits
          description: Total credits consumed in the window (metered COGS → whole credits), the headline usage metric.
        total_tokens:
          type: integer
          title: Total Tokens
          description: Total input + output tokens across runs (internal/admin; the dashboard shows credits).
        success_rate:
          anyOf:
          - type: number
          - type: 'null'
          title: Success Rate
          description: Percentage (0–100) of terminal runs that completed successfully; null when no run has finished.
      type: object
      required:
      - runs
      - credits
      - total_tokens
      - success_rate
      title: RunStatsTotals
      description: 'Window totals for the KPI cards.


        ``success_rate`` is computed over **terminal** runs only (``completed`` /

        ``failed`` / ``cancelled`` / ``denied_autonomous``) as the percentage that

        ``completed``. It is ``null`` until at least one run in the window has reached a

        terminal state. A run the authority model refused counts in the denominator:

        it finished without succeeding, so excluding it would flatter the rate.'
    RunStatsBucket:
      properties:
        date:
          type: string
          format: date-time
          title: Date
          description: Truncated UTC start of the period (midnight; Monday for week, 1st for month).
        runs:
          type: integer
          title: Runs
          description: Runs created in this period.
        credits:
          type: integer
          title: Credits
          description: Credits consumed in this period (metered COGS converted to whole credits).
        tokens:
          type: integer
          title: Tokens
          description: Summed input + output tokens for this period (internal/admin; dashboard uses credits).
        by_source:
          items:
            $ref: '#/components/schemas/RunStatsBucketSource'
          type: array
          title: By Source
          description: Per-source credit split of this bucket; empty on a zero-filled period. Slices sum to `credits`.
      type: object
      required:
      - date
      - runs
      - credits
      - tokens
      - by_source
      title: RunStatsBucket
      description: 'One zero-filled timeline period: its UTC start plus run count and usage.


        ``credits`` is the customer-facing consumption for the period (metered COGS →

        whole credits, half-up); ``tokens`` is the raw input+output sum kept for

        internal/admin callers. ``by_source`` splits ``credits`` across the period''s run

        sources for the stacked chart (empty on a zero-filled period; the slice credits

        sum the same per-run figures and exactly partition this bucket''s ``credits``).'
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer