Layout Template Object

Layout templates are used to format landing pages, forms, and site search results. Learn more about layout templates in Salesforce Help.

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

Include the authentication header with every request. For information on how to authenticate, see Authentication.

Note

Supported Operations 

OperationHTTP VerbURL FormatAbility Requirements
ReadGEThttps://pi.pardot.com/api/v5/objects/layout-templates/<id>?<params>Marketing > Landing Pages > Layout Templates > View
CreatePOSThttps://pi.pardot.com/api/v5/objects/layout-templates?<params>Marketing > Landing Pages > Layout Templates > Create
UpdatePATCHhttps://pi.pardot.com/api/v5/objects/layout-templates/<id>?<params>Marketing > Landing Pages > Layout Templates > Create
DeleteDELETEhttps://pi.pardot.com/api/v5/objects/layout-templates/<id>Marketing > Landing Pages > Layout Templates > Delete
QueryGEThttps://pi.pardot.com/api/v5/objects/layout-templates?<params>Marketing > Landing Pages > Layout Templates > View
Add TagPOSThttps://pi.pardot.com/api/v5/objects/layout-templates/<id>/do/addTagMarketing > Landing Pages > Layout Templates > Create AND Marketing > Segmentation > Tags > Create
Remove TagPOSThttps://pi.pardot.com/api/v5/objects/layout-templates/<id>/do/removeTagMarketing > Landing Pages > Layout Templates > Create AND Marketing > Segmentation > Tags > Create

Fields 

Required Editable Fields 

FieldTypeDescription
nameStringName of the object for identification in Account Engagement.
layoutContentStringHTML content of this layout template encoded as JSON string.

Optional Editable Fields 

FieldTypeDescription
formContentStringHTML content encoded as a JSON string that controls form display logic. Uses default values if they’re not provided.
isIncludeDefaultCssBooleanTrue if not supplying custom CSS styling.
folderIdIntegerID of the folder containing this object. Uses the asset type’s uncategorized folder if not specified on create.

Read-Only Fields 

FieldTypeDescription
idIntegerID of this object.
isDeletedBooleanThe value is true if this object is in the recycle bin in Account Engagement.
createdAtDateTimeCreation time of this object.
updatedAtDateTimeThe last-updated time for the object.
createdByIdIntegerID of the user who created the object.
updatedByIdIntegerID of the user who last updated the object.
createdByUserUser object representing the user who created the object. See documentation for User for fields.
updatedByUserUser object representing the user who last updated the object. See documentation for User for fields.
siteSearchContentStringHTML content encoded as a JSON string that controls the site search content. Uses default values if they’re not provided.
folderFolderFolder object representing the folder containing this object. See documentation for Folder for fields.

Defaults 

formContent 

1<form method="post" action="%%form-action-url%%" class="form">
2    %%form-opening-general-content%%
3
4   %%form-if-thank-you%%
5       %%form-javascript-focus%%
6       %%form-thank-you-content%%
7       %%form-thank-you-code%%
8   %%form-end-if-thank-you%%
9
10   %%form-if-display-form%%
11
12       %%form-before-form-content%%
13           %%form-if-error%%
14               <p class="errors">Please correct the errors below:</p>
15           %%form-end-if-error%%
16
17           %%form-start-loop-fields%%
18               <p class="%%form-field-css-classes%% %%form-field-class-required%% %%form-field-class-hidden%% %%form-field-class-no-label%% %%form-field-class-error%%">
19                   %%form-if-field-label%%
20                       <label for="%%form-field-id%%">%%form-field-label%%</label>
21                   %%form-end-if-field-label%%
22
23                   %%form-field-input%%
24                   %%form-if-field-description%%
25                       <span class="description">%%form-field-description%%</span>
26                   %%form-end-if-field-description%%
27               </p>
28               <div id="error_for_%%form-field-id%%" style="display:none"></div>
29               %%form-field-if-error%%
30                   <p class="error no-label">%%form-field-error-message%%</p>
31               %%form-field-end-if-error%%
32           %%form-end-loop-fields%%
33
34           <p class="submit">
35               <input type="submit" accesskey="s" value="%%form-submit-button-text%%" onclick="%%form-submit-indicator-on-click%%"/>
36               %%form-submit-indicator-tag%%
37           </p>
38
39           %%form-spam-trap-field%%
40           %%form-javascript-first-input-focus%%
41       %%form-after-form-content%%
42
43   %%form-end-if-display-form%%
44
45   %%form-javascript-link-target-top%%
46</form>

siteSearchContent 

1<form method="get" action="%%search-action-url%%" class="form" id="pardot-form">
2    <p class="full-width">
3        <input type="text" name="q" value="%%search-query%%" size="40" />
4        <input type="submit" value="Search" />
5    </p>
6    <h2>Search results for: %%search-query%%</h2>
7
8    %%search-if-results%%
9    <ol start="%%search-result-start-position%%">
10        %%search-start-loop-results%%
11        <li>
12            <strong><a href="%%search-result-url%%">%%search-result-title%%</a></strong><br/>
13            %%search-result-description%%<br/>
14            <em>%%search-result-url-abbreviation%%</em> %%search-result-file-size%% KB
15        </li>
16        %%search-end-loop-results%%
17    </ol>
18
19    <p class="pager">
20        <strong>
21        %%search-if-previous-page-available%%
22        <a href="%%search-previous-page-url%%">
23            Previous (page %%search-previous-page-number%%)
24        </a>
25        %%search-else-previous-page-not-available%%
26            Previous
27        %%search-end-if-previous-page-available%% |
28
29        Page %%search-this-page-number%% of %%search-total-pages-number%% |
30
31        %%search-if-next-page-available%%
32            <a href="%%search-next-page-url%%">
33            Next (page %%search-next-page-number%%)</a>
34        %%search-else-next-page-not-available%%
35            Next
36        %%search-end-if-next-page-available%%
37        </strong>
38    </p>
39    %%search-else-no-results%%
40        %%search-no-results-content%%
41    %%search-end-if-results%%
42</form>

Layout Template Creation 

A Layout Template POST request must have a JSON body that specifies all the required fields. All HTML content must be JSON escaped.

Example request:

1POST /api/v5/objects/layout-templates?fields=id,name,layoutContent,isIncludeDefaultCss,createdBy.username,updatedBy.username,createdAt,updatedAt HTTP/1.1
2Host: pi.pardot.com
3Authorization: Bearer <access-token>
4Content-Type: application/json
5
6{
7    "name":"my template",
8    "layoutContent":"<html></html>",
9    "isIncludeDefaultCss":true,
10    "folderId": 1769
11}

Example response:

This example doesn’t show all the headers. Whitespace has been added to make it easier to read.

1HTTP/1.1 201 Created
2Content-Type: application/json
3https://pi.pardot.com/api/v5/objects/layout-templates/6?fields=id,name,layoutContent,isIncludeDefaultCss,createdBy.username,updatedBy.username,createdAt,updatedAt
4
5{
6    "id": 4983,
7    "name": "my template",
8    "layoutContent": "<html></html>",
9    "isIncludeDefaultCss": true,
10    "createdAt": "2020-09-29T09:36:56-04:00",
11    "updatedAt": "2020-09-29T09:36:56-04:00",
12    "createdBy": {
13        "username": "jsmith@example.com"
14    },
15    "updatedBy": {
16        "username": "jsmith@example.com"
17    }
18}

Examples include extra spaces for readability and don’t always include headers. The fields in the response body and Location header match the fields specified on the example request.

Layout Template Update 

Updating a layout template follows the conventions described in the Version 5 Overview.

Layout Template Deletion 

Deleting a layout template follows the conventions described in the Version 5 Overview. Layout templates that are in use on Forms and Landing Pages can’t be deleted. To successfully delete, remove all usages.

Layout Template Query 

Retrieving a collection of layout templates follows the conventions described in Version 5 Overview.

Sortable Fields 

When executing a query, the following fields can be specified in the orderBy parameter. See the conventions for query described in the Version 5 Overview.

  • id

Example request:

1GET /api/v5/objects/layout-templates?fields=id,name,layoutContent,isIncludeDefaultCss,createdBy.username,updatedBy.username,createdAt,updatedAt&orderBy=id
2Host: pi.pardot.com
3Authorization: Bearer <access-token>

Example response:

1HTTP/1.1 200 OK
2Content-Type: application/json
3{
4    "values": [
5        {
6            "id": 4983,
7            "name": "my template",
8            "layoutContent": "<html></html>",
9            "isIncludeDefaultCss": true,
10            "createdAt": "2020-09-29T09:36:56-04:00",
11            "updatedAt": "2020-09-29T09:36:56-04:00",
12            "createdBy": {
13                "username": "jsmith@example.com"
14            },
15            "updatedBy": {
16                "username": "jsmith@example.com"
17            }
18        }
19    ]
20}

Filtering Results 

When executing a query, the following parameters can be used to filter the returned results. These parameters can be specified in the request along with any shared parameters defined in Version 5 Overview. When specifying more than one parameter, all parameters must match the record in order for it to be returned in the results.

ParameterDescription
idReturns any layout templates where ID is equal to the given integer value.
idListReturns any layout templates where ID is included in the given list of values.
idGreaterThanReturns any layout templates where ID is greater than the specified value, non-inclusive.
idGreaterThanOrEqualToReturns any layout templates where ID is greater than or equal to the specified value.
idLessThanReturns any layout templates where ID is less than the specified value, non-inclusive.
idLessThanOrEqualToReturns any layout templates where ID is less than or equal to the specified value.
nameReturns any layout templates where Name is equal to the given string value.
deletedDetermines whether to return deleted records. The value can be false (default), true, or all.

Example request:

1GET /api/v5/objects/layout-templates?fields=id,name&orderBy=id desc&idGreaterThan=5100&idLessThan=5200
2Host: pi.pardot.com
3Authorization: Bearer <access-token>

Example response:

1HTTP/1.1 200 OK
2Content-Type: application/json
3{
4    "values": [
5        {
6            "id": 5196,
7            "name": "Winter Sale Template"
8        },
9        {
10            "id": 5149,
11            "name": "Spring Sale Template"
12        },
13        {
14            "id": 5132,
15            "name": "Promotion Template"
16        }
17    ]
18}

Add Tag 

Adds a Tag to the Layout Template object, which creates a TaggedObject.

Example Request

1POST https://pi.pardot.com/api/v5/objects/layout-templates/1000/do/addTag
2Host: pi.pardot.com
3Authorization: Bearer <access-token>
4Content-Type: application/json
5
6{
7    "tagId": 100
8}

Example Response

1HTTP/1.1 200 OK
2Content-Type: application/json
3{
4    "id": 610,
5    "createdAt": "2024-09-23T18:26:49-04:00",
6    "createdById": 250,
7    "objectId": 1000,
8    "objectType": "layout-template",
9    "tagId": 100
10}

Remove Tag 

Remove a tag from a Layout Template object. When you remove a tag, the associated TaggedObject record is deleted.

Example Request

1POST https://pi.pardot.com/api/v5/objects/layout-templates/1000/do/removeTag
2Host: pi.pardot.com
3Authorization: Bearer <access-token>
4Content-Type: application/json
5
6{
7    "tagId": 100
8}

Example Response

Returns code 204 no content.