> ## 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.

# List state templates

> Every platform state-template document (the reusable schema fragments), each with the
catalog columns ``attached_to`` (the number of states it is attached on) and
``shipped_default`` (whether it is an unedited shipped default).



## OpenAPI

````yaml /openapi.json get /api/state-templates
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/state-templates:
    get:
      tags:
        - states
      summary: List state templates
      description: >-
        Every platform state-template document (the reusable schema fragments),
        each with the

        catalog columns ``attached_to`` (the number of states it is attached on)
        and

        ``shipped_default`` (whether it is an unedited shipped default).
      operationId: get_api_state_templates
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/StateTemplateCatalog'
                required:
                  - data
                type: object
          description: Success.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    StateTemplateCatalog:
      description: >-
        The bare-list body of ``list_state_templates`` — every platform
        state-template

        document with its catalog columns.
      items:
        $ref: '#/components/schemas/StateTemplateCatalogEntry'
      title: StateTemplateCatalog
      type: array
    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
    StateTemplateCatalogEntry:
      additionalProperties: false
      description: >-
        One state-template document in the catalog listing — the stored

        :class:`StateTemplateDocument` plus ``attached_to`` (the number of
        states it is attached

        on) and ``shipped_default`` (true when it is an unedited shipped
        default).
      properties:
        attached_to:
          title: Attached To
          type: integer
        declarations:
          anyOf:
            - $ref: '#/components/schemas/StateTemplateDeclarations'
            - type: 'null'
          default: null
        description:
          default: ''
          title: Description
          type: string
        kind:
          const: state-template
          default: state-template
          title: Kind
          type: string
        name:
          title: Name
          type: string
        parameters:
          additionalProperties: true
          title: Parameters
          type: object
        reconcile:
          anyOf:
            - $ref: '#/components/schemas/StateTemplateReconcile'
            - type: 'null'
          default: null
        regimes:
          items:
            additionalProperties: true
            type: object
          title: Regimes
          type: array
        schema:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - additionalProperties: true
              type: object
          title: Schema
        shipped_default:
          title: Shipped Default
          type: boolean
        template_jq:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/StateTemplateJq'
              type: object
            - type: 'null'
          default: null
          title: Template Jq
        trace:
          additionalProperties: true
          title: Trace
          type: object
      required:
        - name
        - attached_to
        - shipped_default
      title: StateTemplateCatalogEntry
      type: object
    StateTemplateDeclarations:
      additionalProperties: false
      description: >-
        The ``declarations`` section of a state-template document: the JSON
        ``schema`` (wire

        key ``schema``, attribute ``schema_``) of the static values an
        attachment stores, and an

        OPTIONAL ``check`` — a :class:`~tai42_contract.template.TemplatedText`
        carrying a jq

        predicate over those values. Structural validation (the check's jq, the
        schema's shape)

        lives at the store; this model pins the served wire shape.


        The wire key ``schema`` is the attribute ``schema_`` (alias) because a
        ``schema`` field

        would shadow ``BaseModel.schema``.
      properties:
        check:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        schema:
          additionalProperties: true
          title: Schema
          type: object
      required:
        - schema
      title: StateTemplateDeclarations
      type: object
    StateTemplateReconcile:
      additionalProperties: false
      description: >-
        The ``reconcile`` section of a state-template document: three jq
        programs the store

        runs to settle a state's OPEN records on a declarations edit —
        ``orphans`` names the items

        a record subtree orphans against the new declarations, ``resolutions``
        names the

        not-done resolutions a close may name, and ``close`` returns the op
        batch that closes one

        orphan. Each is a :class:`~tai42_contract.template.TemplatedText`
        (inline ``content`` or a

        stored ``id``).
      properties:
        close:
          $ref: '#/components/schemas/TemplatedText'
        orphans:
          $ref: '#/components/schemas/TemplatedText'
        resolutions:
          $ref: '#/components/schemas/TemplatedText'
      required:
        - orphans
        - close
        - resolutions
      title: StateTemplateReconcile
      type: object
    TemplatedText:
      additionalProperties: false
      description: >-
        A renderable text: its source plus the parameters its render takes.


        EXACTLY ONE source is set — ``content`` (the text inline) or ``id`` (the
        id of a

        stored resource holding the text); neither and both are refused at
        construction.

        ``kwargs`` are the render parameters for the TEXT and apply either way,
        so moving a

        text from inline to stored (or back) leaves its parameters untouched.
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Content
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        kwargs:
          additionalProperties: true
          title: Kwargs
          type: object
      title: TemplatedText
      type: object
      x-tai42-templated-text:
        language: jinja
    StateTemplateJq:
      additionalProperties: false
      description: >-
        One named jq program on a state template. ``purpose`` is ``input`` — a
        read over the

        record returning a value — or ``update`` — a program over ``{record,
        input}`` returning a

        template-relative op batch. ``jq`` is the program body as a

        :class:`~tai42_contract.template.TemplatedText` (inline ``content`` or a
        stored ``id``).

        ``params`` names the keys the program takes; ``reads``/``writes`` are
        the

        template-relative record paths an ``update`` program declares and are
        absent on an

        ``input`` program. Structural checks (jq compilation, path resolution)
        live at the store;

        this model pins the served wire shape.
      properties:
        description:
          default: ''
          title: Description
          type: string
        jq:
          $ref: '#/components/schemas/TemplatedText'
        params:
          items:
            type: string
          title: Params
          type: array
        purpose:
          enum:
            - input
            - update
          title: Purpose
          type: string
        reads:
          items:
            items:
              type: string
            type: array
          title: Reads
          type: array
        writes:
          items:
            items:
              type: string
            type: array
          title: Writes
          type: array
      required:
        - purpose
        - jq
      title: StateTemplateJq
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````