Manage Custom Fonts in Marketing Cloud Next

To add an external font file to your Marketing Cloud Next content workspace, upload it from your computer or specify the URL. Use custom fonts in emails, landing pages, forms, and content blocks without depending on a publicly available content delivery network (CDN) URL.

Prerequisite

Retrieve the ID of the folder or workspace where you want to add the font. See Manage Content Workspaces and Manage Content Folders.

Add a Font to Your Content Workspace

There are two ways to add a font to your content workspace. The easiest method is to specify an external URL where the font is hosted. Alternatively, you can upload a font file from your computer by creating a multipart POST request that includes the encoded binary data for the font.

Add a Font by Specifying an External URL

To add a font hosted at an external URL, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents endpoint. The body of the request uses an application/json Content-Type value.

Property Data Type Description
contentBody.sfdc_cms:media.source.type string Required. The source of the content item. For externally hosted fonts, use url.
contentBody.sfdc_cms:media.source.url string Required. The URL of the externally hosted font.
contentSpaceOrFolderId string Required. The ID of the workspace or folder to add the font to.
contentType string Required. The type of the content item. For custom fonts, use sfdc_cms__customFont.
title string Required. A name that identifies the font in your content workspace.
POST /services/data/{apiVersion}/connect/cms/contents HTTP/1.1
Host: {subdomain}.my.salesforce.com
Content-Type: application/json
Authorization: Bearer YOUR_BEARER_TOKEN

{
  "contentSpaceOrFolderId": "0ZuQZ0000004YSv0AM",
  "contentType": "sfdc_cms__customFont",
  "title": "Brand Sans Regular",
  "contentBody": {
    "sfdc_cms:media": {
      "source": {
        "type": "url",
        "url": "https://fonts.example.com/brand-sans-regular.woff2"
      }
    }
  }
}

note: The API doesn't validate that the URL resolves to a valid font file. Double-check the URL that you provide.

Add a Font by Uploading a Font File

To upload a font file, issue a multipart/form-data POST request to the /services/data/{apiVersion}/connect/cms/contents endpoint.

Include a JSON part named ManagedContentInputParam and a binary part named contentData. Set the contentData part's content type to font/woff2, font/ttf, or font/otf, depending on the type of font. Include the font file as a base64-encoded string.

POST /services/data/{apiVersion}/connect/cms/contents HTTP/1.1
Host: {subdomain}.my.salesforce.com
Content-Type: multipart/form-data; boundary=BOUNDARY
Authorization: Bearer YOUR_BEARER_TOKEN

--BOUNDARY
Content-Disposition: form-data; name="ManagedContentInputParam"
Content-Type: application/json; charset=UTF-8

{
  "contentSpaceOrFolderId": "0ZuQZ0000004YSv0AM",
  "contentType": "sfdc_cms__customFont",
  "title": "Brand Sans Regular",
  "contentBody": {
    "sfdc_cms:media": {
      "source": {
        "type": "file"
      }
    }
  }
}
--BOUNDARY
Content-Disposition: form-data; name="contentData"; filename="BrandFont.woff2"
Content-Type: font/woff2

<binary font data>
--BOUNDARY--

The API returns 201 Created, and the response body includes metadata about the font content. The response contains the uploaded file's Salesforce record ID in contentBody.sfdc_cms:media.source.ref and a CMS delivery path in contentBody.sfdc_cms:media.url.

Retrieve a Custom Font

To retrieve a Custom Font content item, issue a GET request to the /services/data/{apiVersion}/connect/cms/contents/{contentId} endpoint. Replace {contentId} with the ID of the font content item.

GET /services/data/{apiVersion}/connect/cms/contents/MCYONP3DRPAVGRHJ5HOREVW47SZI HTTP/1.1
Host: {subdomain}.my.salesforce.com
Authorization: Bearer YOUR_BEARER_TOKEN

If the request is successful, the response includes the font source and the content item metadata.

{
  "apiName": "MCYONP3DRPAVGRHJ5HOREVW47SZI",
  "contentBody": {
    "sfdc_cms:media": {
      "source": {
        "fileSize": null,
        "mimeType": null,
        "type": "url",
        "url": "https://fonts.example.com/brand-sans-regular.woff2"
      },
      "url": "https://fonts.example.com/brand-sans-regular.woff2"
    }
  },
  "contentFqn": "marketing--Default_Content_Workspace.sfdc_cms__customFont--MCYONP3DRPAVGRHJ5HOREVW47SZI",
  "contentKey": "MCYONP3DRPAVGRHJ5HOREVW47SZI",
  "contentType": {
    "fullyQualifiedName": "sfdc_cms__customFont",
    "name": "Custom Font"
  },
  "contentVersion": 1,
  "isPublished": false,
  "managedContentId": "20YRZ000000eurV2AQ",
  "managedContentVariantId": "9PsRZ000000e2W90AI",
  "status": {
    "label": "Draft",
    "status": "Draft"
  },
  "title": "Brand Sans WOFF2 Regular",
  "urlName": "brand-sans-woff2-regular",
  "variantVersion": "1.1"
}

For a URL source, contentBody.sfdc_cms:media.url matches the source URL. For a file source, it contains the CMS delivery path. The response also provides the managedContentId that you use to publish the content item.

See Also