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

# Attach a template on a state

> Attach ``template`` on the state at the body's ``path`` with its parameters and static
declarations; recomposes and validates the effective schema in one transaction.



## OpenAPI

````yaml /openapi.json put /api/states/{name}/attachments/{template}
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}/attachments/{template}:
    put:
      tags:
        - states
      summary: Attach a template on a state
      description: >-
        Attach ``template`` on the state at the body's ``path`` with its
        parameters and static

        declarations; recomposes and validates the effective schema in one
        transaction.
      operationId: put_api_states_name_attachments_template
      parameters:
        - in: path
          name: name
          required: true
          schema:
            type: string
        - in: path
          name: template
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/AttachAck'
                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.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Conflict with the current resource state.
        '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:
    AttachAck:
      description: >-
        A template-attach confirmation — the ``state`` and ``template``
        attached.
      properties:
        attached:
          title: Attached
          type: boolean
        state:
          title: State
          type: string
        template:
          title: Template
          type: string
      required:
        - attached
        - state
        - template
      title: AttachAck
      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

````