POST Create email content with block-based body
POST /services/data/{apiVersion}/connect/cms/contents
Operation ID: createEmailContent. Tags: Email Content.
Creates an email with a block-based content body structure.
Parameters
apiVersion(path, string, required) The API version.
Default:v68.0.
Request body (required)
Media type: application/json. Schema: EmailContentRequest.
Example: basicEmail Basic email with heading
{
"contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
"contentType": "sfdc_cms__email",
"contentBody": {
"sfdc_cms:title": "Northern Trail Outfitters Campaign",
"sfdc_cms:urlName": "northern-trail-outfitters",
"sfdc_cms:description": "Email campaign for Northern Trail Outfitters.",
"subjectLine": "Serious savings on our biggest selection yet",
"preheader": "It’s time to get out there",
"messagePurpose": "promotional",
"sfdc_cms:block": {
"id": "edf72838-8a6d-4c35-b890-2d3fe7f186fa",
"type": "block",
"definition": "sfdc_cms/rootContentBlock",
"children": [
{
"id": "6748f554-84cc-4b76-8654-14bfc7dbb93e",
"type": "block",
"definition": "lightning/heading",
"attributes": {
"level": 1,
"text": "Save big on gear for your next adventure"
}
}
]
}
}
}
Example: sectionBasedEmail Email with section layout
{
"contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
"contentType": "sfdc_cms__email",
"contentBody": {
"sfdc_cms:title": "Product Launch Email",
"sfdc_cms:urlName": "product-launch",
"sfdc_cms:description": "Product launch email campaign",
"subjectLine": "Introducing our new product line",
"messagePurpose": "promotional",
"sfdc_cms:block": {
"type": "block",
"definition": "sfdc_cms/rootContentBlock",
"children": [
{
"type": "block",
"definition": "lightning/section",
"attributes": {
"stackOnMobile": true,
"lightning:colorScheme": "{!$brand.colorScheme}",
"lightning:padding": "{!$brand.spacing.xSmall}"
},
"children": [
{
"type": "block",
"definition": "lightning/column",
"attributes": {
"columnWidth": 12,
"lightning:verticalAlignment": "top"
},
"children": []
}
]
}
]
}
}
}
Example: rawHtmlEmail Email using raw HTML
{
"contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
"contentType": "sfdc_cms__email",
"contentBody": {
"sfdc_cms:title": "Newsletter Edition 5",
"sfdc_cms:urlName": "newsletter-edition-5",
"sfdc_cms:description": "Weekly newsletter email",
"subjectLine": "Your Weekly Newsletter",
"preheader": "Don't miss out on this week’s highlights",
"messagePurpose": "promotional",
"rawHtml": "<html><body><h1>Welcome!</h1><p>Newsletter content here</p></body></html>",
"textContent": "Welcome! Newsletter content here"
}
}
Example: emailWithImage Email with block-based content and images
{
"contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
"contentType": "sfdc_cms__email",
"contentBody": {
"sfdc_cms:title": "Product Showcase",
"sfdc_cms:urlName": "product-showcase",
"sfdc_cms:description": "Product showcase email with images",
"subjectLine": "Check out our latest products",
"preheader": "New arrivals you'll love",
"messagePurpose": "promotional",
"backgroundColor": "#ffffff",
"sfdc_cms:block": {
"type": "block",
"definition": "sfdc_cms/rootContentBlock",
"children": [
{
"type": "block",
"definition": "lightning/section",
"children": [
{
"type": "block",
"definition": "lightning/column",
"attributes": {
"columnWidth": 12
},
"children": [
{
"type": "block",
"definition": "lightning/image",
"attributes": {
"source": {
"type": "imageReference",
"ref": {
"contentKey": "MCZOCY2AM5PFBADN5UDRB53TLXR4"
}
},
"altText": "Product banner"
}
},
{
"type": "block",
"definition": "lightning/heading",
"attributes": {
"level": 1,
"text": "New Product Line"
}
},
{
"type": "block",
"definition": "lightning/text",
"attributes": {
"text": "Discover our latest collection"
}
},
{
"type": "block",
"definition": "lightning/button",
"attributes": {
"text": "Shop Now",
"href": "https://example.com/shop",
"lightning:variant": "primary"
}
}
]
}
]
}
]
}
}
}
Responses
- 201
The email content was created successfully.
Media type:
application/json. Schema:EmailContentResponse.Example
{ "apiName": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentKey": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentFqn": "marketing--Default_Content_Workspace.sfdc_cms__email--MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentSpace": { "id": "0ZuSB000002FYzW0AW", "resourceUrl": "/services/data/v68.0/connect/cms/spaces/0ZuSB000002FYzW0AW" }, "contentType": { "fullyQualifiedName": "sfdc_cms__email" }, "createdBy": { "id": "005SB00000eaki1YAA", "name": "Admin User", "resourceUrl": "/services/data/v68.0/chatter/users/005SB00000eaki1YAA" }, "createdDate": "2026-06-30T10:30:00.000Z", "externalId": null, "folder": { "id": "9PuSB000002KUDo0AO", "resourceUrl": "/services/data/v68.0/connect/cms/folders/9PuSB000002KUDo0AO" }, "isPublished": false, "language": "en_US", "lastModifiedBy": { "id": "005SB00000eaki1YAA", "name": "Admin User", "resourceUrl": "/services/data/v68.0/chatter/users/005SB00000eaki1YAA" }, "lastModifiedDate": "2026-06-30T10:30:00.000Z", "managedContentId": "20YSB000004SkOz2AK", "managedContentVariantId": "9PsSB0000045XAj0AM", "managedContentVersionId": "5OUSB000004K7np4AC", "status": { "label": "Draft", "status": "Draft" }, "title": "Northern Trail Outfitters Campaign", "urlName": "northern-trail-outfitters-campaign", "versionNumber": "1.0", "contentBody": { "sfdc_cms:title": "Northern Trail Outfitters Campaign", "sfdc_cms:urlName": "northern-trail-outfitters", "sfdc_cms:description": "Email campaign for Northern Trail Outfitters.", "subjectLine": "Serious savings on our biggest selection yet", "preheader": "It's time to get out there", "messagePurpose": "promotional", "sfdc_cms:block": { "type": "block", "definition": "sfdc_cms/rootContentBlock", "children": [ { "type": "block", "definition": "lightning/heading", "attributes": { "level": 1, "text": "Save big on gear for your next adventure" } } ] } } } - 400
The request body or parameters are invalid.
Media type:
application/json. Schema:Error.Example: missingRequiredField Missing required field
{ "error": "VALIDATION_ERROR", "message": "Required field 'subjectLine' is missing", "details": [ { "field": "contentBody.subjectLine", "message": "This field is required" } ] }Example: invalidBlockDefinition Invalid block definition
{ "error": "VALIDATION_ERROR", "message": "Invalid block definition", "details": [ { "field": "contentBody.sfdc_cms:block.children[0].definition", "message": "Block definition 'invalid/block' is not allowed" } ] } - 401
The authentication credentials are missing or invalid.
Media type:
application/json. Schema:Error.Example
{ "error": "UNAUTHORIZED", "message": "Authentication credentials are missing or invalid" } - 500
An unexpected error occurred while processing the request.
Media type:
application/json. Schema:Error.Example
{ "error": "INTERNAL_SERVER_ERROR", "message": "An unexpected error occurred while processing the request" }