What it does: 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.
The Jinja2 prompt template string to validate. *Omitting this field or sending {} does not produce an error — see Empty Body or Missing systemPrompt below.
curl -X POST "https://api.inya.ai/platform/v1/agents/prompt/validate" \ -H "x-api-key: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{ "systemPrompt": "You are a support agent for {{ company_name }}. The customer is {{ customer_name }}. Today is {{ date }}." }'
{ "status": "success", "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "message": "Your prompt is not a valid jinja template. Please check the prompt and try again.", "response": { "isValidTemplate": false, "errors": [ "Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'." ], "variables": [] }}
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.
{ "status": "failure", "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "message": "Invalid API key"}
Invalid Jinja syntax is not an HTTP error. The API returns HTTP 200 with isValidTemplate: false and an errors array — see Invalid Prompt (200 with validation error) above. The same applies to an empty body or a missing systemPrompt field.See Error Reference for other status codes.
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 Gnani support to trace a specific request.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Gnani AI Documentation","description":"Gnani AI docs for Speech APIs (STT and TTS), Agent Builder, and the Agent Builder Platform API. Build Voice AI for Indian languages and call audio.","colors":{"primary":"#1A1A1A","light":"#FAFAFA","dark":"#1A1A1A"},"logo":{"light":"https://mintcdn.com/gnaniinnovationsprivatelimited/07TQaHxEIXJZr-iJ/logo/favicon.svg?fit=max\u0026auto=format\u0026n=07TQaHxEIXJZr-iJ\u0026q=85\u0026s=feca06a904160c2b661bfa77fe1f90c4","dark":"https://mintcdn.com/gnaniinnovationsprivatelimited/07TQaHxEIXJZr-iJ/logo/favicon.svg?fit=max\u0026auto=format\u0026n=07TQaHxEIXJZr-iJ\u0026q=85\u0026s=feca06a904160c2b661bfa77fe1f90c4","href":"https://app.gnani.ai/voice"},"favicon":"https://mintcdn.com/gnaniinnovationsprivatelimited/j9EzPlQTWx8MehCB/favicon.svg?fit=max\u0026auto=format\u0026n=j9EzPlQTWx8MehCB\u0026q=85\u0026s=f14fb3fd819d0b628fbcd5108850f804","api":{"openapi":["STT.yml","STTBatch.yml","TTS.yml","VC.yml","voice-clone-embeddings.yml","agents_openapi.yml","agent_config_openapi.yml"],"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["curl","python","javascript"],"prefill":true},"mdx":{"auth":{"method":"key","name":"X-API-Key-ID"},"server":"https://api.vachana.ai"}},"appearance":{"default":"system","strict":false},"background":{"decoration":"gradient","color":{"light":"#FAFAFA","dark":"#1A1A1A"}},"navbar":{"links":[{"href":"mailto:hello-inya@gnani.site","label":"Support"},{"icon":"discord","href":"https://discord.gg/aECcvtABpq","label":"Community"},{"href":"https://www.gnani.ai/","label":"Website"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.gnani.ai/voice"}},"footer":{"socials":{"x":"https://x.com/GnaniAi","linkedin":"https://www.linkedin.com/company/gnani-ai","website":"https://www.gnani.ai/","instagram":"https://instagram.com/gnani.ai"}},"seo":{"indexing":"all"},"fonts":{"body":{"family":"Inter"}},"integrations":{"clarity":{"projectId":"ytd0fajeva"},"ga4":{"measurementId":"G-58CTSCY1G8"}},"contextual":{"options":[{"title":"View as Markdown","description":"View this page as Markdown on docs.gnani.ai","icon":"file-text","href":{"base":"https://docs.gnani.ai$path.md"}},"copy",{"title":"Open in Claude","description":"Open this page in Claude using docs.gnani.ai","icon":"claude","href":{"base":"https://claude.ai/new","query":[{"key":"q","value":"Read from https://docs.gnani.ai$path.md so I can ask questions about it."}]}},{"title":"Open in ChatGPT","description":"Open this page in ChatGPT using docs.gnani.ai","icon":"openai","href":{"base":"https://chat.openai.com/","query":[{"key":"hints","value":"search"},{"key":"q","value":"Read from https://docs.gnani.ai$path so I can ask questions about it."}]}},"add-mcp","mcp","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"gnaniinnovationsprivatelimited","hasAudioNarration":false,"actualSubdomain":"gnaniinnovationsprivatelimited","customDomains":["docs.gnani.ai"],"gitSource":{"type":"github","owner":"gnani-ai-mintlify","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae480c3c2f3f73890232923","collectionId":"8f480177-292b-41eb-b2a9-b2fbf43488ec","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae480c3c2f3f73890232923"},"feedback":{"thumbs":true,"edits":false},"entitlements":{},"buildId":"6ae480c3c2f3f73890232923","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Gnani AI APIs","count":37},{"language":"default","tag":"Gnani AI Agent Builder APIs","count":28},{"language":"default","tag":"Gnani AI Agents","count":26},{"language":"default","tag":"APIs","count":25},{"language":"default","tag":"Speech-to-Text","count":15},{"language":"default","tag":"Gnani APIs","count":8},{"language":"default","tag":"Getting Started","count":7},{"language":"default","tag":"Agents API","count":7},{"language":"default","tag":"Batch transcription","count":7},{"language":"default","tag":"Automating Workflows with Integrations","count":6}],"searchSettings":{"showContentSnippets":false}},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"html[data-gnani-index] #content-side-layout[data-api-example]>:not(#gnani-toc-layout){display:none!important}html[data-gnani-index] [id$=\"operation-page\"]>div:first-child>div:nth-child(2){display:none!important}#gnani-toc-layout{display:none;box-sizing:border-box;max-height:100%;padding-left:2.5rem;width:19rem}@media (min-width: 1280px){#gnani-toc-layout{display:flex}}#gnani-toc{width:16.5rem;min-width:0;max-height:100%;margin-top:-2.5rem;padding:2.5rem 0 1rem;overflow-y:auto;font-size:0.875rem;line-height:1.5rem;scrollbar-width:none}#gnani-toc::-webkit-scrollbar{display:none}#gnani-toc .gnani-toc-title{display:flex;align-items:center;gap:0.5rem;margin:0 0 0.5rem;font-weight:500;color:rgb(55 65 81)}html.dark #gnani-toc .gnani-toc-title{color:rgb(209 213 219)}#gnani-toc ul{margin:0;padding:0;list-style:none}#gnani-toc a{display:block;padding:0.25rem 0 0.25rem var(--gnani-toc-indent, 0);font-weight:500;color:rgb(75 85 99);text-decoration:none;overflow-wrap:anywhere}html.dark #gnani-toc a{color:rgb(156 163 175)}#gnani-toc a:hover{color:rgb(17 24 39)}html.dark #gnani-toc a:hover{color:rgb(209 213 219)}#gnani-toc li[data-active]>a{color:rgb(17 24 39)}html.dark #gnani-toc li[data-active]>a{color:rgb(250 250 250)}"}],"page":{"pagePath":"Platform/Validate_Prompt","slug":"/Platform/Validate_Prompt","pageMetadata":{"title":"Validate Prompt","openapi":"POST /v1/agents/prompt/validate","description":"Validate a Jinja2 system prompt template and receive optimization recommendations","href":"/Platform/Validate_Prompt"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Validate a Jinja2 system prompt template and receive optimization recommendations\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Info,Note,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`What it does:`}),` Validate a system prompt written using `,_jsx(_components.strong,{children:`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 `,_jsx(_components.strong,{children:`Update Agent`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`required-permission`,children:`Required Permission`}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`agents`})}),`\n`,_jsx(Heading,{level:`2`,id:`request-body`,children:`Request Body`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`systemPrompt`})}),_jsx(_components.td,{children:`string`}),_jsx(_components.td,{children:`Yes*`}),_jsxs(_components.td,{children:[`The Jinja2 prompt template string to validate. *Omitting this field or sending `,_jsx(_components.code,{children:`{}`}),` does `,_jsx(_components.strong,{children:`not`}),` produce an error — see `,_jsxs(_components.a,{href:`#empty-body-or-missing-systemprompt-200`,children:[`Empty Body or Missing `,_jsx(_components.code,{children:`systemPrompt`})]}),` below.`]})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`jinja2-template-syntax`,children:`Jinja2 Template Syntax`}),`\n`,_jsx(_components.p,{children:`The Platform API uses Jinja2 template syntax for dynamic system prompts. Variables are wrapped in double curly braces:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`You are a helpful assistant. Customer name is {{ customer_name }}.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`You can also use control blocks:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{% for item in order_items %}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- {{ item.name }}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`{% endfor %}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`At call time, variable values are injected via `,_jsx(_components.strong,{children:`Pre-Call Variables`}),` configured on the agent.`]}),`\n`,_jsx(Heading,{level:`2`,id:`minimum-working-example`,children:`Minimum working example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.inya.ai/platform/v1/agents/prompt/validate\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"x-api-key: \u003cyour_api_key>\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"systemPrompt\": \"You are a support agent for {{ company_name }}. The customer is {{ customer_name }}. Today is {{ date }}.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(Heading,{level:`3`,id:`valid-prompt-200`,children:`Valid Prompt (200)`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`18`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`18`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"requestId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Jinja template syntax is valid\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"isValidTemplate\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"variables\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"company_name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"customer_name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"date\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"analysis\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scores\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"overall\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`85`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"kvCache\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`90`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"rating\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Good\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"issues\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"recommendations\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: []`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`invalid-prompt-200-with-validation-error`,children:`Invalid Prompt (200 with validation error)`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"requestId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Your prompt is not a valid jinja template. Please check the prompt and try again.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"isValidTemplate\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"errors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Unexpected end of template. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"variables\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: []`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`empty-body-or-missing-systemprompt-200`,children:[`Empty Body or Missing `,_jsx(_components.code,{children:`systemPrompt`}),` (200)`]}),`\n`,_jsxs(_components.p,{children:[`If the request body is empty (`,_jsx(_components.code,{children:`{}`}),`) or the `,_jsx(_components.code,{children:`systemPrompt`}),` field is absent (e.g. the wrong field name `,_jsx(_components.code,{children:`prompt`}),` is used), the API returns HTTP 200 with `,_jsx(_components.code,{children:`isValidTemplate: true`}),` and empty `,_jsx(_components.code,{children:`variables`}),`. `,_jsx(_components.strong,{children:`No error is raised.`}),` Ensure you always send the field named exactly `,_jsx(_components.code,{children:`systemPrompt`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"success\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"requestId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Jinja template syntax is valid\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"response\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"isValidTemplate\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"errors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"variables\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"analysis\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"scores\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"overall\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"kvCache\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"rating\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Unknown\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"issues\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"recommendations\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: []`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Sending an empty body or using the wrong field name (e.g. `,_jsx(_components.code,{children:`prompt`}),` instead of `,_jsx(_components.code,{children:`systemPrompt`}),`) does `,_jsx(_components.strong,{children:`not`}),` return an error — the API treats the missing prompt as an empty string and returns `,_jsx(_components.code,{children:`isValidTemplate: true`}),` with no variables extracted. Always verify that `,_jsx(_components.code,{children:`variables`}),` in the response matches your expected template variables to confirm the prompt was received correctly.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response-fields`,children:`Response Fields`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`isValidTemplate`})}),_jsx(_components.td,{children:`boolean`}),_jsx(_components.td,{children:`Whether the prompt is syntactically valid Jinja2.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`variables`})}),_jsx(_components.td,{children:`string[]`}),_jsxs(_components.td,{children:[`All template variable names extracted from the prompt (e.g. `,_jsx(_components.code,{children:`\"customer_name\"`}),`).`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`errors`})}),_jsx(_components.td,{children:`string[]`}),_jsx(_components.td,{children:`Array of syntax error messages (empty when valid).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis`})}),_jsx(_components.td,{children:`object`}),_jsxs(_components.td,{children:[`Optimization analysis. Only present when `,_jsx(_components.code,{children:`isValidTemplate`}),` is `,_jsx(_components.code,{children:`true`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis.scores.overall`})}),_jsx(_components.td,{children:`number`}),_jsx(_components.td,{children:`Overall optimization score from 0–100.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis.scores.kvCache`})}),_jsx(_components.td,{children:`number`}),_jsx(_components.td,{children:`KV cache efficiency score from 0–100. Higher scores indicate better LLM cache utilization.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis.scores.rating`})}),_jsx(_components.td,{children:`string`}),_jsxs(_components.td,{children:[`Human-readable rating: `,_jsx(_components.code,{children:`Poor`}),`, `,_jsx(_components.code,{children:`Fair`}),`, `,_jsx(_components.code,{children:`Good`}),`, or `,_jsx(_components.code,{children:`Excellent`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis.issues`})}),_jsx(_components.td,{children:`array`}),_jsx(_components.td,{children:`Identified optimization issues.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`analysis.recommendations`})}),_jsx(_components.td,{children:`array`}),_jsx(_components.td,{children:`Suggested improvements to the prompt.`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`401 Unauthorized`}),` - Invalid or missing API key`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"failure\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"requestId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid API key\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Invalid Jinja syntax is not an HTTP error.`}),` The API returns HTTP `,_jsx(_components.code,{children:`200`}),` with `,_jsx(_components.code,{children:`isValidTemplate: false`}),` and an `,_jsx(_components.code,{children:`errors`}),` array — see `,_jsx(_components.a,{href:`#invalid-prompt-200-with-validation-error`,children:`Invalid Prompt (200 with validation error)`}),` above. The same applies to an empty body or a missing `,_jsx(_components.code,{children:`systemPrompt`}),` field.`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/Platform/Error_Reference`,children:`Error Reference`}),` for other status codes.`]}),`\n`,_jsx(Heading,{level:`2`,id:`use-cases`,children:`Use Cases`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Validating prompts before saving them to an agent`}),`\n`,_jsx(_components.li,{children:`Extracting template variable names to configure Pre-Call Variable mappings`}),`\n`,_jsx(_components.li,{children:`Identifying syntax errors early in the development workflow`}),`\n`,_jsx(_components.li,{children:`Optimizing prompts for better KV cache performance`}),`\n`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`A higher `,_jsx(_components.code,{children:`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.`]})}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`Run this endpoint as part of your CI/CD pipeline to catch prompt template errors before deployment.`})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Save the `,_jsx(_components.code,{children:`requestId`}),` from every response. You will need it if you contact Gnani support to trace a specific request.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Validate Prompt","openapi":"POST /v1/agents/prompt/validate","description":"Validate a Jinja2 system prompt template and receive optimization recommendations","href":"/Platform/Validate_Prompt"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Required Permission","slug":"required-permission","depth":2,"children":[]},{"title":"Request Body","slug":"request-body","depth":2,"children":[{"title":"Jinja2 Template Syntax","slug":"jinja2-template-syntax","depth":3,"children":[]}]},{"title":"Minimum working example","slug":"minimum-working-example","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[{"title":"Valid Prompt (200)","slug":"valid-prompt-200","depth":3,"children":[]},{"title":"Invalid Prompt (200 with validation error)","slug":"invalid-prompt-200-with-validation-error","depth":3,"children":[]},{"title":"Empty Body or Missing systemPrompt (200)","slug":"empty-body-or-missing-systemprompt-200","depth":3,"children":[]}]},{"title":"Response Fields","slug":"response-fields","depth":2,"children":[]},{"title":"Errors","slug":"errors","depth":2,"children":[]},{"title":"Use Cases","slug":"use-cases","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/gnaniinnovationsprivatelimited/aa125a548bc31de7/api-page-index.js"],"openApiReferenceData":{"operation":{"summary":"Validate Jinja2 prompt template","description":"Validate a Jinja2 system prompt template and receive optimization recommendations","operationId":"validatePrompt","tags":["Agents"],"requestBody":"58879199-2a48-49c3-9ef1-e90a84184a41","responses":{"200":"8ed7ce5d-dcc3-4163-9c52-dbe0b0b5735c","403":"5c92f2d0-f4b0-46c7-b435-c0070bda74a0","500":"b9b6b5a4-49d7-4613-af3d-cb9b45e572a1"},"method":"post","type":"path","servers":["4cad90c8-82e8-41e0-99ef-70250b4f4b93"],"security":["55263e97-5703-4953-8408-0afbaec7a7fa"],"path":"/v1/agents/prompt/validate","baseUrlOptions":["https://api.inya.ai/platform"],"title":"Validate Jinja2 prompt template","codeSamples":[],"requestExampleLanguages":["bash","python","javascript"],"requiredOnlyExamples":true,"requestExampleType":"generated","responseExampleType":"generated","prefillPlaygroundWithExample":true,"prefillPlaygroundExamples":[{"body.systemPrompt":"Hello {{ customer_name }}, how can I assist?"}]},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["systemPrompt"],"properties":{"systemPrompt":{"type":"string","description":"The Jinja2 prompt template string to validate.","isRequired":true,"uniqueKey":"systemPrompt","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"validTemplate":{"title":"validTemplate","value":{"systemPrompt":"Hello {{ customer_name }}, how can I assist?"}}},"exampleType":"examples"}},"exampleType":"examples"},"responses":{"8ed7ce5d-dcc3-4163-9c52-dbe0b0b5735c":{"description":"Validation result","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success","uniqueKey":"status","typeLabel":"string"},"requestId":{"type":"string","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","uniqueKey":"requestId","typeLabel":"string"},"message":{"type":"string","uniqueKey":"message","typeLabel":"string"},"response":{"type":"object","uniqueKey":"response","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"validPrompt":{"title":"validPrompt","value":{"status":"success","requestId":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","message":"Jinja template syntax is valid","response":{"isValidTemplate":true,"variables":["customer_name"],"analysis":{"scores":{"overall":85,"kvCache":90,"rating":"Good"},"issues":[],"recommendations":[]}}}}},"exampleType":"examples"}},"exampleType":"examples"},"5c92f2d0-f4b0-46c7-b435-c0070bda74a0":{"description":"Permission denied","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"failure","uniqueKey":"status","typeLabel":"string"},"requestId":{"type":"string","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","uniqueKey":"requestId","typeLabel":"string"},"message":{"type":"string","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":"failure","requestId":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","message":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"b9b6b5a4-49d7-4613-af3d-cb9b45e572a1":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"failure","uniqueKey":"status","typeLabel":"string"},"requestId":{"type":"string","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","uniqueKey":"requestId","typeLabel":"string"},"message":{"type":"string","uniqueKey":"message","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"status":"failure","requestId":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","message":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"55263e97-5703-4953-8408-0afbaec7a7fa":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key with 'agents' permission","scopes":[],"schemeName":"ApiKeyAuth"}}},"servers":{"4cad90c8-82e8-41e0-99ef-70250b4f4b93":{"url":"https://api.inya.ai/platform","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key with 'agents' permission","scopes":[],"schemeName":"ApiKeyAuth"},"schema":{"title":"x-api-key","type":"string","description":"API key with 'agents' permission","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"x-api-key"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"agents_openapi.yml"},"subdomain":"gnaniinnovationsprivatelimited","siteName":"Gnani AI Documentation","title":"Validate Prompt - Gnani AI Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-11T12:19:51.309Z","originalFileLocation":"Platform/Validate_Prompt.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Validate a Jinja2 system prompt template and receive optimization recommendations\">\u003cmeta data-mint-head name=\"application-name\" content=\"Gnani AI Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Validate Prompt - Gnani AI Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Validate a Jinja2 system prompt template and receive optimization recommendations\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Gnani AI Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.gnani.ai/Platform/Validate_Prompt\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://gnaniinnovationsprivatelimited.mintlify.site/_mintlify/api/og/v2?division=Agents+API\u0026amp;title=Validate+Prompt\u0026amp;description=Validate+a+Jinja2+system+prompt+template+and+receive+optimization+recommendations\u0026amp;theme=8b96a8e5debb948dd7f8ccc7\u0026amp;signature=006d12663cc365888c3ba2a87f17411d80a1ade980bfbcc05d29c911194a335e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Validate Prompt - Gnani AI Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Validate a Jinja2 system prompt template and receive optimization recommendations\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://gnaniinnovationsprivatelimited.mintlify.site/_mintlify/api/og/v2?division=Agents+API\u0026amp;title=Validate+Prompt\u0026amp;description=Validate+a+Jinja2+system+prompt+template+and+receive+optimization+recommendations\u0026amp;theme=8b96a8e5debb948dd7f8ccc7\u0026amp;signature=006d12663cc365888c3ba2a87f17411d80a1ade980bfbcc05d29c911194a335e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/gnaniinnovationsprivatelimited/b9mY1NvMwd3p02_R/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Gnani AI Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1A1A1A\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.gnani.ai/Platform/Validate_Prompt\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/Platform/Validate_Prompt.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.gnani.ai/#organization\",\"name\":\"Gnani AI Documentation\",\"url\":\"https://docs.gnani.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/gnaniinnovationsprivatelimited/07TQaHxEIXJZr-iJ/logo/favicon.svg?fit=max\u0026auto=format\u0026n=07TQaHxEIXJZr-iJ\u0026q=85\u0026s=feca06a904160c2b661bfa77fe1f90c4\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.gnani.ai#website\",\"name\":\"Gnani AI Documentation\",\"url\":\"https://docs.gnani.ai\",\"publisher\":{\"@id\":\"https://docs.gnani.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.gnani.ai/Platform/Validate_Prompt#webpage\",\"url\":\"https://docs.gnani.ai/Platform/Validate_Prompt\",\"name\":\"Validate Prompt\",\"description\":\"Validate a Jinja2 system prompt template and receive optimization recommendations\",\"dateModified\":\"2026-08-11T12:19:51.309Z\",\"isPartOf\":{\"@id\":\"https://docs.gnani.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.gnani.ai/Platform/Validate_Prompt#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.gnani.ai/Platform/Validate_Prompt#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Agents API\",\"item\":\"https://docs.gnani.ai/Platform/Create_Agent\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Validate Prompt\",\"item\":\"https://docs.gnani.ai/Platform/Validate_Prompt\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.gnani.ai/Platform/Validate_Prompt#apireference\",\"headline\":\"Validate Prompt\",\"name\":\"Validate Prompt\",\"description\":\"Validate a Jinja2 system prompt template and receive optimization recommendations\",\"url\":\"https://docs.gnani.ai/Platform/Validate_Prompt\",\"mainEntityOfPage\":{\"@id\":\"https://docs.gnani.ai/Platform/Validate_Prompt#webpage\"},\"dateModified\":\"2026-08-11T12:19:51.309Z\",\"publisher\":{\"@id\":\"https://docs.gnani.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.gnani.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Gnani AI Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Gnani AI Documentation","nav":{"global":null,"tabs":[{"tab":"Home","pages":[{"title":"Home","href":""}]},{"tab":"Gnani AI APIs","pages":[{"title":"Gnani AI APIs","href":"/api/introduction/introduction"}]},{"tab":"Gnani AI Agents","pages":[{"title":"Gnani AI Agents","href":"/introduction"}]},{"tab":"Gnani AI Agent Builder APIs","groups":[{"group":"Getting Started","pages":[{"title":"Introduction – Agent Builder Platform API","href":"/Platform/platform-introduction"}]},{"group":"Agents API","pages":[{"title":"Create Agent","openapi":"POST /v1/agents","href":"/Platform/Create_Agent"},{"title":"List Agents","openapi":"GET /v1/agents","href":"/Platform/List_Agents"},{"title":"Get Agent","openapi":"GET /v1/agents/{botId}","href":"/Platform/Get_Agent"},{"title":"Update Agent","openapi":"PUT /v1/agents/{botId}","href":"/Platform/Update_Agent"},{"title":"Delete Agent","openapi":"DELETE /v1/agents/{botId}","href":"/Platform/Delete_Agent"},{"title":"Trigger Test Call","openapi":"POST /v1/agents/{botId}/trigger_call","description":"Place an outbound test call from an agent to a whitelisted phone number","href":"/Platform/Trigger_Call"},{"title":"Validate Prompt","openapi":"POST /v1/agents/prompt/validate","href":"/Platform/Validate_Prompt"}]},{"group":"Conversations API","pages":[{"title":"Get Conversation Logs","openapi":"POST /v1/conversations/logs","description":"List past calls and find conversationId values for Stats and Audio","href":"/Platform/Get_Conversation_Logs"},{"title":"Get Conversation Statistics","openapi":"GET /v1/conversations/{conversationId}/stats","href":"/Platform/Get_Conversation_Stats"},{"title":"Get Conversation Audio","openapi":"GET /v1/conversations/{conversationId}/audio","href":"/Platform/Stream_Conversation_Audio"},{"title":"Get Aggregated Stats","openapi":"agents_openapi.yml POST /v1/conversations/stats","href":"/Platform/Aggregated_Stats"}]},{"group":"Agent Config API","pages":[{"title":"Get Languages","openapi":"GET /v1/agents/config/languages","href":"/Platform/Get_Languages"},{"title":"Get Regions","openapi":"GET /v1/agents/config/regions","href":"/Platform/Get_Regions"},{"title":"Get Timezones","openapi":"GET /v1/agents/config/timezone/{regId}","href":"/Platform/Get_Timezones"},{"title":"Get LLM Models","openapi":"GET /v1/agents/config/llm_models","href":"/Platform/Get_LLM_Models"},{"title":"Get Transcriber Config","openapi":"GET /v1/agents/config/transcriber_config","href":"/Platform/Get_Transcriber_Config"},{"title":"Get TTS Config","openapi":"GET /v1/agents/config/tts_config","href":"/Platform/Get_TTS_Config"}]},{"group":"Agent FAQ API","pages":[{"title":"Add FAQ Entries","openapi":"POST /v1/agents/{botId}/faqs","href":"/Platform/Add_FAQs"},{"title":"List FAQs","openapi":"GET /v1/agents/{botId}/faqs","href":"/Platform/List_FAQs"},{"title":"Update FAQ","openapi":"PUT /v1/agents/{botId}/faqs","href":"/Platform/Update_FAQ"},{"title":"Delete FAQs","openapi":"DELETE /v1/agents/{botId}/faqs","href":"/Platform/Delete_FAQs"},{"title":"Get FAQ Sample","openapi":"GET /v1/agents/faqs/sample","href":"/Platform/FAQ_Sample"},{"title":"Bulk Import FAQs","openapi":"POST /v1/agents/{botId}/faqs/import","href":"/Platform/Import_FAQs"}]},{"group":"Chat SDK API","pages":[{"title":"Get Chat Widget Config","openapi":"GET /v1/agents/{botId}/chat-sdk-config","href":"/Platform/Get_Chat_SDK_Config"},{"title":"Update Chat Widget Config","openapi":"PUT /v1/agents/{botId}/chat-sdk-config","href":"/Platform/Update_Chat_SDK_Config"},{"title":"Upload Chat Widget Icon","openapi":"POST /v1/agents/{botId}/chat-sdk-icon","href":"/Platform/Upload_Chat_SDK_Icon"}]},{"group":"Reference","pages":[{"title":"Error Reference","href":"/Platform/Error_Reference"}]}]}]},"basePath":"","title":"Validate Prompt - Gnani AI Documentation","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-i2a3QZ8E.js","utils-ChLwp8m0.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DRktVTDc.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CA2pEs4T.js","snippetPresets-ClQ6XrKD.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-Ct_Lv36y.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-Cn2PYw9e.js","shallow-rkyymjXQ.js","getApiPlaygroundDisplay-BB9vkXtE.js","CodeSnippet-Bm5RU7m1.js","CodeSnippets-BgU9Deuz.js","Page-BUDYNlhG.js","getPastedJson-BD-6NNum.js","icon-8Z6tud2e.js","MethodPill-Tuzr4g3V.js","DuplicateIcon-0ceWFYhN.js","createIcon-FBXow_ST.js","DynamicMarkdown-CD8713Yy.js","SectionHeading-7zgzQbH-.js","axios-vUo_bRtp.js","Markdown-D7Ofw1oz.js","clsx-eKJ4rcii.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-CwjSCXIK.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-9EK5IAXV.js"]}