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

# A state's record statistics

> Record counts for a state — the total and the per-subject-kind breakdown.



## OpenAPI

````yaml /openapi.json get /api/states/{name}/stats
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 14.0.2
servers: []
security: []
paths:
  /api/states/{name}/stats:
    get:
      tags:
        - states
      summary: A state's record statistics
      description: >-
        Record counts for a state — the total and the per-subject-kind
        breakdown.
      operationId: get_api_states_name_stats
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/StateStats'
                required:
                  - data
                type: object
          description: Success.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    StateStats:
      description: >-
        A state's record statistics: the total ``records`` count, the
        ``per_field`` and

        ``per_kind`` breakdowns (each a name-keyed count map), and the number of
        live

        ``consumers`` binding the state.
      properties:
        consumers:
          title: Consumers
          type: integer
        per_field:
          additionalProperties:
            type: integer
          title: Per Field
          type: object
        per_kind:
          additionalProperties:
            type: integer
          title: Per Kind
          type: object
        records:
          title: Records
          type: integer
      required:
        - records
        - per_field
        - per_kind
        - consumers
      title: StateStats
      type: object
    Error:
      properties:
        code:
          description: >-
            Stable machine-readable reason a client keys a dedicated error state
            on, present on refusals that opt in (e.g. a 501 not-configured
            refusal). Optional: absent when the error carries only a
            human-readable message.
          type: string
        error:
          type: string
      required:
        - error
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````