Create and Manage Emails in Marketing Cloud Next
Use the CMS Contents endpoints in Connect API to create and manage email content in your marketing content workspace.
Retrieve the ID of the workspace to create the email in. See Manage Content Workspaces.
To create an email using raw HTML content, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents endpoint.
After you create a raw HTML email, you can’t change it to use a component-based structure.
This table lists the properties in the request body.
| Property | Data Type | Description |
|---|---|---|
contentSpaceOrFolderId | string | Required. The ID of the workspace to create the email in. |
contentType | string | Required. The type of content. To create an email, specify sfdc_cms__email. |
contentBody.sfdc_cms:title | string | Required. An identifying name for the email. |
contentBody.subjectLine | string | Required. The email subject line. |
contentBody.preheader | string | Preview text that’s shown after the subject line in some email clients. |
contentBody.messagePurpose | string | The purpose of the email. Possible values are promotional or transactional. |
contentBody.rawHtml | string | Required. The HTML content of the email. |
This sample request shows how to create a basic HTML email.
If the request is successful, the response includes metadata about the email.
The email is created in Draft status. To make it available for use in messages, copy the value of the managedContentId property, and then publish the email.
To create an email that uses components, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents endpoint with an sfdc_cms:block structure.
This table lists the properties in the request body.
| Property | Data Type | Description |
|---|---|---|
contentSpaceOrFolderId | string | Required. The ID of the workspace to create the email in. |
contentType | string | Required. The type of content. To create an email, specify sfdc_cms__email. |
contentBody.sfdc_cms:title | string | Required. An identifying name for the email. |
contentBody.subjectLine | string | Required. The email subject line. |
contentBody.sfdc_cms:block | object | The structure of the component block. Each content node in the block requires a unique ID, such as a UUID. |
To retrieve details of an email, issue a GET request to the /services/data/{apiVersion}/connect/cms/contents/{contentKey} endpoint. Replace {contentKey} with the unique ID or the API name of the email.
If the request is successful, the response includes the email details.
To update an email, use the retrieve endpoint to find the managedContentVariantId of the email. Next, issue a PUT request to the /services/data/{apiVersion}/connect/cms/contents/variants/{variantId} endpoint.
Provide the full contentBody. Fields that aren’t included in the request are cleared. You can’t switch between HTML and component structures during an update.
The email remains in its current status (Draft or Published). To change the status, use the publish or unpublish endpoints.
To create a copy of an email, use the retrieve endpoint to find the contentKey of the email. Next, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents/{contentKey}/clone endpoint.
The cloned email is created in Draft status and includes the same content body fields and structure as the original version.
To delete an email permanently, use the retrieve endpoint to find the managedContentVariantId of the email. Next, issue a DELETE request to the /services/data/{apiVersion}/connect/cms/contents/variants/{variantId} endpoint.
Deleting an email is permanent and can’t be undone.
This sample request shows how to delete an email by providing its variant ID.
A successful deletion returns a 204 No Content response with no response body.
Before you can use an email in messages, you must publish it.