I've been searching through the Fuelsdk docs and I can't work out how templates can be created/updated. It feels like I'm missing something obvious here, but how can I create a new template and insert html using the API?

3 Answers 3


The Template object is not currently exposed via the SDK, it is accessible by using the SOAP API directly.

Details on the Template object: https://help.marketingcloud.com/en-US/technical_library/web_service_guide/objects/template/

Example SOAP Request:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="https://exacttarget.com/wsdl/partnerAPI">
<!-- Header removed -->
      <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Objects xsi:type="par:Template" xmlns:par="http://exacttarget.com/wsdl/partnerAPI">
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <TemplateName>API Created Template5</TemplateName>
            <LayoutHTML><![CDATA[<body bgcolor="#ffffff" text="#000000"><table @@cellspacing @@cellpadding @@borderwidth @@bordercolor @@bgcolor @@width @@alignment><tr><td>@@headerContent</td></tr><tr><td>@@layoutContent</td></tr></table><custom name="opencounter" type="tracking"></body>]]></LayoutHTML>

Pretty sure you can't create Email Templates using the SFMC APIs. The whole re-publishing templated email scenario is a complication that I don't think they have overcome.

You can certainly update Content Areas in templated emails or update HTML Paste emails with the API.

  • <custom> tags to allow content blocks don't seem to work when an email is created through the API, but they do work if the same html goes in as a template then an html is created from it. That's why I'm asking about templates - should a <custom> tag work in an email that isn't based on a template?
    – Will
    Commented Jul 7, 2016 at 12:08
  • When you are creating the Email via the API with content blocks, does the request have IsHTMLPaste = false and EmailType = Normal? Those should be the default values so if they are undefined then that should work too.
    – Mac
    Commented Jul 7, 2016 at 14:58
  • I've checked and the email is being created with IsHTMLPaste = false and EmailType = Normal, also I've retrieved the campaign to check these. What I can't work out is whether an email being from a template a precondition of making the <custom> tags work? If not, what other properties might be important - what does IsActive mean - and where is it documented?
    – Will
    Commented Jul 7, 2016 at 20:23

@Mac's answer is correct at the most basic level. It's possible to create and update Templates, however the API doesn't have access to the ContentAreas, the "Layout" object referred to in the documentation (updated URL: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/template.htm) says that the Layout object contains ContentAreas, it does not. There is a Laravel Version of the FuelSDK, i've added "createTemplate" and "updateTemplate" methods to the ET_Client, and I am using these in production. https://packagist.org/packages/ariad/exacttarget-laravel

I very badly need to update that documentation.

The Layout Object: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/layout.htm states "reserved for Future Use" and also does not have ContentAreas.

The only thing that can implement a ContentArea, is HeaderContent which is type: ContentArea description: Contains content used in header of template.

This only provides the ID and ObjectID to a ContentArea Object which you can update if it exists, it appears to be missing the key and content which you would need to make this work in the content tag, I don't think you can create these independently as they have a CategoryID of 0 (they belong to a Template, not in My Contents).

Bottom line, The Template Object from the API perspective is VERY broken. Basic Templates can be created, but you'll need to go into the Marketing Cloud website and fix them if you are using any of their more powerful features.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .