Layout Templates

The API to access the Layout Templates object follows the conventions described in Version 5 (Beta) Overview.

Supported Operations

Operation HTTP Verb URL Format
Read GET https://pi.pardot.com/api/v5/objects/layout-templates/<id>?<params>
Create POST https://pi.pardot.com/api/v5/objects/layout-templates?<params>
Update PATCH https://pi.pardot.com/api/v5/objects/layout-templates/<id>?<params>
Delete DELETE https://pi.pardot.com/api/v5/objects/layout-templates/<id>

Fields

Required Editable Fields

Field Type Description
name String Name of the object for identification in Pardot.
layoutContent String HTML content of the layout template

Optional Editable Fields

Field Type Description
formContent String HTML content that controls form display logic. If not specified on create, this value assumes the default (below). Reference
isIncludeDefaultCss Boolean Defaults to true. If supplying your own CSS styling, set this value to false.
folderId Integer ID of the folder containing this object. If not specified on create, this value assumes the default uncategorized folder for the asset type.

Read-Only Fields

Field Type Description
id Integer ID of the object.
isDeleted Boolean True if the object is in the recycle bin in Pardot.
createdAt DateTime Creation time of the object.
updatedAt DateTime Last update time of the object.
createdById Integer ID of the User who created this object.
createdBy User User object representing the User who created this object. See documentation for User for fields.
updatedById Integer ID of the User who last updated this object.
updatedBy User User object representing the User who last updated this object. See documentation for User for fields.

Defaults

formContent
<form method="post" action="%%form-action-url%%" class="form">
    %%form-opening-general-content%%

   %%form-if-thank-you%%
       %%form-javascript-focus%%
       %%form-thank-you-content%%
       %%form-thank-you-code%%
   %%form-end-if-thank-you%%

   %%form-if-display-form%%

       %%form-before-form-content%%
           %%form-if-error%%
               <p class="errors">Please correct the errors below:</p>
           %%form-end-if-error%%

           %%form-start-loop-fields%%
               <p class="%%form-field-css-classes%% %%form-field-class-required%% %%form-field-class-hidden%% %%form-field-class-no-label%% %%form-field-class-error%%">
                   %%form-if-field-label%%
                       <label for="%%form-field-id%%">%%form-field-label%%</label>
                   %%form-end-if-field-label%%

                   %%form-field-input%%
                   %%form-if-field-description%%
                       <span class="description">%%form-field-description%%</span>
                   %%form-end-if-field-description%%
               </p>
               <div id="error_for_%%form-field-id%%" style="display:none"></div>
               %%form-field-if-error%%
                   <p class="error no-label">%%form-field-error-message%%</p>
               %%form-field-end-if-error%%
           %%form-end-loop-fields%%

           <p class="submit">
               <input type="submit" accesskey="s" value="%%form-submit-button-text%%" onclick="%%form-submit-indicator-on-click%%"/>
               %%form-submit-indicator-tag%%
           </p>

           %%form-spam-trap-field%%
           %%form-javascript-first-input-focus%%
       %%form-after-form-content%%

   %%form-end-if-display-form%%

   %%form-javascript-link-target-top%%
</form>

Layout Template Creation

A Layout Template POST request must have a JSON body with all required fields specified. Note that all HTML content should be JSON escaped.

Example request:

POST /api/v5/objects/layout-templates?fields=id,name,layoutContent,isIncludeDefaultCss,createdBy.username,updatedBy.username,createdAt,updatedAt HTTP/1.1
Host: pi.pardot.com
Authorization: Bearer <access-token>
Content-Type: application/json

{
    "name":"my template",
    "layoutContent":"<html></html>",
    "isIncludeDefaultCss":true,
    "folderId": 1769
}

Example response:

This example does not show all the headers, and whitespace has been added to make it easier to read.

HTTP/1.1 201 Created
Content-Type: application/json
https://pi.pardot.com/api/v5/objects/layout-templates/6?fields=id,name,layoutContent,isIncludeDefaultCss,createdBy.username,updatedBy.username,createdAt,updatedAt

{
    "id": 4983,
    "name": "my template",
    "layoutContent": "<html></html>",
    "isIncludeDefaultCss": true,
    "createdAt": "2020-09-29T09:36:56-04:00",
    "updatedAt": "2020-09-29T09:36:56-04:00",
    "createdBy": {
        "username": "jsmith@example.com"
    },
    "updatedBy": {
        "username": "jsmith@example.com"
    }
}

The fields in the response body and Location header are the same as the fields specified on the example request.

Layout Template Update

Updating a Layout Template follows the conventions described in the Version 5 (Beta) Overview.

Layout Template Deletion

Deleting a Layout Template follows the conventions described in the Version 5 (Beta) Overview. Layout templates that are in use on Forms and Landing Pages cannot be deleted. All usages must be removed before successful deletion.