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

# Render a template

> Render the template's current published version with the supplied
variables, without sending. Returns the rendered output for the
template's channel plus any variable paths that were referenced but not
provided.




## OpenAPI

````yaml https://www.senderkit.com/openapi.yaml post /v1/templates/{slug}/render
openapi: 3.1.0
info:
  title: SenderKit Public API
  version: 1.0.0
  description: >
    Public REST API for SenderKit — send transactional messages (email, SMS,

    push, web push), list message history, and read/render templates.


    ## Authentication

    All endpoints require a Bearer API key:

        Authorization: Bearer sk_live_xxx

    The `sk_live_` / `sk_test_` prefix selects the environment (live vs. test).

    The prefix is only a hint for humans; the secret is the full token. Keys are

    created in the dashboard and shown once at creation.


    ## Sends are asynchronous

    `POST /v1/send` enqueues the message and returns `202` with `status:
    "queued"`.

    Delivery happens out of band; poll `GET /v1/messages` to observe progress.


    ## Rate limits

    All endpoints are rate limited per API key. Sends and reads count against

    separate budgets, so listing messages never competes with sending them.

    A `429` response includes a `Retry-After` header (seconds).
servers:
  - url: https://api.senderkit.com
    description: Production
  - url: http://localhost:3000/api
    description: Local development
security:
  - apiKey: []
tags:
  - name: Context
    description: Inspect the workspace and environment an API key operates in.
  - name: Send
    description: Dispatch messages.
  - name: Messages
    description: Read message history and cancel pending sends.
  - name: Templates
    description: Read and render stored templates.
paths:
  /v1/templates/{slug}/render:
    post:
      tags:
        - Templates
      summary: Render a template
      description: |
        Render the template's current published version with the supplied
        variables, without sending. Returns the rendered output for the
        template's channel plus any variable paths that were referenced but not
        provided.
      operationId: renderTemplate
      parameters:
        - $ref: '#/components/parameters/Slug'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                vars:
                  type: object
                  additionalProperties: true
                  description: Variable values to interpolate into the template.
            examples:
              default:
                value:
                  vars:
                    name: Ada
      responses:
        '200':
          description: Rendered template output.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RenderResult'
        '400':
          description: Malformed JSON or failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: No published version for the template.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    Slug:
      name: slug
      in: path
      required: true
      description: Template slug.
      schema:
        type: string
  schemas:
    RenderResult:
      type: object
      required:
        - channel
        - output
        - missing
      properties:
        channel:
          $ref: '#/components/schemas/Channel'
        output:
          type: object
          description: |
            Rendered fields for the channel. Email -> {subject, preheader, html,
            text}; SMS -> {body}; push -> {title, body, data, badge, sound};
            web push -> {title, body, icon, clickUrl, data, badge}.
          additionalProperties: true
        missing:
          type: array
          description: Variable paths referenced by the template but not supplied.
          items:
            type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              example: invalid_request
            message:
              type: string
            issues:
              type: array
              description: Present on validation failures (Zod issues).
              items:
                type: object
                additionalProperties: true
            limit:
              type: integer
              description: Present on rate-limit errors.
    Channel:
      type: string
      enum:
        - email
        - sms
        - push
        - web-push
  responses:
    Unauthorized:
      description: Missing, malformed, invalid, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: API key with an `sk_live_` or `sk_test_` prefix.

````