Files

The API to access the Files object collection 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/files/<id>?<params>
Create POST https://pi.pardot.com/api/v5/objects/files?<params>
Update PATCH https://pi.pardot.com/api/v5/objects/files/<id>?<params>
Delete DELETE https://pi.pardot.com/api/v5/objects/files/<id>

Fields

Required Editable Fields

None.

Optional Editable Fields

Field Type Description
name String Name of the object for identification in Pardot.
folderId Integer ID of the folder containing this object.
campaignId Integer Pardot Campaign related to this object.
vanityUrlPath String Vanity URL path (excluding protocol and host). This value must be unique.
trackerDomainId Integer ID of the TrackerDomain to use in the URL for this object.

Read-Only Fields

Field Type Description
id Integer ID of the object.
salesforceId String ID of the Salesforce object representing this 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.
url String URL where the downloadable file can be accessed.
size Integer Size (in bytes) of the downloadable file.
bitlyIsPersonalized Boolean True if the object has a bitly URL that is personalized.
bitlyShortUrl String Bitly URL if present.
vanityUrl String Vanity URL if present.
trackerDomain TrackerDomain object JSON object representing the TrackerDomain to use in the URL for this object. See documentation for TrackerDomain for fields.
isTracked Boolean True if downloads of this file are recorded as visitor activity.

File Creation

A File creation POST request must be a multipart request as described in Version 5 (Beta) Overview.

If the name field is not provided in the input body during creation, the filename of the uploaded file part will be used for the name. A blank or null name cannot be explicitly included in the input for File creation.

Example request:

POST /api/v5/objects/files?fields=id,name,url,createdBy.id,createdBy.username HTTP/1.1
Host: pi.pardot.com
Authorization: Bearer <access-token>
Content-Type: multipart/form-data; boundary=----boundary-marker

----boundary-marker
Content-Disposition: form-data; name="file"; filename="conference_venues.pdf"

<file-data>
----boundary-marker
Content-Disposition: form-data; name="input"

{
  "name": "Conference Venues",
  "campaignId": 72836
}
----boundary-marker

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
Location: https://pi.pardot.com/api/v5/objects/files/8736?fields=id,name,url,createdBy.id,createdBy.username

{
  "id": 8736,
  "name": "Conference Venues",
  "url": "https://go.pardot.com/<generated-path-components>/conference_venues.pdf",
  "createdBy": {
    "id": 457,
    "username": "jsmith@mycompany.com"
  }
}

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

File Update

A File update PATCH request can be a multipart request as described in Version 5 (Beta) Overview. It can also be a simple request that has a JSON body with fields to update.

If you do not specify name, the name of the File is not changed. Note: This is different from a File create POST request which uses the filename of the uploaded file part as the default for name.

File Deletion

Deleting a File follows the conventions described in the Version 5 (Beta) Overview. You cannot delete a File that is referenced by certain Pardot objects. For example, if you try to delete a File that is referenced by a dynamic list, a 204 Method Not Allowed status is returned and the File is not deleted.