File Field Type | Yext Hitchhikers Platform

The File field type allows you to store files directly on your entities. This type is available for use in custom fields and custom field types.

Properties

The File field type is composed of the following five properties:

Property Description
sourceURL Source URL of the file. Only populates if uploaded by providing a hosted URL.
url The Yext-Hosted URL of the file.
mimeType The MIME Type of the file. Currently all MIME types are supported.
name The display name of the file. User-settable.
size The size of the file in bytes.

File field types can be configured to support one file or support a list of files. This will automatically create a maximum file upload validation of 1 or 5,000 respectively.

Validation

The default validation for File fields is below. You can also configure validation for File custom fields and File custom field types.

Option Default Validation Custom Validation
File Format All MIME-type formats are allowed. You can restrict uploaded files to a subset of allowed file types by common MIME type.
Maximum File Size Files cannot exceed 100 MB. Set a different maximum size limit in bytes, kilobytes, or megabytes. The value must be a whole number and cannot exceed 100 MB.

Uploading Files

Files can be uploaded using all interfaces for editing enitities in Yext Content:

  • Entity Edit
  • Entity Upload
  • Connectors
  • API
  • Configuration as Code

All interfaces support file uploads by referencing a source URL. Uploading from a local file system is only supported in Entity Edit.

To upload a file that is hosted online, indicate the hosted URL using the url property. This provided url will then be propagated to the sourceUrl property, while the URL field will change to be the Yext hosted URL of this file.

Updating Files

To change a file being stored in a field on an entity, update the value of the url property to be the new hosted file’s URL. Sending updates to the sourceUrl property is not supported.

The user-agent string used to download files is YextBot YextFileDownloader/1.0.

Accessing Stored Files

Files stored on entities can be accessed via Entity Edit and via API.

Entity Edit

Files can be downloaded from the URL property. The edit state of this field will show all properties of the File field. Properties of a file cannot be edited in Entity Edit, except for the name of the file.

API

Opening the URL stored in the url property will download the file onto your local device. Here’s an example of what this would look like on an Entities: GET.

With other fields elided, the response looks like this:

{
  "response": {
    "entities": [{
      "c_pdfFile": [{
  		"sourceUrl": "https://www.pdfs.com/123",
  		"url":"https://a.mktgcdn.com/f/3912636/123",
  		"mimeType": "application/pdf",
  		"name": "Instruction Manual",
  		"size": 2001
	}]
    }]
  }
}

Limitations

  • Validation on uncommon MIME types is not supported.
  • Uploading local files via Entity Upload, Connectors, API, and Configuration as Code is not supported.
  • The name property cannot be mapped via connector, but can be set or edited on all other interfaces.
  • There is a known issue with JsonFormat.Printer affecting Configuration as Code where the maxSize property will be returned as a string when pulled. However, when applied, this property needs to be a number.