Render a prompt
/v1/prompts/{slug}/renderRender a prompt.
Fills a version's {{name}} placeholders with the given variables and returns the messages, without calling a model. A placeholder with no value is left as written. Requires membership of the prompt's workspace (organization admins have it).
Errors: 400 for an invalid version_ref; 404 when the prompt, version or label does not exist, or the prompt has no default version and none is named.
Authorization
AuthorizationBearer va_A platform API key (
va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.
Path parameters
slugstringrequiredthe prompt's slug
Query parameters
organizationstringrequiredslug of the organization that owns it
Request body application/json
the variables, and which version to render
variablesmap<string, string>requiredValues for the template's
{{name}} placeholders, as a JSON object of strings. A placeholder with no value is left as written.version_refstringWhich version to use: a version number (for example
3),latest(the highest version number, whatever its status) or@followed by a label (for example@staging). Omit it for the default version: the one theproductionlabel points at, else the PUBLISHED version. An unknown version or label is a 404, any other value a 400.
Responses
version_numberinteger<int32>The version that was rendered.
messagesobject[]The rendered messages, in order.
Child attributes
roleenum<string>requiredWho the message is from:
system,user,assistantortool(required).One of
"system","user","assistant","tool"contentstringrequiredThe message text (required). Each
{{name}} placeholder is replaced with the value of variablenamewhen the prompt is rendered or run; a placeholder with no value is left as written.