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

# Render Specific Prompt Version

> Renders a specific template version of a prompt (even draft status) using supplied variables.



## OpenAPI

````yaml /openapi.yaml post /v1/prompts/{slug}/versions/{version}/render
openapi: 3.1.0
info:
  title: px0 API
  description: >
    px[0] is an open-source prompt infrastructure toolkit for managing prompts
    in production. It replaces hardcoded prompt strings with versioned
    templates, in-process caching, and OpenTelemetry observability, so teams can
    iterate on prompts without touching application code. This is the OpenAPI
    specification for all the public APIs of px0.
  version: 1.0.0
servers:
  - url: http://localhost:3000
    description: Local development server
security: []
paths:
  /v1/prompts/{slug}/versions/{version}/render:
    post:
      tags:
        - Prompt Renders
      summary: Render Specific Prompt Version
      description: >-
        Renders a specific template version of a prompt (even draft status)
        using supplied variables.
      operationId: renderVersion
      parameters:
        - name: slug
          in: path
          required: true
          description: Unique prompt slug.
          schema:
            type: string
        - name: version
          in: path
          required: true
          description: Version sequence number (integer) or version tag (string) to render.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RenderRequest'
      responses:
        '200':
          description: Rendered template string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RenderResponse'
        '400':
          description: Invalid path formatting
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                error: invalid version number
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                error: unauthorized
        '404':
          description: Prompt or version not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                error: version not found
        '422':
          description: Execution failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
              example:
                error: 'template execution failed: ...'
      security:
        - BearerAuth: []
components:
  schemas:
    RenderRequest:
      type: object
      properties:
        variables:
          type: object
          additionalProperties: true
          description: >-
            Key-value dictionary of arguments interpolated into the prompt
            template.
          example:
            name: Alice
            count: 5
    RenderResponse:
      type: object
      properties:
        rendered:
          type: string
          description: Fully parsed template response with variable replacements.
          example: Hello, Alice! Count is 5.
        version:
          type: integer
          description: Sequence version number that was executed.
          example: 1
        slug:
          type: string
          description: Unique prompt slug.
          example: my_prompt
        tags:
          type: array
          items:
            type: string
          description: List of tag strings assigned to this version.
      required:
        - rendered
        - version
        - slug
        - tags
    APIError:
      type: object
      properties:
        error:
          type: string
          example: invalid credentials
      required:
        - error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an access token retrieved from login (Bearer sess_...) or a
        programmatic API key (Bearer ak_...).

````