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

# Apply an update-purpose template_jq program to a subject's record

> Apply an ``update``-purpose ``template_jq`` program to one subject. Its jq returns a
template-relative op batch applied through the same chokepoint as a delta — regimes, the
composing-shape guard, trace stamping and ``op_id`` idempotency all hold. ``program`` may be
unqualified or ``<template>.<name>``. An unknown program is a 404; an ambiguous unqualified
name, an ``input``-purpose name, or a program that fails to evaluate or returns the wrong
shape is a 422.



## OpenAPI

````yaml /openapi.json post /api/states/{name}/records/{target_kind}/{target_name}/{kind}/{key}/template-jq/{program}
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}/records/{target_kind}/{target_name}/{kind}/{key}/template-jq/{program}:
    post:
      tags:
        - states
      summary: Apply an update-purpose template_jq program to a subject's record
      description: >-
        Apply an ``update``-purpose ``template_jq`` program to one subject. Its
        jq returns a

        template-relative op batch applied through the same chokepoint as a
        delta — regimes, the

        composing-shape guard, trace stamping and ``op_id`` idempotency all
        hold. ``program`` may be

        unqualified or ``<template>.<name>``. An unknown program is a 404; an
        ambiguous unqualified

        name, an ``input``-purpose name, or a program that fails to evaluate or
        returns the wrong

        shape is a 422.
      operationId: >-
        post_api_states_name_records_target_kind_target_name_kind_key_template_jq_program
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
        - in: path
          name: target_kind
          required: true
          schema:
            type: string
        - in: path
          name: target_name
          required: true
          schema:
            type: string
        - in: path
          name: kind
          required: true
          schema:
            type: string
        - in: path
          name: key
          required: true
          schema:
            type: string
        - in: path
          name: program
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/TemplateJqApplyResult'
                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.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Request failed validation.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TemplateJqApplyResult:
      additionalProperties: false
      description: >-
        The outcome of applying an ``update``-purpose ``template_jq`` program to
        a subject:

        its ``name`` and the :class:`ApplyResult` outcome of the op batch its jq
        returned, run

        through the same ``apply`` chokepoint as a delta — ``applied`` (a
        replayed ``op_id`` or

        an empty batch is ``False``), the resulting ``data`` and ``seq`` when it
        applied, and the

        guard-``skipped`` ops.
      properties:
        applied:
          title: Applied
          type: boolean
        data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Data
        name:
          title: Name
          type: string
        seq:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Seq
        skipped:
          items:
            additionalProperties: true
            type: object
          title: Skipped
          type: array
      required:
        - name
        - applied
      title: TemplateJqApplyResult
      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

````