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

# Get the latest version

> This is the most common endpoint you'll use when working with prompt templates.

This route is used by the Lunary SDKs to fetch the latest version of a template before making an LLM call.

This route differs from all the next ones in that:
- it requires only the `slug` parameter to reference a template
- it doesn't require using a Private Key to authenticate the request (Public Key is enough)




## OpenAPI

````yaml https://api.lunary.ai/v1/openapi get /v1/template-versions/latest
openapi: 3.0.0
info:
  title: Lunary API
  version: 1.0.0
servers:
  - url: https://api.lunary.ai
security: []
tags: []
paths:
  /v1/template-versions/latest:
    get:
      tags:
        - Templates
      summary: Get the latest version
      description: >
        This is the most common endpoint you'll use when working with prompt
        templates.


        This route is used by the Lunary SDKs to fetch the latest version of a
        template before making an LLM call.


        This route differs from all the next ones in that:

        - it requires only the `slug` parameter to reference a template

        - it doesn't require using a Private Key to authenticate the request
        (Public Key is enough)
      parameters:
        - in: query
          name: slug
          required: true
          schema:
            type: string
          description: Slug of the template
      responses:
        '200':
          description: Latest version of the template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateVersion'
        '404':
          description: Template not found
      security:
        - ProjectPublicApiKeyAuth: []
components:
  schemas:
    TemplateVersion:
      type: object
      properties:
        id:
          type: string
        templateId:
          type: string
        content:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
              content:
                type: string
        metadata:
          $ref: '#/components/schemas/PromptMetadata'
        extra:
          type: object
        testValues:
          type: object
        isDraft:
          type: boolean
        notes:
          type: string
        createdAt:
          type: string
          format: date-time
        version:
          type: number
    PromptMetadata:
      type: object
      default: {}
      maxProperties: 100
      additionalProperties:
        type: string
      description: >
        Versioned key/value text, separate from model parameters and prompt
        variables.

        Keys are preserved exactly, must not be blank, and are limited to 256
        characters.

        The reserved key __proto__ is not allowed.

        Values must be strings. Numbers, booleans, null, arrays, and objects are
        rejected.

        The serialized object must be no larger than 64 KiB. Returned by prompt
        retrieval

        endpoints, including public-key retrieval; do not store secrets here.

        Omitted metadata defaults to an empty object on creation and is
        preserved on PATCH.
      example:
        owner: support
        release_channel: production
        locale: en
  securitySchemes:
    ProjectPublicApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: UUID
      description: 'Use a project public API key via `Authorization: Bearer <key>`.'

````

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