Validate Jinja2 prompt template
Agents API
Validate Prompt
Validate a Jinja2 system prompt template and receive optimization recommendations
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: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.
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.Save the
requestId from every response. You will need it if you contact Inya support to trace a specific request.Authorizations
API key with 'agents' permission
Body
application/json
The Jinja2 prompt template string to validate.