---
title: "Render a prompt template"
method: POST
path: "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/render"
tags: ["Versions", "AI"]
---

# Render a prompt template

`POST /groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/render`

Renders a prompt template artifact by substituting the provided variables into the template.
The artifact must be of type `PROMPT_TEMPLATE`. Variables are validated against the template's
variable schema before rendering.

This operation can fail for the following reasons:

* No artifact with this `artifactId` exists (HTTP error `404`)
* No version with this `version` exists (HTTP error `404`)
* The artifact is not a PROMPT_TEMPLATE (HTTP error `400`)
* Required variables are missing or have invalid types (HTTP error `400`)
* A server error occurred (HTTP error `500`)

## Request body

- RenderPromptRequest — Request body for rendering a prompt template with variable substitution.
  - `variables` object, required — A map of variable names to their values. These will be substituted into the prompt template.

## Response `200`

The rendered prompt template.

- RenderPromptResponse — Response from rendering a prompt template.
  - `rendered` string, required — The rendered prompt with all variables substituted.
  - `groupId` string — The group ID of the artifact.
  - `artifactId` string — The artifact ID.
  - `version` string — The version of the artifact that was rendered.
  - `validationErrors` RenderValidationError[] — Any validation errors encountered when validating variables against the template schema.
    - `variableName` string, required — The name of the variable that failed validation.
    - `message` string, required — A description of the validation error.
    - `expectedType` string — The expected type of the variable.
    - `actualType` string — The actual type that was provided.

## Other responses

- `400` — Common response for all operations that can return a `400` error.
- `401` — Common response for all operations that can return a `401` error indicating authentication is required.
- `403` — Common response for all operations that can return a `403` error indicating the user is authenticated but not authorized.
- `404` — Common response for all operations that can return a `404` error.
- `500` — Common response for all operations that can fail with an unexpected server error.

---

[API](https://skmtc.net/apicurio/apis/apicurio-registry-api-v3.md) · [All operations](https://skmtc.net/apicurio/apis/apicurio-registry-api-v3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/apicurio/apicurio-registry-api-v3/revisions/c39cb56d7dbc/schema)
