Skip to main content
POST
Validate Jinja2 prompt template

Overview

Validate a system prompt written using Jinja2 template syntax. The endpoint checks whether all template variables and control flow blocks are syntactically correct, extracts all variable names used in the template, and returns a performance analysis with optimization recommendations. Use this endpoint before saving a new system prompt to an agent via Update Agent.

Required Permission

agents

Request Body

Jinja2 Template Syntax

The Platform API uses Jinja2 template syntax for dynamic system prompts. Variables are wrapped in double curly braces:
You can also use control blocks:
At call time, variable values are injected via Pre-Call Variables configured on the agent.

Example cURL

Response

Valid Prompt (200)

Invalid Prompt (200 with validation error)

Empty Body or Missing systemPrompt (200)

If the request body is empty ({}) or the systemPrompt field is absent (e.g. the wrong field name prompt is used), the API returns HTTP 200 with isValidTemplate: true and empty variables. No error is raised. Ensure you always send the field named exactly systemPrompt.
Sending an empty body or using the wrong field name (e.g. prompt instead of systemPrompt) does not return an error — the API treats the missing prompt as an empty string and returns isValidTemplate: true with no variables extracted. Always verify that variables in the response matches your expected template variables to confirm the prompt was received correctly.

Response Fields

Use Cases

  • Validating prompts before saving them to an agent
  • Extracting template variable names to configure Pre-Call Variable mappings
  • Identifying syntax errors early in the development workflow
  • Optimizing prompts for better KV cache performance
A higher kvCache score means the LLM can reuse more of its computation across calls, leading to faster response times and lower costs. Move any content that changes per-call (like customer name) towards the end of the prompt to maximize caching.
Run this endpoint as part of your CI/CD pipeline to catch prompt template errors before deployment.
Save the requestId from every response. You will need it if you contact Inya support to trace a specific request.

Authorizations

x-api-key
string
header
required

API key with 'agents' permission

Body

application/json
systemPrompt
string
required

The Jinja2 prompt template string to validate.

Response

Validation result

status
string
Example:

"success"

requestId
string
Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

message
string
response
object