Nullifying optional parameters in API calls for AI agents

<div class="article-banners">
<div id="docs-wmp-link"><a href="https://support.zendesk.com/hc/en-us/articles/5411234991258-plan" rel="noopener noreferrer" target="_blank">What's my plan?</a></div>
<div class="article-banner" id="suite_all"><figure class="wysiwyg-table wysiwyg-table-align-left"><table><tbody><tr>
<td><strong>All Suites</strong></td>
<td>Team, Growth, Professional, Enterprise, or Enterprise Plus</td>
</tr></tbody></table></figure></div>
<div class="article-banner" id="support_all"><figure class="wysiwyg-table wysiwyg-table-align-left"><table><tbody><tr>
<td><strong>Support</strong></td>
<td>Team, Professional, or Enterprise</td>
</tr></tbody></table></figure></div>
</div><div class="body">

<p>You may have an API that can accept multiple request parameters, yet not all are mandatory to make a successful call. If a parameter is expected but not provided, the integration may fail because the API expects a valid value—whether an empty string `””` or `null`. In that case you will need to nullify these parameters in the integration builder so that the call does not break.</p>
<p><strong>To nullify optional parameters</strong></p>
<ol>
<li data-list-item-id="ebeb2482fb927d9560ecf9df50ec61b36">Understand optional parameter behavior.<br>First, make sure that your API can gracefully handle optional values as either an empty string or `null`.</li>
<li data-list-item-id="e51fe35c9ee6c0c437a361973d6fc45dd">On Chat Start, initialize the optional parameters to null or an empty string.<br>This will prevent the API call from failing when a parameter is omitted. For more information, see <a href="https://support.zendesk.com/hc/en-us/articles/8357756651290">About actions for AI agents</a>.<br><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_nullify_1.png" width="600"><br><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_nullify_2.png" width="600">
</li>
<li data-list-item-id="e7ae3c5571dcb25836aadf6fdf4a3ae14">In the integration in the integration builder, make sure that the parameters are collected as request parameters and that the check box for Required is unchecked.<br><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_nullify_3.png" width="600">
</li>
<li data-list-item-id="ed9ac33566bbcf374bbb869adb61b5332">Hover over the Test value input box until you see the symbol for reformat values.<br><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_nullify_4.png" width="600"><br>When you click this, a dialog appears. Here, you want to add the following JSONata expression to the text box that says “Reformatting JSONata”:<br>```$a and $not($a = "null") ? $a : ""```<br>This JSONata expression will check whether the parameter exists and has a value.<ul>
<li data-list-item-id="e0a7287bfa748d2b2bac6d687f2ec258a">If it does, pass the parameter value to the API.</li>
<li data-list-item-id="e8cc71bf44139e8a3f6f59e64ff2cb1a7">If it doesn’t, provide an empty string or omit it entirely.<br><img src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_nullify_5.png" width="600"><br>For more information on how to reformat values, see <a href="https://support.zendesk.com/hc/en-us/articles/8560203369242">Reformatting values in request parameters for AI agents</a>.</li>
</ul>
</li>
</ol>
<p>Now when you have a value that is optional for your API call, it will be handled by the integration builder seamlessly.</p>
<p> </p>
<script id="docs-schema-markup" type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "TechArticle",
"@id": "https://support.zendesk.com/hc/en-us/articles/8920231981338",
"url": "https://support.zendesk.com/hc/en-us/articles/8920231981338-Nullifying-optional-parameters-in-API-calls-for-advanced-AI-agents",
"headline": "Nullifying optional parameters in API calls for advanced AI agents",
"description": "You can prevent API call failures by initializing optional parameters to null or an empty string and using a JSONata expression to handle their values in the integration builder.",
"articleSection": "Integrating other platforms with advanced AI agents",
"datePublished": "2025-02-19T18:59:06+00:00",
"dateModified": "2025-09-05T23:12:38+00:00",
"inLanguage": "en-US",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://support.zendesk.com/hc/en-us/articles/8920231981338"
},
"author": {
"@type": "Organization",
"name": "Zendesk",
"@id": "https://www.zendesk.com"
},
"publisher": {
"@type": "Organization",
"name": "Zendesk",
"@id": "https://www.zendesk.com"
},
"isPartOf": {
"@type": "WebSite",
"name": "Zendesk Help",
"@id": "https://support.zendesk.com/hc/"
},
"about": {
"@type": "SoftwareApplication",
"name": "Zendesk",
"@id": "https://www.zendesk.com",
"softwareAddOn": {
"@type": "SoftwareApplication",
"name": "AI agents",
"@id": "https://support.zendesk.com/hc/en-us/sections/8988994355994"
}
}
}
</script>
</div>