# Single Send Api html + Hubl: For Loop not rendering correctly

**URL:** <https://community.hubspot.com/t/single-send-api-html-hubl-for-loop-not-rendering-correctly/107977>\
**Category:** APIs & Integrations\
**Tags:** email\
**Created:** [May 24, 2024, 8:38pm UTC](https://community.hubspot.com/t/single-send-api-html-hubl-for-loop-not-rendering-correctly/107977 "2024-05-24T20:38:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![COtani](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@COtani](https://community.hubspot.com/u/COtani)\
**Post date:** [May 24, 2024, 8:38pm UTC](https://community.hubspot.com/t/single-send-api-html-hubl-for-loop-not-rendering-correctly/107977/1 "2024-05-24T20:38:30Z")

</div>

I’m using the single-send-api with a for loop but the for loop is not working as expected. I used the example in the documentation and added an additional custom property to show that the single custom properties at the main level works, but the array property using a for loop is not working.

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fmarketing-single-send-v4%2Fguide)**

**Note: when I render the same email in python using jinja2 the for loop works as expected.**

In the design preview the For loop {{ variables }} do not show up in the preview

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/4/341a1ce8dc9368e7042717c5c54ea8db03083b84.png)

Here is the acutal email received that was sent through the api, the property outisde the loop works but not the array for loop properties:

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/a/eab749f94b71dc895a771f762a910c00d9fbf349.png)

Here is the template (I used the example in the documentation and it works fine in python rendered usinng Jinja2):

```lia-code-sample
<!--
 templateType: email
 isAvailableForNewContent: true
-->
<!doctype html>
<html>
 <head>
 <title>test</title>
 </head>
 <body>
 <p>
 Thanks for your recent purchase! Here are the details of the items you'll be receiving:
 </p>
 <p>
 Testing a custom value outside the for loop: {{ custom.test_key }}
 </p>
 <ul>
 {% for item in custom.exampleArray %}
 <li>First key: {{ item.firstKey }}, Second key: {{item.secondKey}}</li>
 {% endfor %} 
 </ul>
 <p id="footer">
 {{ site_settings.company_name }} 
 {{ site_settings.company_street_address_1 }} 
 {{ site_settings.company_street_address_2 }} 
 {{ site_settings.company_city }} 
 {{ site_settings.company_state }} 
 {{ site_settings.company_zip }} 
 {{ site_settings.company_country }} 
 <br/>
 You received this email because you are subscribed to {{ subscription_name }} from {{ site_settings.company_name }}.
 <br/>
 <a class="hubspot-mergetag" data-unsubscribe="true" href="{{ unsubscribe_link }}">Update your email preferences</a> to choose the types of emails you receive.
 <br/>
 <a class="hubspot-mergetag" data-unsubscribe="true" href="{{ unsubscribe_link_all }}">Unsubscribe from all future emails.</a>
 </p>
 </body>
</html>

```

Here is the json data

```lia-code-sample
 data = {
 "emailId": 168429014623,
 "message": {
 "to": "test@test.com",
 },
 "customProperties": {
 'test_key':'test_value',
 "exampleArray": [
 {"firstKey": "someValue", "secondKey": "anotherValue"},
 {"firstKey": "value1", "secondKey": "value2"}
 ]
 }
 }

```

---

<div class="post-metadata">

**Author:** ![COtani](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@COtani](https://community.hubspot.com/u/COtani)\
**Post date:** [May 24, 2024, 9:20pm UTC](https://community.hubspot.com/t/single-send-api-html-hubl-for-loop-not-rendering-correctly/107977/2 "2024-05-24T21:20:12Z")

</div>

I found my error. It was in the documentation but I overlooked the note:

I needed to add this to the template for it to work:

isEnabledForEmailV3Rendering: true
