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

# Read a stored object as a template entry with its inferred input schema

> Return one stored object as a template entry: the stored entry plus its inferred input schema.

The entry is the shared stored-entry reader's (``text``, ``document`` or ``binary``).
A text entry carries the schema inferred from its content; when the inference meets
broken Jinja the entry is still served (``200``) with ``schema: null`` and the
``schema_error`` beside it. A document's extracted text and a binary object are not
templates: their ``schema`` is ``null``.

A missing object is a ``404``; a non-canonical key or a refused text or document
(over the size cap, not UTF-8, an extractor's failure) a ``400``; no provider, or no
``files`` extra, a ``501``. When type inference cannot describe a template, the schema
degrades to variable names carrying an ``x-tai42-inference: partial`` marker.



## OpenAPI

````yaml /openapi.json post /api/template
openapi: 3.1.0
info:
  description: >-
    The operator HTTP surface served under /api/*. The platform's core routes.
    Plugin routes are published by each plugin.
  title: tai42-skeleton API
  version: 30.0.0
servers: []
security: []
paths:
  /api/template:
    post:
      tags:
        - templates
      summary: Read a stored object as a template entry with its inferred input schema
      description: >-
        Return one stored object as a template entry: the stored entry plus its
        inferred input schema.


        The entry is the shared stored-entry reader's (``text``, ``document`` or
        ``binary``).

        A text entry carries the schema inferred from its content; when the
        inference meets

        broken Jinja the entry is still served (``200``) with ``schema: null``
        and the

        ``schema_error`` beside it. A document's extracted text and a binary
        object are not

        templates: their ``schema`` is ``null``.


        A missing object is a ``404``; a non-canonical key or a refused text or
        document

        (over the size cap, not UTF-8, an extractor's failure) a ``400``; no
        provider, or no

        ``files`` extra, a ``501``. When type inference cannot describe a
        template, the schema

        degrades to variable names carrying an ``x-tai42-inference: partial``
        marker.
      operationId: post_api_template
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateFetch'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/TemplateEntry'
                required:
                  - data
                type: object
          description: Success.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Malformed request.
        '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:
    TemplateFetch:
      description: Read a stored object as a template entry by id.
      properties:
        template_id:
          title: Template Id
          type: string
      required:
        - template_id
      title: TemplateFetch
      type: object
    TemplateEntry:
      description: >-
        One stored object as a template entry: the stored entry plus its
        inferred input schema.
      discriminator:
        mapping:
          binary: '#/components/schemas/TemplateBinaryEntry'
          document: '#/components/schemas/TemplateDocumentEntry'
          text: '#/components/schemas/TemplateTextEntry'
        propertyName: kind
      oneOf:
        - $ref: '#/components/schemas/TemplateTextEntry'
        - $ref: '#/components/schemas/TemplateDocumentEntry'
        - $ref: '#/components/schemas/TemplateBinaryEntry'
      title: TemplateEntry
    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
    TemplateBinaryEntry:
      description: A binary entry; it is not a template, so it has no schema.
      properties:
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
        id:
          title: Id
          type: string
        kind:
          const: binary
          title: Kind
          type: string
        schema:
          default: null
          title: Schema
          type: 'null'
        size:
          title: Size
          type: integer
      required:
        - kind
        - id
        - content_type
        - size
      title: TemplateBinaryEntry
      type: object
    TemplateDocumentEntry:
      description: >-
        A document entry; its extracted text is not a template, so it has no
        schema.
      properties:
        content:
          title: Content
          type: string
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
        id:
          title: Id
          type: string
        kind:
          const: document
          title: Kind
          type: string
        schema:
          default: null
          title: Schema
          type: 'null'
        size:
          title: Size
          type: integer
      required:
        - kind
        - id
        - content_type
        - size
        - content
      title: TemplateDocumentEntry
      type: object
    TemplateTextEntry:
      description: >-
        A text entry with its inferred input schema, or the template error that
        stopped the inference.


        The ``schema`` object is an inferred JSON schema (it may carry an
        ``x-tai42-inference: partial``

        marker when type inference is incomplete). Exactly one of ``schema`` and
        ``schema_error`` is set.

        The Python attribute is suffixed to avoid shadowing a ``BaseModel``
        member; the wire key stays

        ``schema`` via the alias.
      properties:
        content:
          title: Content
          type: string
        content_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Type
        id:
          title: Id
          type: string
        kind:
          const: text
          title: Kind
          type: string
        schema:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/JsonValue'
              type: object
            - type: 'null'
          title: Schema
        schema_error:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema Error
        size:
          title: Size
          type: integer
      required:
        - kind
        - id
        - content_type
        - size
        - content
        - schema
        - schema_error
      title: TemplateTextEntry
      type: object
    JsonValue: {}
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.