POST createEmailTemplate
POST /services/data/{apiVersion}/connect/cms/contents
Operation ID: createEmailTemplate. Tags: Email Template.
Create an email template content item.
Parameters
apiVersion(path, string, required) The API version.
Default:v68.0.
Request body (required)
Media type: application/json. Schema: EmailTemplateRequest.
Example: basicTemplate Basic email template
{
"contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
"contentType": "sfdc_cms__emailTemplate",
"contentBody": {
"sfdc_cms:title": "Welcome Email Template",
"sfdc_cms:description": "Standard welcome email for new customers",
"messagePurpose": "transactional",
"backgroundColor": "#f3f3f3",
"lightning:colorScheme": "{!$brand.colorScheme}",
"lightning:padding": "{!$brand.spacing.none}",
"sfdc_cms:block": {
"type": "block",
"definition": "sfdc_cms/rootContentBlock",
"children": [
{
"type": "block",
"definition": "lightning/section",
"attributes": {
"stackOnMobile": true,
"lightning:colorScheme": "{!$brand.colorScheme}"
},
"children": [
{
"type": "block",
"definition": "lightning/column",
"attributes": {
"columnWidth": 12
},
"children": [
{
"type": "block",
"definition": "lightning/heading",
"attributes": {
"level": 1,
"text": "Welcome to our service!"
}
}
]
}
]
}
]
}
}
}
Responses
- 201
The email template was created successfully.
Media type:
application/json. Schema:EmailTemplateResponse.Example
{ "apiName": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentKey": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentFqn": "marketing--Default_Content_Workspace.sfdc_cms__emailTemplate--MCJUR5WKNRHZFP7NAUQOMMNJ7CI4", "contentSpace": { "id": "0ZuSB000002FYzW0AW", "resourceUrl": "/services/data/v68.0/connect/cms/spaces/0ZuSB000002FYzW0AW" }, "contentType": { "fullyQualifiedName": "sfdc_cms__emailTemplate" }, "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": "Welcome Email Template", "urlName": "welcome-email-template", "versionNumber": "1.0", "contentBody": { "sfdc_cms:title": "Welcome Email Template", "sfdc_cms:description": "Standard welcome email for new customers", "messagePurpose": "transactional", "backgroundColor": "#f3f3f3", "lightning:colorScheme": "{!$brand.colorScheme}", "lightning:padding": "{!$brand.spacing.none}", "sfdc_cms:block": { "type": "block", "definition": "sfdc_cms/rootContentBlock", "children": [ { "type": "block", "definition": "lightning/section", "attributes": { "stackOnMobile": true, "lightning:colorScheme": "{!$brand.colorScheme}" }, "children": [ { "type": "block", "definition": "lightning/column", "attributes": { "columnWidth": 12 }, "children": [ { "type": "block", "definition": "lightning/heading", "attributes": { "level": 1, "text": "Welcome to our service!" } } ] } ] } ] } } } - 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 'messagePurpose' is missing", "details": [ { "field": "contentBody.messagePurpose", "message": "This field is required" } ] }Example: invalidBlockStructure Invalid block structure
{ "error": "VALIDATION_ERROR", "message": "Invalid block structure in template", "details": [ { "field": "contentBody.sfdc_cms:block", "message": "Root block must be of type 'sfdc_cms/rootContentBlock'" } ] } - 401
The authentication credentials are missing or invalid.
Media type:
application/json. Schema:Error.Example
{ "error": "UNAUTHORIZED", "message": "Authentication credentials are missing or invalid" } - 403
The user doesn’t have the permissions required to perform the operation.
Media type:
application/json. Schema:Error.Example
{ "error": "FORBIDDEN", "message": "Insufficient permissions to create email templates" } - 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" } - 503
The service is unavailable.
Media type:
application/json. Schema:Error.Example
{ "error": "SERVICE_UNAVAILABLE", "message": "The service is temporarily unavailable. Please try again later" }