# developer Marketing Cloud Engagement APIs and Programmatic Languages (marketing-cloud) - Full Documentation # 1–99 General | Error | Type | Message | Resolution | | ----- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 1 | Validation | Name already exists | The partner key is already used in the account; use a different partner key. You could also delete the existing item that uses the key value before creating the item. | | 2 | System - General Exception | Exception occurred during [{Operation}] ErrorID: {ErrorID} | This error can occur when there is a SOAP fault during authentication (login has an unexpected exception). Log error information and contact Salesforce Customer Support. | | 3 | Validation - UpdateOptions object | | Ensure the value of the Update action is either "update", "create", or "delete." This error occurs when the update action you specified can’t occur because the object to update doesn’t exist or the information you specified to update doesn’t match the information available on the object. To correct this error, create the object before updating it, if it doesn’t exist. Ensure that the data to be updated on the objects exists. | | 4 | System - GetLoginLocation method | You don't have access to an account with customer key of [CustomerKey]. | Log error information and contact Salesforce Customer Support. | | 5 | Validation | Cannot perform {method} on objects of type {object} | Use the object with an allowed method. | | 6 | Validation | No object specified at 0-based index {index} | Don't pass a Null object into the Objects array on the Create method. | | 8 | | This operation does not support the APIObject of type [type] | | | 9 | System (SOAP Fault) | Member: [member] is In Maintenance. The operation: [operation] is authorized to process or queue while in maintenance however the objects: [objects] are not. Please remove objects from request and try again or resubmit request once the member is out of maintenance state.Member: [member] is not In Maintenance but Member DB: [MemberDB] on Server: [server] could not be accessed. Member request was denied. | Log the message.Queue messages until Marketing Cloud Engagement is out of the maintenance window or use SOAP API in Asynchronous mode. Use the `GetSystemStatus` call to determine when to continue using Marketing Cloud Engagement. | | 10 | System (SOAP Fault) | | Log the message.Queue messages until Marketing Cloud Engagement is running again or use SOAP API in Asynchronous mode. Use the `GetSystemStatus` call to determine when to continue using Marketing Cloud Engagement. | | 11 | Validation (SOAP Fault) | Member: [member] does not have AsyncAPI authorization. Request was denied | Contact Salesforce Customer Support to ensure that the SOAP Web Service API feature is turned on in the account and the account user has the appropriate permissions. | | 12 | Validation (SOAP Fault) | | Check your username and password. | | 13 | System (SOAP Fault) | Synchronous request cannot be completed at this time due to database problems. This request was not processed. | Log the error and contact Salesforce Customer Support. | | 17 | Rate Limited | We noticed an abnormal spike in your call volume so your SOAP Web Service account has been rate limited temporarily. | Verify your current call volume and adjust it to be spread over time. | # 100-199 Perform and Schedule Method | Error | Message | | ----- | ------------------------------------------------------------------------ | | 100 | The Perform method is not supported for the [object] object | | 105 | Perform_Unsupported Object Type | | 106 | Perform_Unsupported Object Type | | 140 | Schedule_Validation Error | | 150 | Schedule_Recurrence_Recurrence Range Type Not Specified | | 151 | Schedule_Recurrence_Start DateTime Not Specified | | 152 | Schedule_Recurrence_End DateTime Not Specified | | 153 | Schedule_Recurrence_Occurrences Not Specified | | 160 | Schedule_DailyRecurrence_Daily Recurrence Pattern Type Not Specified | | 161 | Schedule_DailyRecurrence_Day Interval Not Specified | | 170 | Schedule_WeeklyRecurrence_Weekly Recurrence Pattern Type Not Specified | | 180 | Schedule_MonthlyRecurrence_Monthly Recurrence Pattern Type Not Specified | | 181 | Schedule_MonthlyRecurrence_Monthly Interval Not Specified | | 182 | Schedule_MonthlyRecurrence_Scheduled Day Not Specified | | 183 | Schedule_MonthlyRecurrence_Scheduled Week Not Specified | | 184 | Schedule_MonthlyRecurrence_Scheduled Day Of Week Not Specified | | 190 | Schedule_YearlyRecurrence_Yearly Recurrence Pattern Type Not Specified | | 191 | Schedule_YearlyRecurrence_Scheduled Day Not Specified | | 192 | Schedule_YearlyRecurrence_Scheduled Day Of Week Not Specified | | 193 | Schedule_YearlyRecurrence_Scheduled Week Not Specified | | 194 | Schedule_YearlyRecurrence_Scheduled Month Not Specified | # 1000-1999 Account Object | Error | Message | | ----- | ------- | | 1000 | Account Invalid Permissions | | 1001 | User Invalid Permissions | | 1002 | Business Rule Invalid Permissions | | 1003 | Subscription Invalid Permissions | | 1004 | Private Label Invalid Permissions | | 1005 | Account Required Fields Not Specified | | 1006 | Account Subscription Required Fields Not Specified | | 1007 | Account Private Label Required Fields Not Specified | | 1008 | Account Private Label ID Invalid | | 1009 | Account Invalid ID Specified | | 1010 | Account Subscription Required | | 1011 | Account No Parent ID For Account Type | | 1012 | Account Invalid Permissions To Set Field | | 1013 | Account Inherit Address Not Valid | | 1014 | Account In Read only State | | 1015 | Account External Key Invalid | | 1016 | Account Invalid Status | | 1017 | Invalid Account Type For Operation | | 1018 | Sender Profile Synch Failed | # 108000-108999 SMS Member Short Code | Error | Message | | ----- | ------- | | 108000 | SMS Member Short Code Already Exists | | 108001 | SMS Member Short Code Does Not Exist | | 108002 | SMS Member Short Code Missing Short Code | # 11000-11999 AccountUser Object | Error | Message | | ----- | ------- | | 11000 | AccountUser Client ID Not Specified | | 11001 | AccountUser Invalid Permissions | | 11002 | AccountUser Does Not Belong to Account | | 11003 | AccountUser Required Fields Not Specified | | 11004 | AccountUser Limit Reached | | 11005 | AccountUser Min Password Length Violation | | 11006 | AccountUser Password Complexity Violation | | 11007 | AccountUser Password Contains Username | | 11008 | AccountUser Password History Violation | | 11009 | AccountUser Name Required | | 11010 | AccountUser Email Required | | 11011 | AccountUser Email Not Valid | | 11012 | AccountUser Notification Email Not Valid | | 11013 | AccountUser User ID Min Length Violation | | 11014 | AccountUser User ID Not Available | | 11015 | AccountUser Security Question Cannot Contain User ID | | 11016 | AccountUser Security Answer Cannot Contain User ID | | 11017 | AccountUser Security Question Cannot Contain Password | | 11018 | AccountUser Invalid Old Password | | 11019 | AccountUser Customer Key Exists | # 110000-110999 SMS Member Shared Short Code | Error | Message | | ----- | ------- | | 110000 | SMS Member Shared Short Code Already Exists | | 110001 | SMS Member Shared Short Code Does Not Exist | | 110002 | SMS Member Shared Short Code Missing Short Code | | 110003 | SMS Member Shared Short Code Missing Shared Keyword | | 110004 | SMS Member Shared Short Code Short Code Does Not Exist | | 110005 | SMS Member Shared Short Code Need Shared Short Code | | 110006 | SMS Member Shared Short Code Shared Keyword Blacklisted | # 111000-111999 Publication | Error | Message | | ----- | ------- | | 111000 | Publication Invalid Name Error | | 111001 | Publication Name Already Exists Error | # 12000–12099 Subscriber Object | Error | Message | Resolution | | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 12000 | InvalidEmailAddress | This error occurs when you import an email address that does not use the correct syntax: username@domain.extension. Correct or discard the email address before importing the list. | | 12001 | SubscriberNotFound | This error occurs when the call attempts to act on a subscriber that doesn't exist. This may occur because the subscriber has not yet been imported or because the call is attempted to act on the wrong subscriber. Import the subscriber if the call is attempting to act on the correct subscriber. Correct the subscriber that the call is attempting to act on if the call is attempting to act on the wrong subscriber. | | 12002 | TriggeredSpamFilter | This error occurs when you attempt to import an email address that is a known spam trap. Discard the email address before importing the list. | | 12003 | OnGlobalUnsubList | This error occurs when you attempt to import an email address that appears on the global unsubscribe list. Discard the email address before importing the list. | | 12004 | InvalidDPV | This error occurs when you attempt to update a subscriber attribute with an invalid value, for example, when attempting to update a subscriber date of birth attribute with their street address. Consult the valid entries for the attribute to determine what values you can enter. | | 12005 | InvalidChannelMemberID | | | 12006 | MissingRequiredDPV | This error occurs when you attempt to create or import a subscriber without a value for a required attribute. For example, if you require the first name of every subscriber, you receive this error when attempting to create or import a subscriber without providing the first name value. Include the required values in the subscriber record before importing. Alternatively, you can change the attribute on the subscriber to be optional. | | 12007 | EmailAddressAlreadyExists | This error occurs when you attempt to create or import a subscriber using an email address that already exists. This error occurs only if you don't use Subscriber Key values to identify subscribers. Discard the duplicate address before importing. Alternatively, you can change the call to update existing subscribers with the new information rather than attempting to create new subscribers. | | 12008 | MasterUnsubFailed | | | 12009 | UnsubscribeError | This error occurs when you attempt to unsubscribe a subscriber from a list that does not contain the subscriber. Check the validity of the email address and ensure that you are attempting to unsubscribe from the correct list. | | 12010 | SubscribeError | | | 12011 | InvalidDPVs | | | 12012 | The subscriber has already been master unsubscribed from the system | | | 12013 | MissingMasterUnsubInfo | | | 12014 | SubscriberAlreadyExists | | | 12015 | Subscriber Key Not Found | | | 12016 | Subscriber.Status: when creating a subscriber the status cannot be "Bounced"Subscriber.Status: when creating a subscriber the status cannot be "Deleted" | | | 12017 | Invalid Subscriber Type | | | 12018 | Resubscribe Failed | | | 12019 | Invalid OYB Account | | | 12020 | OYB Access Error | | | 12021 | Subscriber Key Does Not Match Customer Key | | | 12022 | Subscriber Address Does Not Match Error | | | 12023 | Invalid Phone Number | | | 12024 | Invalid Subscriber Address | | | 12025 | SMS Unsupported | | # 13000-13099 List Object | Error | Message | Resolution | | ----- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- | | 13000 | List Not Found | Ensure your call includes the correct ListID for the list you wish to access. | | 13001 | List ID Not Specified | Ensure your call includes the correct ListID for the list you wish to access | | 13002 | Exception During Delete | Review the error information provided by the exception and resolve the issue before attempting another deletion. | | 13003 | Salesforce Not Enabled | Ensure that your account includes a properly configured Salesforce integration. | | 13004 | Unknown List ID | Ensure your call includes the correct ListID for the list you wish to access. | | 13005 | List Subscriber Error | Ensure that you correctly included all relevant subscriber information. | | 13006 | On List Already | You can’t add a subscriber to the same list twice. | | 13007 | Not On List | Ensure that you correctly included all relevant subscriber information. | | 13008 | Salesforce List Not Allowed | Ensure the list you selected does not use the Salesforce integration. | | 13009 | List Category Invalid | Ensure that you provide valid category information for this list. | | 13010 | List Name Too Long | Ensure that your list name does not exceed 50 characters. | | 13011 | Multiple master lists returned | Ensure that you reference the correct master list for your account. Ids are (ID, OID, Key). | | 13012 | List can’t Be Updated | You can’t make updates to the selected list. Ensure that you reference the correct list in your call. | | 13013 | List Validation Error | Ensure that the selected list meets the validation standards for sends. | | 13014 | Invalid List Status | Ensure that your call includes a valid status for the specified list | # 14000-14099 Subscriber Validation | Error | Message | | ----- | ------------------------------------------- | | 14000 | List Detective Category Validation Error | | 14001 | List Detective Category Create Error | | 14002 | List Detective Category Update Error | | 14003 | List Detective Category Delete Error | | 14004 | List Detective Category Not Found | | 14005 | List Detective Category Name Cannot Be Null | | 14010 | List Detective Domain Validation Error | | 14011 | List Detective Domain Create Error | | 14012 | List Detective Domain Update Error | | 14013 | List Detective Domain Delete Error | | 14014 | List Detective Domain Not Found | | 14015 | List Detective Domain Cannot Be Null | | 14020 | List Detective Member Validation Error | | 14021 | List Detective Member Create Error | | 14022 | List Detective Member Update Error | | 14023 | List Detective Member Delete Error | | 14024 | List Detective Member Delete Error | | 14030 | List Detective User Name Validation Error | | 14031 | List Detective Username Create Error | | 14032 | ListDetective Username Update Error | | 14033 | List Detective Username Delete Error | | 14034 | List Detective Username Not Found | | 14035 | List Detective Username ID Cannot Be Null | | 14040 | List Detective Client ID Cannot Be Null | # 17000-17999 TriggeredSendDefinition Object | Error | Type | Message | | ----- | ---- | ------- | | 17000 | System | Triggered Send Definition Cannot Be Activated | | 17001 | System | Triggered Send Definition Cannot Be Canceled | | 17002 | System | Triggered Send Definition Cannot Be Deactivated | | 17003 | System | Triggered Send Definition Cannot Be Updated | | 17004 | System | Triggered Send Definition Cannot Be Deleted | | 17005 | System | Triggered Send Definition Content Cannot Be Refreshed | | 17010 | Validation | Triggered Send Definition Object ID or Customer Key Not Found | | 17011 | Validation | Triggered Send Type Not Found | | 17012 | Validation | Triggered Send Definiton Object ID Found | | 17013 | Validation | Triggered Send Definition Email ID or Partner Key Not Found | | 17014 | Validation | Triggered Send Definition Send Classification Not Found | | 17015 | Validation | Triggered Send Definition Not Found | | 17016 | Validation | Triggered Send Definition Email Not Found | | 17017 | Validation | Triggered Send Definition List Not Found | | 17018 | Validation | Triggered Send Definition Header Content Not Found | | 17019 | Validation | Triggered Send Definition Footer Content Not Found | | 17020 | Validation | Triggered Send Definition From Name Not Found | | 17021 | Validation | Triggered Send Definition From Address Not Found | | 17022 | Validation | Triggered Send Definition List Required | | 17023 | Validation | Triggered Send Definition Auto Add or Auto Update Not Found | | 17024 | Validation | Triggered Send Definition Delivery Profile Header Content Not Found | | 17025 | Validation | Triggered Send Definition Delivery Profile Footer Content Not Found | | 17100 | Validation | Triggered Send Definition Customer Key Invalid | | 17101 | Validation | Triggered Send Definition Name Invalid | | 17102 | Validation | Triggered Send Definition Email Subject Invalid | | 17103 | Validation | Triggered Send Definition Email Partner Key Invalid | | 17104 | Validation | Triggered Send Definition List Partner Key Invalid | | 17105 | Validation | Triggered Send Definition From Name Invalid | | 17106 | Validation | Triggered Send Definition From Address Invalid | | 17107 | Validation | Triggered Send Definition Keyword Invalid | | 17108 | Validation | Triggered Send Definition BCC Email Invalid | | 17110 | Validation | Triggered Send Definition Dynamic Email Subject Invalid | | 17111 | Validation | Triggered Send Definition Email Invalid | | 17112 | Validation | Invalid Personalization String | | 17113 | Validation | Triggered Send Definition Send Window Open Invalid | | 17114 | Validation | Triggered Send Definition Send Window Close Invalid | | 17200 | Validation | Send Speed Governor Not Enabled | | 17201 | Validation | BCC Email Not Enabled | | 17203 | Validation | Multipart MIME Not Enabled | | 17204 | Validation | Dynamic Content Not Enabled | | 17205 | Validation | All Subscribers Access Not Enabled | # 18000–18999 | Error | Type | Message | Resolution | | ------ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 18000 | Validation | Triggered Send Object not found | Make sure that you’re passing a `TriggeredSend` object in the API call. | | 18001 | Validation | The Triggered Send Definition is not completely configured or in a new status | Complete the configuration of the Triggered Send Definition or start the Triggered SendDefinition. | | 18002 | Validation | | | | 18003 | System | Exception occurred during [CreateTriggeredSend] | Contact Salesforce Customer Support. | | 18004 | System | Exception occurred during [CreateTriggeredSend] | Contact Salesforce Customer Support. | | 18005 | System | Exception occurred during [CreateTriggeredSend] | Contact Salesforce Customer Support. | | 18006 | Validation or System | | | | 180007 | Validation | The Triggered Send Object must have subscribers associated with it | Add one or many Subscribers to the TriggeredSend object. | | 180008 | Validation | | | | 180015 | Validation | Triggered Send Data Extension is missing or misconfigured | Modify the triggered send definition to point to an existing triggered send data extension. | # 200–299 Asynchronous Operation | Error | Message | Resolution | | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `200` | CallsInConversation don’t match previous value in the Conversation. Conversation has been invalidated. | A conversation part has a `CallsInConversation` value that doesn’t match the value specified in the first conversation part. Use the same `CallsInConversation` value in all conversation parts. The value must equal the total number of conversation parts for the conversation. | | `201` | Async API Collection Total Mismatch. | ― | | `202` | Missing Required Conversation Property SequenceCode. ConversationID, SequenceCode, and CallsInConversation are required for Conversations Requests. | The request specifies a value for `Options.CallsInConversation`, but doesn’t include the `Options.SequenceCode` property. `Options.SequenceCode` and `Options.CallsInConversation` both default to `1` when neither is specified. | | `203` | Async API Timeout. | The conversation context timed out. Ensure that you’re using a current and correct conversation ID in your calls. | | `204` | Async API Error. | The object being created, updated, or deleted failed validation. Check the object syntax and structure in your code. | | `205` | SequenceCode Out Of Bounds. Valid SequenceCode range is 1 to the value of CallsInConversation. | The `SequenceCode` denotes the sequential order to process the conversation parts. Set `SequenceCode` to an integer greater than or equal to 1 and less than or equal to the value of `CallsInConversation`. | | `206` | CallsInConversation Out Of Bounds. CallsInConversation is expected to be a positive number. | Set `Options.CallsInConversation` to an integer greater than or equal to 1. | | `207` | Missing Required Conversation Property ConversationID. ConversationID, SequenceCode, and CallsInConversation are required for Conversations Requests. | `ConversationID` isn’t specified in the `Options` object or its value is null. If the request specifies values for the `SequenceCode` and `CallsInConversation` properties, it must also include a unique value for `ConversationID`. Set `Options.ConversationID` to a non-null string value. | | `208` | Missing Required Conversation Property CallsInConversation. ConversationID, SequenceCode, and CallsInConversation are required for Conversations Requests. | `CallsInConversation` hasn’t been specified in the `Options` object for the request. `CallsInConversation` is a required property for conversation requests that specify a `SequenceCode`, `ConversationID`, and that have a `RequestType` value of `Asynchronous`. If you didn’t specify a `SequenceCode` in the request, then `CallsInConversation` isn’t required. If you don’t provide values for `SequenceCode` and `CallsInConversation`, they both default to 1 and the request is interpreted as a single-part conversation. For multi-part conversations, you must specify a `CallsInConversation` value that’s greater than or equal to 1, and that equals the total number of conversation parts. | | `209` | Options.RequestType is required to be set to RequestType.Asynchronous. | Set `Options.RequestType` to `Asynchronous`. | | `211` | Invalid ConversationID. ConversationID has already been used. | Conversation IDs can’t be reused. This error is returned when a `ConversationID` is reused. It can occur even when the conversations associated with the ID have timed out or produced an error. If the conversation has multiple parts, then each part must use the same `ConversationID`. Set the value of `ConversationID` to a unique value for each set of conversations. | | `212` | Invalid Conversation. | This general error indicates an unspecified problem with a conversation. The conversation doesn’t have a status of `Closed`, `Processing`, `Error`, `Complete`, or `Timeout`. Contact Global Support for help. | | `213` | Conversation is in an error state and is no longer able to accept conversation parts. | When a conversation is in an error state, all conversation parts for its `ConversationID` return this message. Closing the conversation results in an error. Review the previous responses, locate the error, fix it, and then resubmit the entire conversation with a new `ConversationID`. | | `214` | SequenceCode already used for Conversation. Conversation has been invalidated. | `SequenceCodes` within a conversation are unique. After a conversation part has been accepted with a particular `SequenceCode`, that value can’t be repeated in the conversation. This error results in the conversation being in an error state. Set `Options.SequenceCodes` in all conversation parts to sequential values. The first conversation part must have a `SequenceCode` value of 1, and the last part must equal the value of `CallsInConversation`. Resubmit the entire conversation with a new `ConversationID`. | | `215` | Conversation is closed and cannot accept more parts. | Conversations are closed and ready for processing when all parts have been received. After a conversation is closed, no new parts are accepted. When you receive this error, you don’t need to do anything unless you intended for the rejected conversation part to be part of the closed conversation. | | `218` | Too many objects. | Limit the number of API objects in each request. For more information, see [API Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits_api.htm). | | `226` | A request may not have ScheduledTime greater than 30 days from now. | Schedule conversation and non-conversation messages 30 days in the future or fewer. | | `227` | An unsecure response address specified in the SendResponseTo parameter. | Unsecured HTTP endpoints aren't supported. Use an HTTPS endpoint for HTTP callbacks. | | `228` | A request cannot have a request expiration time before the current time. | Set the `RequestExpirationTime` to a later time so that the request can be added to the processing queue before it expires. | | `229` | A request cannot have a request expiration time before the scheduled time. | Set the `RequestExpirationTime` to occur after the `ScheduledTime`. | | `230` | Request Expired, expired time was 01/31/2024 12:01:00 UTC request start time was 01/31/2024 12:02:00 UTC. | Set the `RequestExpirationTime` to a later time. | | `231` | A request with an expiration time requires a time zone offset. | Set the `RequestExpirationTime` in UTC or with a time zone offset. | | `232` | A request with an expiration time requires Scheduled Time to have a time zone offset. | When a request includes a `RequestExpirationTime` and a `ScheduledTime`, you must specify the time zone offset for `ScheduledTime`. | | `233` | A request with expiration time does not support multi-part conversation. | Remove the `Options.RequestExpirationTime` property, or send the request as a single-part conversation. | # 20000-20099 SalesforceSend Object | Error | Message | | ----- | ------- | | 20001 | Salesforce Send Unknown Email | | 20002 | Salesforce Send Member Not Set Up | | 20003 | Salesforce Send No Targets | | 20004 | Salesforce Send Invalid Target | | 20005 | Salesforce Send Invalid Exclusion | | 20006 | Salesforce Send Invalid Email ID | | 20007 | Salesforce Send Save Error | | 20008 | Salesforce Send No Email Specified | # 21000-21099 ContentArea Object | Error | Message | | ----- | ------------------------------------------------- | | 21000 | Saved ContentArea General Error | | 21001 | Saved ContentAreaInvalid Category Error | | 21002 | Saved ContentAreaName Not Valid Error | | 21003 | Saved ContentAreaNo HTML Content Error | | 21004 | Saved ContentAreaNo Dynamic Content XML Error | | 21005 | Saved ContentAreaNo Dynamic Content Default Error | | 21006 | Saved ContentAreaCreate Error | # 24000-24999 SendClassification Object | Error | Message | | ----- | ------- | | 24000 | SC_SendClassification Not Specified | | 24100 | SC_SendClassificationNot Found | | 24101 | SC_Sender Profile Not Found | | 24102 | SC_Delivery Profile Not Found | | 24103 | SC_Customer Key Invalid | | 24104 | SC_Name Invalid | | 24105 | SC_Burst Sending Not Configured | # 302000-302999 Template | Error | Message | | ----- | ------- | | 302000 | Template Already Exists | | 302001 | Template Header Content CustomerKey ObjectID Invalid | | 302002 | Template Header ContentID, ObjectID, or CustomerKeyRequired | | 302003 | Template HTML Required | | 302004 | TemplateID or ObjectID Required | | 302005 | TemplateLayoutID Required | | 302006 | Template Name Required | | 302007 | Template Not Found | | 302008 | Template Layout Not Found | | 302009 | Template Category Not Found | | 302010 | Template Category Invalid | | 302011 | Template CustomerKey Error | # 303000-303999 Filter Activity | Error | Message | | ----- | ------- | | 303000 | Filter Activity General Error | | 303001 | Filter Activity Instance Not Created | | 303002 | Filter Activity Not Found | | 303003 | Filter Activity Instance Did Not Run | # 31000-31999 ExtractRequest Object | Error | Message | | ----- | ------- | | 31000 | Extract Invalid ID | | 31001 | Extract Unknown ID | | 31002 | User does not have access to the Extract ID | | 31003 | ExtractNo Data Extract BR | | 31004 | ExtractNo Enhanced FTP BR | | 31005 | ExtractInvalid Parameter Name | | 31006 | Missing required parameter: [parameter] | | 31007 | Parameter [parameter] has an invalid value of [value] for parameter of type: [type] | | 31008 | Input file not found: [file] for parameter: [parameter] | | 31009 | No file path available | # 310000-310099 DataExtension Object | Error | Message | Resolution | | ------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 310001 | DataExtensionStubValidationErrorNoKeyFound | You receive this error code if you don't provide any of the following three values: ObjectID, CustomerKey, Name. These three values are unique for a data extension for a memberID. | | 310002 | DataExtensionProcessValidationErrorDeleteObjectNotFound | You supplied no valid keys and the object was not found for a delete operation. | | 310003 | DataExtensionProcessValidationErrorUpdateNotAllowed | You requested an add-only operation, but the keys provided matched an existing data extension. | | 310004 | DataExtensionProcessValidationErrorAddNotAllowed | You requested an update-only operation, but the keys provided did not match an existing data extension. | | 310005 | DataExtensionProcessValidationErrorAddWithObjectID - InvalidEmailAddress | You requested an add-only operation but also provided an ObjectID. ObjectID is generated by the system and can’t be specified by the caller. | | 310006 | DataExtensionProcessingError - InvalidEmailAddress | A data validation error occurred when trying to save a data extension. The status message might contain more details on the field that caused the error. | | 310007 | DataExtensionValidationError | This error occurs when data provided for the data extension is not valid. The error message includes more information about the invalid data, and you can change or remove that data to eliminate the source of the error. | # 32000-32099 VoiceTriggeredSend Object | Error | Message | | ----- | ------- | | 32000 | Missing VoiceTriggeredSend Definiton | | 32001 | Voice Only One Subscriber Supported | | 32002 | Voice Error | # 33000-33999 SMSTriggeredSend Object **note:** Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.: | Error | Type | Message | Resolution | | ----- | ----------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 33000 | Client Validation Error | You must include a SMS Triggered Send Definition | Include a SMS triggered send definition in your API call. | | 33001 | Client Validation Error | You must include a valid SMS Triggered Send Definition | Check to make sure the SMS triggered send definition you wish to use exists. | | 33002 | Client Validation Error | You must include a customer key on the SMS Triggered Send Definition | Include a valid customer key in the SMS triggered send definition. | | 33003 | Client Validation Error | SMSTrigSend_Client Error_Message Missing | Enter a valid message for the send. | | 33004 | Client Validation Error | The message is too long. | Shorten message to accepted SMS standards. | | 33005 | Client Validation Error | Invalid characters in message | Remove invalid characters in message. | | 33006 | Client Validation Error | From address '{0}' Not Found | | | 33100 | Client Validation Single Send Error | Single sends must include a subscriber | Add a valid subscriber to the send. | | 33101 | Client Validation Single Send Error | This subscriber does not currently exist, you must include a mobile number | Include a valid mobile number in your send. | | 33102 | Client Validation Single Send Error | Mobile number does not comply with NANPA | Resolve any error with the phone numbers associated with the send. | | 33300 | Subscriber Opt Out Error | This subscriber has opted out of receiving messages | Remove the subscriber from the send. | | 33301 | Subscriber Opt Out Error | This subscriber has globally opted out of receiving messages | Remove the subscriber from the send. | | 33302 | Subscriber Opt Out Error | SMSTrigSend_Subscriber_InvalidBlackoutTime | | | 33303 | Subscriber Opt Out Error | SMSTrigSend_Subscriber_InvalidBlackoutTimeZone | | | 33500 | Critical Error | Unknown SMS Triggered Send Type | Correct the configuration of the SMS triggered send definition | | 33501 | Critical Error | Critical Error contact your support representative | Contact Global Support- the error has been logged. | | 33502 | Critical Error | Critical Error unable to send message | Contact Global Support- the error has been logged. | | 33503 | Critical Error | Critical Error contact your support representative | The application can’t create the send job. Contact Global Support- the error has been logged. | | 33504 | Critical Error | Critical Error contact your support representative | The application can’t create a new subscriber. Contact Global Support- the error has been logged. | # 332000-332999 Role Validation | Error | Message | | ----- | ------- | | 332000 | Role Invalid ID | | 332001 | Role Invalid Action | | 332002 | Role Invalid Object | | 332003 | Role Invalid Data | | 332004 | Role Permission Denied | # 333000-333999 FeatureConfig Validation Codes | Error | Message | | ----- | ------- | | 333000 | Feature Config Invalid ID | | 333001 | Feature Config Invalid Action | # 346000-346999 SMS Shared Short Code | Error | Message | | ----- | ------- | | 346001 | SMSSharedKeyword may not be null; value is required | | 346002 | SMSSharedKeyword may not be null; value is required | | 346003 | SMS Shared Keyword Keyword Cannot be Requested | | 346004 | SMS Shared Keyword Keyword Blocklisted | | 346005 | ShortCode you have specified is either not a Shared ShortCode or you don't own this Shared ShortCode | # 350000-350999 Content Validation | Error | Message | | ----- | ------- | | 350000 | Unable to create validation task | | 350001 | Unknown validation type supplied: [type] | | 350002 | A valid Email object was not supplied | | 350003 | Content Validation Send Creation Failed | | 350004 | Content Validation Send Job Failed | | 350005 | No valid subscribers were supplied | | 350006 | All tasks did not complete before maximum time allowed | | 350007 | Account does not have access to Spam Assassin validation feature | # 355000-355999 Program | Error | Message | | ----- | ------- | | 355000 | Program ObjectID Required | | 355001 | Program Invalid ObjectID | | 355002 | Program Activity Perform | | 355003 | Program Creation Error | | 355004 | Program Access Denied | | 355005 | Program Delete Error | | 355006 | Program Not Found | | 355007 | Either ObjectID or CustomerKey is required. Both are empty. | # 373000-373999 FilterDefinition Object Error Codes | Error | Message | | ----- | ------- | | 373000 | Filter definition create calls cannot specify the ObjectID property | | 373001 | Either object ID or customer key is required for the DataSource if the DataSource is a data extension | | 373002 | The data extension specified as DataSource was not found | | 373003 | Filter definition name is required for Create calls | | 373004 | Filter definition name already exists. Please specify a unique name | | 373005 | Filter definition customer key already exists. Please specify a unique customer key | | 373006 | Either object ID or customer key is required to perform an update | | 373007 | Filter definition was not found using either the ID or the name | | 373008 | DataFilter is required for Create calls | | 373009 | The DataFilter that was provided is invalid | | 373010 | The type for [object] does not allow the operation specified: [operation] | | 373011 | The property provided could not be found: [property] | | 373012 | Invalid filter part. Only filter parts of ComplexFilterPart and SimpleFilterPart are allowed for filter definitions | # 380000-380999 SMS MT Configuration | Error | Message | | ----- | ------- | | 380000 | SMS MT Configuration Not Found | | 380001 | SMS MT Configuration Cannot Add Duplicate | | 380002 | SMS MT Configuration Sender Code Required | | 380003 | SMS MT Configuration Vendor Required | | 380004 | SMS MT Configuration Country Code Required | | 380005 | SMS MT Configuration Vendor Resource Specification Required | # 388000-389999 TimeZone and Locale Objects | Error | Message | | ----- | ------- | | 388000 | An invalid LocaleCode was supplied | | 388001 | An invalid ID was supplied | | 389000 | An invalid ID was supplied | | 389001 | Time Zone Invalid Abbreviation | | 389002 | An invalid Name was supplied | # 396000-396999 Data Folder | Error | Message | | ----- | ------- | | 396000 | No ListAttribute objects found | | 396001 | Data Folder Invalid Call | | 396002 | Data Folder Customer Key Exists | | 396003 | Data Folder Name Required | | 396004 | Data Folder Content Type Required | | 396005 | Data Folder Content Type Invalid | | 396006 | Data Folder Inactive | | 396007 | Data Folder Invalid Parent | | 396008 | Data Folder Key Field Required | | 396009 | Data Folder Key Field Invalid | | 396010 | Data Folder Description Required | | 396011 | Data Folder Only Owner Can Move To From Shared Parent | | 396012 | Data Folder Name Invalid | # 400-499 Subscription Validation | Error | Message | | ----- | ------- | | 400 | The subscriber could not be found on the specified JobID | | 401 | The subscriber is already unsubscribed from the specified list | | 402 | The Parameters array did not contain any values or did not contain any of the Parameters we were looking for | | 403 | The EmailAddress, SubscriberKey and SubscriberID parameters were not specified or they were empty | | 404 | The SubscriberKey permission is turned on but only EmailAddress was provided. You MUST supply SubscriberKey and/or SubscriberID | | 405 | You supplied SubscriberID along with SubscriberKey and/or EmailAddress. These values refer to different subscribers | | 406 | You supplied SubscriberKey along with SubscriberID and/or EmailAddress. These values refer to different subscribers | | 407 | You supplied EmailAddress along with SubscriberID and/or SubscriberKey. These values refer to different subscribers | | 408 | SubscriberNullOrEmpty | | 409 | SubscriberListNullOrEmpty | # 4000-4099 Email Object | Error | Message | | ----- | ------- | | 4000 | PersonList.AutomatedEmail: the Email identitfied by CustomerKey could not be found | | 4001 | Email Does Not Exist | | 4002 | Email Category ID Invalid | | 4003 | Email ID Not Specified | | 4004 | Email Invalid | # 40000-40999 SenderProfile Object | Error | Message | | ----- | ------- | | 40000 | SP_Sender Profile Not Specified | | 40100 | SP_Sender Profile Not Found | | 40101 | SP_From Name Not Specified | | 40102 | SP_From Address Not Specified | | 40103 | SP_Customer Key Invalid | | 40104 | SP_Name Invalid | | 40105 | SP_From Name Invalid | | 40106 | SP_From Address Invalid | | 40200 | SP_Reply Mail Management Business Rule Not Found | | 40201 | SP_AutoForward Email Address Invalid | | 40202 | SP_AutoForward From Name Invalid | | 40203 | SP_AutoReplay Triggered Send Not Found | | 40204 | SP_Sender Header Email Address Invalid | | 40205 | Sender Header From Name Invalid | | 40206 | SP_SENDER_HEADER Business Rule Not Found | | 40207 | SP_RMManagement Rule Set Not Found | # 402000-402999 Reply Mail Management Configuration Error Codes | Error | Message | Resolution | | ----- | ------- | ---------- | | 402000 | Reply Mail Management is not activated in your account until the MX Record Redirect Complete is marked as True | Update your MX Record and Set DNSRedirectComplete to True. | | 402001 | To activate Reply Mail Management Email Reply Name must be complete | | | 402002 | To activate Reply Mail Management Reply Subdomain must be complete | | | 402003 | Email reply address subdomain value has to be same with reply subdomain value | | | 402004 | To activate Reply Mail Management Email From Address must be complete | | | 402005 | Please enter valid Email Reply Address | | | 402006 | To activate Reply Mail Management Forwarding Email Address must be complete | | | 402007 | Please enter valid Forwarding Email Address | | | 402008 | Reply Mail Management Business rule not enabled | | | 402009 | You need to set true for at least one of the Unsubscribe terms | | # 408000-408999 Navigation Tab | Error | Message | | ----- | ------- | | 408001 | Navigation Tab Not Found | | 408002 | Navigation Tab Invalid | | 408003 | Navigation Tab Need ObjectID or Customer Key | # 409000-409999 Audience Builder | Error | Message | | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 409001 | AddEntityHistory: [AddEntityHistory] could not be inserted due to unknown error in repository. Inner exception: [InnerException] | | 409002 | GetFilterSQL: [GetFilterSQL] could not get filter SQL. Inner exception: [InnerException] | | 409003 | CreateSingle: No objects found, APIObject was null or not of type AudienceDefinition. Type was [type] | | 409004 | CreateSingle: Name missing on {0}. This is a required field | | 409005 | CreateSingle: CustomerKey missing on {0}. This is a required field | | 409006 | Audience Builder Create Single Null Audience Code | | 409007 | CreateSingle: {0} already exists for this Name [name] | | 409008 | CreateSingle: {0} already exists for this CustomerKey [CustomerKey] | | 409009 | Audience Builder Create Single Audience Code Already Defined | | 409010 | CreateSingle: [object] could not be created due to unknown error in repository. Inner exception: [exception] | | 409011 | UpdateSingle: No objects found, APIObject was null or not of type AudienceDefinition. Type was [type] | | 409012 | Audience Builder Update Single No Audience ID | | 409013 | Audience Builder Update Single Audience Definition Not Found | | 409014 | Audience Builder Update Single Segment Code Exists | | 409015 | Audience Builder Single Audience Code Exists | | 409016 | UpdateSingle: [object] could not be updated due to unknown error in repository. Inner exception: [exception] | | 409017 | UpdateSingle: [object] could not be updated due to unknown error in repository. Inner exception: [exception] | | 409018 | UpdateSingle: [object] could not be found for update, ID [ID] | | 409019 | DeleteSingle: No objects found, APIObject was null or not of type AudienceDefinition. Type was [type] | | 409020 | DeleteSingle: [object] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409021 | Audience Builder Delete Single Null Audience Definition | | 409022 | Audience Builder Delete Single Child Audience Segments | | 409023 | Audience Builder Delete Single Filter Definition Exception | | 409024 | DeleteSingle: [object] could not be deleted due to unknown error in repository. Inner exception: [exception] | | 409025 | Audience Builder Clone Audience ID Not Specified | | 409026 | CreateSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409027 | CreateSingle: AudienceDefinitionID missing on [object]. Make sure you are setting AudienceDefinitionIDSpecified=true | | 409028 | CreateSingle: SegmentDefinitionID missing on [object]. Make sure you are setting SegmentDefinitionIDSpecified=true | | 409029 | CreateSingle: SegmentCode is missing on [object]. Make sure you set a unique SegmentCode | | 409030 | CreateSingle: FK AudienceDefinitionID does not exsit in table [table] | | 409031 | CreateSingle: SegmentCode [code] already exists on another [segment]. SegmentCode must be unique | | 409032 | | | 409033 | Audience Builder Create Single Segment Code Exists | | 409034 | CreateSingle: [object] could not be created due to unknown error in repository. Inner exception: [exception] | | 409035 | UpdateSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409036 | UpdateSingle: [segment] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409037 | UpdateSingle: [definition] could not be found for update, ID [ID] | | 409038 | UpdateSingle: Trying to update FK SegmentDefinitionID and it does not exsit in table [table] | | 409039 | UpdateSingle: Trying to update FK SegmentDefinitionID and already exsits in table [table]. Segment is already part of this Audience | | 409040 | UpdateSingle: SegmentCode [SegmentCode] already exists on another [segment]. SegmentCode must be unique | | 409041 | DeleteSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409042 | DeleteSingle: [object] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409043 | DeleteSingle: [object] with ID [ID] could not be found | | 409044 | DeleteSingle: [object] could not be deleted due to unknown error in repository. Inner exception: [exception] | | 409045 | CreateSingle: No [type]objects found, APIObject was null or not of type [type]. Type was [type]. | | 409046 | CreateSingle: Name missing on [object] | | 409047 | CreateSingle: CustomerKey missing on [object] | | 409048 | CreateSingle: [object] already exists for this Name [name] | | 409049 | CreateSingle: [object]already exists for this CustomerKey [name] | | 409050 | UpdateSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409051 | UpdateSingle: [object] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409052 | UpdateSingle: [object] with ID [ID] could not be found | | 409053 | UpdateSingle: Name [name] already exists on another [object]. Name must be unique | | 409054 | DeleteSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409055 | DeleteSingle: [object] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409056 | DeleteSingle: [object] with ID [ID] could not be found | | 409057 | Deleting [object] had some issues deleting child AudienceSegmentDefinition rows. [object] with ID [ID] could be in an invalid state. Error message: [message] | | 409058 | Deleting [object] had some issues deleteing the associated FilterDefinition ID [ID]. Error message: [message] | | 409059 | CreateSingle: FK SegmentDefinitionID does not exsit in table [table] | | 409060 | CreateSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409061 | UpdateSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409062 | UpdateSingle: [object] could not be found because no ID was specified. Make sure you are setting IDSpecified=true | | 409063 | UpdateSingle: [object] with ID [ID] could not be found | | 409064 | DeleteSingle: No [type] objects found, APIObject was null or not of type [type]. Type was [type] | | 409065 | DeleteSingle: [object] with ID [ID] could not be found | # 41000-41999 DeliveryProfile Object | Error | Message | | ----- | ------- | | 41000 | DP_Not Implemented Exception | | 41100 | DP_Source Address Type Not Specified | | 41101 | DP_Private IP Not Specified | | 41102 | DP_Content Area Not Specified | | 41103 | DP_Delivery Profile Not Specified | | 41104 | DP_Customer Key Invalid | | 41105 | DP_Name Invalid | | 41106 | DP_SMIME Signature Certificate Invalid | | 41107 | DP_Private Domain Set Invalid | | 41200 | DP_Private IP Invalid | | 41300 | DP_Content Area Not Found | | 41301 | DP_Delivery Profile Not Found | # 42000-42999 EmailSendDefinition Object | Error | Message | | ----- | ------- | | 42000 | ESD_Not Implemented Exception | | 42001 | ESD_Not Specified | | 42002 | ESD_Not Found | | 42003 | ESD_Send Classification Not Found | | 42004 | ESD_Email Not Found | | 42005 | ESD_Email Not Specified | | 42006 | ESD_Email ID Or Partner Key Not Found | | 42007 | ESD_List Not Found | | 42008 | ESD_Custom Object Not Found | | 42009 | ESD_Tracking User Not Found | | 42100 | ESD_Customer Key Invalid | | 42101 | ESD_Name Invalid | | 42102 | ESD_Email Partner Key Invalid | | 42103 | ESD_Email Subject Invalid | | 42104 | ESD_Dynamic Email Subject Invalid | | 42105 | ESD_Email Invalid | | 42106 | ESD_Invalid Personalization String | | 42107 | ESD_BCC Email Invalid | | 42108 | ESD_Send Window Open Invalid | | 42109 | ESD_Send Window Close Invalid | | 42110 | ESD_Send Definition List Invalid | | 42111 | ESD_Tracking Users Invalid | | 42112 | ESD_Test Email Address Invalid | | 42113 | ESD_Exclusion Filter Invalid | | 42114 | ESD_Deduplicate By Email Invalid | | 42115 | ESD_CategoryID Invalid | | 42116 | ESD_Null Value | | 42117 | ESD_Invalid ObjectID | # 43000-43999 ImportDefinition Object | Error | Message | | ----- | ------- | | 43000 | ImportDefinition Customer Key Not Specified | | 43010 | ImportDefinition Not Found | | 43020 | ImportDefinition Object Not Supported | | 43030 | ImportDefinition Exists | | 43040 | ImportDefinition Insert Error | | 43050 | ImportDefinition Update Error | | 43060 | ImportDefinition Validation Error | # 435000-435999 Send SMS MO Keyword | Error | Message | | ----- | ------- | | 435000 | You are trying to create a SendSMSMOKeyword that already exists. You may either update this keyword or delete it and recreate it | | 435001 | SMS Keyword verb is too long | | 435002 | Send SMSMO keyword message is required | | 435003 | Send SMSMO keyword customer key cannot contain commas | | 435004 | Send SMSMO keyword customer key is required | | 435005 | Send SMSMO keyword script error message is invalid: (error message) | | 435006 | Send SMSMO keyword message is invalid: (message) | # 439000-439999 Help MO Keyword | Error | Message | | ----- | ------- | | 439000 | Help MO keyword FriendlyName is required | | 439001 | Help MO keyword verb cannot contain commas | | 439002 | Help MO keyword verb belongs to another state: (state named here) | | 439003 | Help MO keyword verb cannot contain commas | | 439004 | Help MO keyword verb is required | | 439005 | Help MO keyword default help message is required | # 44000-44999 Campaign Object | Error | Message | | ----- | ------- | | 44000 | Campaign Not Implemented Exception | | 44001 | Campaign Not Specified | | 44002 | Campaign Not Found | | 44100 | Campaign Customer Key Invalid | | 44101 | Campaign Name Invalid | # 440000-440999 Send Email MO Keyword | Error | Message | | ----- | ------- | | 440000 | Send email MO keyword verb already in use | | 440001 | Send email MO keyword verb must be 25 characters or less | | 440002 | Send email MO keyword success message required | | 440003 | Send email MO keyword missing email message required | | 440004 | Send email MO keyword failure message required | | 440005 | Send email MO keyword triggered send required | | 440006 | {0} contained more than 160 GSM characters or more than 70 Unicode characters. Please modify the message and save | | 440007 | {0} contained more than 160 GSM characters or more than 70 Unicode characters. Please modify the message and save | | 440008 | {0} contained more than 160 GSM characters or more than 70 Unicode characters. Please modify the message and save | # 441000-441999 SMS Triggered Send Definition | Error | Message | | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 441000 | | | 441001 | Object ID and Customer Key don't match | | 441002 | The ClientID of the Publication doesn't match the ClientID of the Triggered Send Definition | | 441003 | | | 441004 | SMS Triggered Send Definition name is required | | 441005 | SMS Triggered Send Definition publication is required | | 441006 | | | 441007 | The specified Content does not appear to be valid | # 446000-446999 Double Opt In SMS Messages | Error | Message | | ----- | ------- | | 446000 | CustomerKey is Required | | 446001 | You are trying to create a DoubleOptInMOKeyword that already exists. You may either update this keyword or delete it and recreate it | | 446002 | Verb cannot contain commas | | 446003 | Double Opt In Text Invalid | | 446004 | This verb is already associated with another action | | 446005 | InvalidPublicationMessage is Required | | 446006 | InvalidResponseMessage is Required | | 446007 | MissingPublicationMessage is Required | | 446008 | NeedPublicationMessage is Required | | 446009 | PromptMessage is Required | | 446010 | SuccessMessage is Required | | 446011 | UnexpectedErrorMessage is Required | | 446012 | ValidResponses is Required | | 446013 | You are trying to update a DoubleOptInMOKeyword that could not be found. Try creating this first | # 447000-447999 Unsubscribe From SMS Publication | Error | Message | | ----- | ------- | | 447000 | CustomerKey is Required | | 447001 | This verb belongs to another state: (state) | | 447002 | Verb cannot contain commas | | 447003 | (key)is Invalid: (error) | | 447004 | This verb is already associated with another action | | 447005 | AllUnsubSuccessMessage is Required | | 447006 | InvalidPublicationMessage is Required | | 447007 | SingleUnsubSuccessMessage is Required | # 50000-50999 Notifications | Error | Message | | ----- | ------- | | 50000 | Notification Entity Validation Exception | | 50001 | Notification Value Type Mismatch Exception | | 50002 | Notification Serialization Optimization Exception | | 50003 | Notification Security Exception | | 50004 | NotificationRelationException | | 50005 | Notification Execution Exception | | 50006 | Notification Query Construction Exception | | 50007 | Notification Lock Timeout Exception | | 50008 | Notification Invalid Field Read Exception | | 50009 | Notification Interpretation Exception | | 50010 | Notification Inheritance Info Exception | | 50011 | Notification General Operation Exception | | 50012 | Notification Field is Read-Only Exception | | 50013 | Notification Field is Null Exception | | 50014 | Notification Entity Out of Sync Exception | | 50015 | Notification Entity is Deleted Exception | | 50016 | Notification Concurrency Exception | | 50017 | Notification Update Entity Not Found | | 50018 | Notification Update ID Invalid | # 54000-54999 User Access | Error | Message | | ----- | ------- | | 54000 | User Access Invalid Permissions | | 54001 | User Access ID Not Specified | # 55000-55999 Salutation | Error | Message | | ----- | ------- | | 55000 | Salutation Type or TypeID Not Specified | | 55001 | Salutation ClientID Not Specified | | 55002 | Salutation Member Specific ClientID/TypeID Mismatch | | 55003 | Salutation List Specific Invalid ListID | | 55004 | Salutation Email Specific Invalid EmailID | # 56000-56999 Business Rule | Error | Message | | ----- | ------- | | 56000 | Business Rule Save Exception | | 56001 | Business Rule Name Not Specified | | 56002 | Business Rule Invalid Business Rule Name | # 63000-63999 Public Key Management | Error | Message | | ----- | ------- | | 63000 | Public Key Management Record Not Found | | 63001 | Public Key Management Name Already Exists | | 63002 | Public Key Management Name Is Missing | | 63003 | Public Key Management Key Is Missing | # 67000-67999 Property Definition | Error | Message | | ----- | ------- | | 67000 | Property Definition Min Length Greater than Max Length | | 67001 | Property Definition Min Length or Max Length Not Defined | | 67002 | Property Definition No Name | | 67003 | Property Definition Name Does Not Start With Letter | | 67004 | Property Definition Name Contains Non-Alphanumeric Characters | | 67005 | Property Definition Name Is On List Of Restricted Words | | 67006 | Property Definition Name Already Exists | | 67007 | Property Definition Missing Picklist Items | | 67008 | Property Definition Invalid Picklist Item | | 67009 | Property Definition Multi-select Picklist Not Supported | | 67010 | Property Definition No Picklist Item Selected | | 67011 | Property Definition Selected Picklist Item Does Not Match Default Value | | 67012 | Property Definition Invalid Default Value | | 67013 | Property Definition Invalid Min Value | | 67014 | Property Definition Default Less Than Min Value | | 67015 | Property Definition Invalid Max Value | | 67016 | Property Definition Default Greater Than Max Value | | 67017 | Property Definition Default Too Short | | 67018 | Property Definition Default Too Long | | 67019 | Property Definition Min Value Or Max Value Not Defined | | 67020 | Property Definition Not Found | | 67021 | Property Definition Name Not Found | | 67022 | Property Definition Error Deleting | | 67023 | Property Definition ID Not Found | | 67024 | Property Definition No Change Name | | 67025 | Property Definition No Change Is Editable | | 67026 | Property Definition No Change Is Required | | 67027 | Property Definition No Change Is Send Time | | 67028 | Property Definition No Change Is Viewable | | 67029 | Property Definition No Change Min Value | | 67030 | Property Definition No Change Max Value | | 67031 | Property Definition No Change Min Length | | 67032 | Property Definition No Change Max Length | | 67033 | Property Definition No Change Default Value | | 67034 | Property Definition Maximum Count Exceeded | | 67035 | Property Definition Read Only Access | # 68000-68099 SaveOption Object | Error | Message | | ----- | ------- | | 68000 | | | 68001 | | # 69000-69099 Portfolio Object | Error | Message | | ----- | ------- | | 69000 | Portfolio General Error | | 69001 | Portfolio Customer Key In Use Or Too Long | | 69002 | Portfolio File Type Not Supported | | 69003 | Portfolio File Size Too Big | | 69004 | Portfolio Illegal Chars In File Name | | 69005 | Portfolio File Name Already Exists | | 69006 | Portfolio Category Invalid | | 69007 | Portfolio Filename Too Short | | 69008 | Portfolio Invalid URL | | 69010 | Portfolio Business Rule Not Turned On | # 7000–7099 Send Object | Error | Type | Message | Resolution | | ----- | -------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 7000 | Validation | Email failed validation: [validation error] | This error occurs when the email does not contain one of the required elements: An unsubscribe link, A physical mailing address, or Correct syntax for attributes. To correct this error, add the missing required element. | | 7001 | Validation | An email ID, Partner Key, or body must be specified | Specify an identifier for an existing email (ID or PartnerKey) or specify a body for a new email. | | 7002 | Validation | A list must be specified | Specify an identifier for an existing list (ID or PartnerKey) or specify subscribers for a new list. | | 7003 | System | No lists were created to send to | Log the error and contact Salesforce Customer Support. | | 7004 | System or Validation | Error creating/updating lists. List creations failed: [error message] | Log the error and contact Salesforce Customer Support. | | 7005 | Validation | Invalid E-mail partner key: [PartnerKey] | Log the error and ensure the correct PartnerKey is set on the Email object. | | 7006 | System or Validation | | | | 7007 | System | Unable to load email | Log the error and contact Salesforce Customer Support. | | 7008 | System | Job Creation Failed | Log the error and contact Salesforce Customer Support. | | 7009 | | Send Job Creation Failure | | | 7010 | | Send Account Status Failure | | # 70000-71999 Custom Object | Error | Message | | ----- | ---------------------------------------------------------------------------- | | 70000 | Custom Object Data Validation General Error | | 70001 | Custom Object Data Validation Null Value | | 70002 | Custom Object Data Validation Max Length Exceeded | | 70003 | Custom Object Invalid Data Extension Key | | 70004 | Custom Object Null Or Empty | | 71000 | Returns OK row level results when entire batch times out in singleton mode. | | 71001 | Custom object data operation aborted before finishing | | 71002 | Custom object data operation skipped rows to prevent a primary key violation | | 71003 | Custom object data operation failed due to missing required fields | | 71004 | Custom object data operation failed due to duplicate fields | | 71005 | Custom object data operation error due to primary key operation | | 71006 | Custom object data operation aborted before starting | # Access Child Account Objects To execute certain actions or view information related to a child account, use the permissions and roles assigned to a different user. You can also use impersonation to help another user and troubleshoot their problems or issues inside their own account. You need admin access to perform impersonation. **note:** These examples are for agency or Enterprise 1.0 with Lock and Publish account types. For Enterprise 2.0 accounts, use the ClientIDs property on a retrieve request to specify multiple child accounts for a single call. ## Sample .NET Code ```csharp //Options deo.Client = new ClientID(); deo.Client.ID = Convert.ToInt32(txtMID.Text); deo.Client.IDSpecified = true; ``` ## Sample .NET Code - Retrieve Request with Impersonation ```csharp RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "Send";//required ClientID rrclient = new ClientID(); rrclient.ID = 12345; rrclient.IDSpecified = true; RetrieveOptions ro = new RetrieveOptions(); ro.Client = rrclient; rr.Options = ro; ``` ## Sample SOAP Envelope ```xml XXXXX XXXXXXX XXXXX 12345 Subscriber ID PartnerKey CreatedDate Client.ID Client.PartnerClientKey EmailAddress SubscriberKey Status UnsubscribedDate true ``` # Access Token for Server-to-Server Integrations ## Access Token Request Construct a static endpoint for your request by appending v2/token to the Authorization Base URI provided to you when you created the API integration in Installed Packages. You can’t use legacy endpoints. Request an access token by providing the client ID and secret that you received when you created the API integration in Installed Packages. When the access token expires, your application must request a new access token using the same v2/token route as before. The lifetime of an access token is 20 minutes. **note:** The `client_id`, `client_secret`, `access_token`, and instance URL values in this document are fictitious. Replace these values with the appropriate values for your own instance and account. ### JSON Parameters | Name | Type | Required | Description | | ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | grant_type | string | Required | Type of grant. Must be "client_credentials" for server-to-server integrations. | | client_id | string | Required | Client ID issued when you create the API integration in Installed Packages. | | client_secret | string | Required | Client secret issued when you create the API integration in Installed Packages. | | scope | string | no | Space-separated list of data-access permissions for your application. Review [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md) for a full list of permissions. If you don’t include the scope parameter in the request, the token is issued with the scopes specified on the API integration in Installed Packages. If you include the scope parameter and use an empty string for the values, the token is generated with no scope permissions. | | account_id | number | no | Account identifier, or MID, of the target business unit. Use to switch between business units. If you don’t specify account_id, the returned access token is in the context of the business unit that created the integration. | ### Example Request ```js Host: https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com POST /v2/token Content-Type: application/json { "grant_type": "client_credentials", "client_id": "2bfe9d72a4aae8f06a31025b7536be80", "client_secret": "9d667c2b7fae7a329f32b6df17926154", "scope": "email_read email_write email_send", "account_id": "12345" } ``` ## Important Considerations Follow these considerations when using the API directly and doing your own OAuth token management. 1. Don’t request a new access token for every API call you make—each access token is reusable, and remains valid for 20 minutes. Making two API calls for every one operation is inefficient and causes throttling. 2. Be careful where you store your client ID and secret. Never expose this information about the client side via JavaScript or store it in a mobile application. Store these credentials securely in your application. ## Access Token Return Marketing Cloud Engagement returns an access token. Your application must extract the access token and store it safely. Protect the access token as you would protect user credentials. ### Response Parameters | Name | Type | Description | | ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | access_token | string | Acts as a session ID that the application uses to make requests. The maximum length is 512 characters. Lifetime is 20 minutes. | | token_type | string | The type of token that you requested. This parameter always has the value “Bearer”. | | expires_in | number | Length of time in seconds that the token remains valid. The value has the value 1080, representing 1,080 seconds, or 18 minutes. The actual access token lifetime is 20 minutes, but the expires_in setting is 18 minutes because we recommend that you refresh your token two minutes before its lifetime ends. | | scope | string | Scope values assigned to the client ID and secret pair. Returns all scopes for the integration in Installed Packages if the request doesn’t contain scopes. If scopes are included in the request, it returns these scopes, provided that the integration has these scopes in Installed Packages. | | rest_instance_url | string | Your tenant’s REST base URL for making REST API calls. | | soap_instance_url | string | Your tenant’s SOAP base URL for making SOAP API calls. | ### Example Response ```js HTTP/1.1 200 OK { "access_token":"69d8034fa6b281ffa1ed622144b66a61.a2894b8614772e68432f89ce29b66873example", "expires_in":1080, "token_type":"Bearer", "rest_instance_url":"mc563xyzgzs27c5t9-42k63xyzgm.rest.marketingcloudapis.com", "soap_instance_url":"mc563xyzgzs27c5t9-42k63xyzgm.soap.marketingcloudapis.com", "scope": "email_read email_write email_send" } ``` ### Example Error Response ```json HTTP/1.1 401 Unauthorized { "error": "invalid_client" "error_description": "Invalid client ID. Use the client ID in Marketing Cloud Installed Packages." "error_uri": "https://developer.salesforce.com/docs" } ``` ## Related Items - [Server-to-Server Integrations with Client Credentials Grant Type](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-s2s-client-credentials.md) - [Web and Public App Integrations with Authorization Code Grant Type](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-app-auth-code.md) - [Your Subdomain and Your Tenant's Endpoints](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/your-subdomain-tenant-specific-endpoints.md) # Access Token for Web and Public App Integrations Construct an endpoint for your request by appending `v2/token` to the Authorization Base URL that you obtained when you created the API integration. You can’t use legacy endpoints. After constructing the token endpoint, request an access token and refresh the token by posting the authorization code to the token endpoint. The authorization code was appended to the redirect URL after the user logged in. By default, the tokens are revoked when the user signs out. To create a token that isn’t revoked, first select the offline access scope for your app in Installed Packages. You must also include the offline scope in your request. This request generates access and refresh tokens that you can use, even when the user isn’t logged in. **note:** The `client_id`, `client_secret`, `access_token`, and instance URL values in this document are fictitious. Replace these values with the appropriate values for your own instance and account. For AppExchange partners, the subdomain or TSSD that’s returned in the `/authorize` response is different from your own subdomain used as part of the `/authorize` request. Use the dynamic end-user subdomain returned from `/authorize` to construct subsequent token requests on your customer’s behalf. ## JSON Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `grant_type` | string | Required. The type of grant. For web apps and public apps, set this property to `authorization_code`. | | `code` | string | Required. The authorization code obtained from the request to the `v2/authorize` endpoint. | | `client_id` | string | Required. The client ID issued when you create the API integration in Installed Packages. | | `client_secret` | string | Required for web apps. The client secret issued when you create the API integration in Installed Packages. | | `redirect_uri` | string | Required. The redirect address. This value must match the redirect URL that was used to request the authorization code. Don’t URL-encode the address for this request. | | `scope` | string | A space-separated list of data-access permissions for your application. See [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md) for a list of permissions. The list you specify must exactly match or be a subset of the scopes requested as part of the authorization code request. If you don’t include the scope parameter in the request, the token is issued with the scopes specified on the API integration in Installed Packages. If you include the `scope` parameter and use an empty string for the values, the token is generated with no scope permissions. | | `account_id` | number | The member ID (MID) of the target business unit. Include this property when your use case requires you to switch between business units. | ## Example Public App Request ``` Host: https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com POST /v2/token Content-Type: application/json { "grant_type": "authorization_code", "code": "69d8034fa6b281ffa1ed622144b66a61.a2894b8614772e68432f89ce29b66873example", "client_id": "2bfe9d72a4aae8f06a31025b7536be80", "redirect_uri": "https://127.0.0.1:80/", "scope": "email_read email_write email_send offline" } ``` ## Example Web App Request ``` Host: https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com POST /v2/token Content-Type: application/json { "grant_type": "authorization_code", "code": "69d8034fa6b281ffa1ed622144b66a61.a2894b8614772e68432f89ce29b66873example", "client_id": "2bfe9d72a4aae8f06a31025b7536be80", "client_secret": "9d667c2b7fae7a329f32b6df17926154", "redirect_uri": "https://127.0.0.1:80/", "scope": "email_read email_write email_send offline" } ``` ## Access Token Return After the request is successfully validated, the authorization service issues an access token and a refresh token. You can use the tokens returned from the `v2/token` endpoint only with marketingcloudapis.com endpoints. Always keep your access token secret. ## Response Parameters | Name | Type | Description | | ------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | | `access_token` | string | Acts as a session ID that the application uses to make requests. Maximum length is 512 characters. Lifetime is 20 minutes. | | `refresh_token` | string | Token that can be used in the future to obtain a new access token. Maximum length is 512 characters. Default lifetime is 30 days. | | `expires_in` | number | Length of time in seconds that the access token is valid. | | `scope` | string | List of scopes available for the access token. | | `rest_instance_url` | string | Your tenant’s REST base URL for making REST API calls. | | `soap_instance_url` | string | Your tenant’s SOAP base URL for making SOAP API calls. | ## Example Web App and Public App Response ``` HTTP/1.1 200 OK { "access_token":"9abd863f388a66e19ac4937b46448b0b.49934712976a934463e95f1e35fca2d1example", "refresh_token":"8d4f6f77f544019327d10023d162ac01.6c663e9a2eda319ef382d5e2b1269cb7example", "expires_in":1200, "token_type":"Bearer", "rest_instance_url":"mc563xyzgzs27c5t9-42k63xyzgm.rest.marketingcloudapis.com", "soap_instance_url":"mc563xyzgzs27c5t9-42k63xyzgm.soap.marketingcloudapis.com", "scope": "email_read email_write email_send offline" } ``` ## Example Error Response Upon validation failure and for certain errors, the authorization service redirects the user’s web browser to the callback URL in the `redirect_uri` parameter with an error code and description. ``` HTTP/1.1 401 Unauthorized { "error": "unauthorized_client" "error_description": "The client is not authorized to request an authorization code using this method." "error_uri": "https://developer.salesforce.com/docs" } ``` ## Refresh Access Token The lifetime of the access token is 20 minutes. When the access token expires, your application must use the same token endpoint and refresh token to request a new access and refresh token pair. Public apps don’t have a client secret. The body of a refresh request contains the properties in this table. | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `grant_type` | string | Required. The type of grant. When you request a refresh token, specify `refresh_token` for this property. | | `client_id` | string | Required. The client ID issued when you create the API integration in Installed Packages. | | `client_secret` | string | Required for web apps. The client secret issued when you create the API integration in Installed Packages. | | `refresh_token` | string | Required. The refresh token that was returned in the previous token request. | | `scope` | string | A space-separated list of data-access permissions for your application. See [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md) for a list of permissions. The list you specify must exactly match or be a subset of the scopes requested as part of the authorization code request. If you don’t include the scope parameter in the request, the token is issued with the scopes specified on the API integration in Installed Packages. If you include the `scope` parameter and use an empty string for the values, the token is generated with no scope permissions. | | `account_id` | number | The member ID (MID) of the target business unit. Include this property when your use case requires you to switch between business units. | This sample request shows how to request a refresh token. ``` POST /v2/token Host: https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com Content-Type: application/json { "grant_type": "refresh_token", "client_id": "2bfe9d72a4aae8f06a31025b7536be80", "client_secret": "9d667c2b7fae7a329f32b6df17926154", "refresh_token": "8d4f6f77f544019327d10023d162ac01.6c663e9a2eda319ef382d5e2b1269cb7example", "account_id":"12345" } ``` # Access Token Reference You can request an access token for the two different grant types. For server-to-server API integrations, review [Access Token for Server-to-Server Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/access-token-s2s.md). For web or public app integrations, review [Access Token for Web and Public App Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/access-token-app.md). # Account Represents a Marketing Cloud Engagement account. - To create or update Account subscription data, you need the **Administration | Account | Subscription** permission. - To create or update Account private label data, you need the **Administration | Account | Private Labels** permission. - To create or update Account business rule data, you need the **Administration | Account | Business Rules** permission. - To create or update Account role data, you need the **Administration | Business Units | Manage Roles** permission. ## Using the Account Object If the authenticated user exists in a Reseller or Enterprise account and there are more subaccounts available, you can create an `Account` object. If the authenticated user is a Core account, you can retrieve object attributes. ## Retrieving an Account Object Retrieve an account by its `ID` or `PartnerKey`. Use filters to further refine the results, if necessary. ## Embedded Partner Usage For Embedded partners, use the `PartnerKey` property to associate an external identifier with the account. You can’t change the `PartnerKey` after the Account is created, so we recommend using `CustomerKey` instead. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AccountType` | [AccountTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accounttypeenum.md) | The type of Marketing Cloud Engagement account. | | `AccountUsers` | Array of [AccountUser](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountuser.md) objects | An array of users associated with a specific account. | | `Address` | String | The street address associated with the account. | | `BrandID` | Int | The brand tags associated with the account. | | `BusinessName` | String | The business name associated with an account. | | `BusinessRules` | Array of BusinessRule objects | Not used. | | `Children` | Array of [AccountDataItem](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountdataitem.md) objects | An array of AccountDataItem objects that represent child accounts of this account. | | `City` | String | The city associated with the account. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `Country` | String | The country associated with the account. | | `CreatedDate` | DateTime | The date and time when the account was created. | | `CustomerID` | Long | Not used. | | `CustomerKey` | String | A user-supplied unique identifier for the account. | | `DBID` | Int | Not used. | | `DeletedDate` | DateTime | The date and time of an account’s deletion. The value of this property must be set before the account can be deleted. | | `EditionID` | Int | Specifies the product edition of the account. | | `Email` | String | The email address associated with the account. | | `Fax` | String | The fax number associated with the account. | | `FromName` | String | Specifies the default email message From Name. Deprecated for email send definitions and triggered send definitions. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InheritAddress` | Boolean | Specifies that an Enterprise 2.0 business unit inherits the address from the parent business unit. | | `IsActive` | Int | Specifies whether the account is active. | | `IsTestAccount` | Boolean | Specifies whether an account is a test account. | | `IsTrialAccount` | Boolean | Not used. | | `LanguageLocale` | [Locale](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/locale.md) object | Defines the language preferences associated with the account. | | `Locale` | [Locale](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/locale.md) object | Contains the locale information for the account. The default value is `en-US`. | | `ModifiedDate` | DateTime | The date and time when the account was last modified. | | `Name` | String | The name of the account. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `OrgID` | Int | Parent account ID for On-Your-Behalf or Lock-and-Publish accounts. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes the ownership the account in an on-your-behalf account. | | `ParentAccount` | [Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/account.md) object | Provides information about the parent account. | | `ParentID` | Int | The ID of the parent account for Lock and Publish, On Your Behalf, Enterprise, and Enterprise 2.0 account children and business units. | | `ParentName` | String | The name of the Parent account. | | `PartnerKey` | String | A unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Phone` | String | The phone number associated with the account. | | `PrivateLabelID` | Int | The private label ID for the account. | | `PrivateLabels` | Array of [PrivateLabel](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privatelabel.md) objects | Specifies UI modifications to use on child accounts. | | `ReportingParentID` | Int | Not used. | | `Roles` | Array of [Role](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/role.md) objects | Collection of roles defined for an account. | | `State` | String | The state or region associated with the account. | | `Subscription` | [Subscription](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscription.md) object | Contains information about the subscriptions that apply to the account. | | `TimeZone` | [TimeZone](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/timezone.md) object | Contains time zone information for the account. For Create and Update calls, this property defines the time zone for an Account object. In a Retrieve call, TimeZone indicates which time zone is in effect for the Account object in question. Without a specific time zone, the Account defaults to Central Standard Time. | | `Zip` | String | The ZIP code associated with the account. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Create an Agency Client Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_agency_client_object.md) - [Manage Enterprise 2.0 Accounts](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/managing_enterprise_20_accounts_with_the_web_services_api.md) - [Retrieve Account Object Using the CustomerKey Attribute](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_account_object_using_the_partnerkey_attribute.md) # AccountDataItem Contains information regarding a child account within a parent account structure. | Name | Data Type | Description | | ---------------- | ------------------------------------- | ----------------------------------------------- | | `AccountType` | [AccountTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accounttypeenum.md) | The type of Marketing Cloud Engagement account. | | `BrandID` | Int | Specifies brand tags to use on an account. | | `ChildAccountID` | Int | Specifies the identifiers for a child account. | | `PrivateLabelID` | Int | Specifies the private label for an account. | # AccountPrivateLabel Contains information about the private labels for an account. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ColorPaletteXML` | String | An XML string that defines colors for a private label. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `OwnerMemberID` | Int | Identifies MID of AccountPrivateLabel owner. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # AccountTypeEnum The Marketing Cloud Engagement account classifications used on account and business unit objects. ## Values | Name | Description | | -------------------- | ----------------------------------------------------------- | | `BUSINESS_UNIT` | Indicates a business unit account type. | | `CHANNEL_CONNECT` | Indicates a legacy Channel Connect account type. | | `CONNECT` | Indicates an advanced account type. | | `DOTO_MEMBER` | Indicates an on-your-behalf account type. | | `ENTERPRISE_2` | Indicates an Enterprise 2.0 account type. | | `EXACTTARGET` | Indicates a core account type. | | `LP_MEMBER` | Indicates a lock-and-publish account type. | | `None` | Indicates that no account type is specified. | | `PRO_CONNECT` | Indicates a legacy Pro Connect account type. | | `PRO_CONNECT_CLIENT` | Indicates a client account in a legacy Pro Connect account. | ## Related Items - [Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/account.md) - [AccountDataItem](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountdataitem.md) - [BusinessUnit](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/businessunit.md) # AccountUser Represents an individual user in an account. To create or update account user roles, your permissions must allow you to assign or manage roles. To associate business units to the account, you must also have permissions that allow you to manage business units. ## Properties | Name | Data Type | Description | | --------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AccountUserID` | String | The ID of the account user. | | `ActiveFlag` | Boolean | Indicates whether the account user is active. | | `AssociatedBusinessUnits` | Array of [BusinessUnit](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/businessunit.md) objects | Indicates the business units the account user is associated with and is able to access. This property is non-retrievable. | | `BusinessUnit` | Int | The account identifier of the business unit. | | `ChallengeAnswer` | String | The challenge answer, which is used to help the user log in to their account if they forget their password. | | `ChallengePhrase` | String | The challenge phrase, which is used to help the user log in to their account if they forget their password. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | The account ownership and context of the object. | | `CorrelationID` | String | An ID that correlates objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | A user-supplied unique identifier for the object. This property corresponds to the external key assigned to an object. | | `DefaultApplication` | String | The application that the account user sees when they log in to their account. | | `DefaultBusinessUnit` | Int | The account identifier of the business unit that the account user sees when they log in to their account. | | `DefaultBusinessUnitObject` | [BusinessUnit](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/businessunit.md) object | The default business unit for the account user. | | `Delete` | Int | Indicates whether an object gets deleted. | | `Email` | String | The email address for the account user. | | `ID` | Int | A unique identifier for the object. Some objects use the ObjectID property as a unique ID. | | `IsAPIUser` | Boolean | Indicates whether the account user is an API user. If the value is `true`, the user's password remains the same until it is actively changed. | | `IsLocked` | Boolean | Indicates whether the account user can log in to their account. | | `LanguageLocale` | [Locale](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/locale.md) object | The location and language setting for the account user. | | `LastSuccessfulLogin` | DateTime | The date and time when the user last successfully logged in. | | `Locale` | [Locale](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/locale.md) object | Contains the locale information for an Account. The default value is `en-US`. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `MustChangePassword` | Boolean | Indicates whether user must change their password the next time they log in. | | `Name` | String | Name of the object or property. | | `NotificationEmailAddress` | String | The email address to send notifications to. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Password` | String | The login password for the user. | | `Roles` | Array of [Role](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/role.md) objects | Collection of roles defined for an account. | | `SsoIdentities` | Array of [SsoIdentity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssoidentity.md) objects | Identifies single sign-on identities associated with the account user. | | `TimeZone` | [TimeZone](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/timezone.md) object | Contains time zone information for an Account. For Create and Update calls, this property defines the time zone for an Account object. On a Retrieve call, TimeZone indicates which time zone is in effect for the Account object in question. Without a specific time zone, the Account defaults to Central Standard Time. | | `Unlock` | Boolean | Indicates whether the account user is unlocked. | | `UserID` | String | The username of the account user. | | `UserPermissions` | Array of [UserAccess](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/useraccess.md) objects | Not used. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Manage Enterprise 2.0 Accounts](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/managing_enterprise_20_accounts_with_the_web_services_api.md) # Action Component Blocks Action component blocks are interactive buttons for form submissions and custom actions. ## lightning/actionButton Interactive button for form submissions and custom actions. Unlike `lightning/button`, which requires a destination URI for navigation, `lightning/actionButton` defaults to form submission behavior and supports custom click handlers. | Attribute | Type | Description | | ------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- | | `text` | string | Required. The label displayed on the button. The default value is `Button`. | | `width` | object | Controls how wide the button is within its container. | | `lightning:horizontalAlignment` | string | Specifies the horizontal position of the button within its column. Possible values are `left`, `center`, or `right`. | This example shows how to create a centered submit button. ```json { "type": "block", "definition": "lightning/actionButton", "attributes": { "text": "Submit", "lightning:horizontalAlignment": "center" } } ``` ## Related Items - [Content Component Blocks](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-manage-component-blocks.md) # Activate ## Overview Activates an account user ### Syntax Activate() ## Example This sample code initializes a specific account and activates that account: ``` var acctUser = AccountUser.Init('myAccountUser', 123456789); var status = acctUser.Activate(); ``` # Add ## Overview Creates a new account user based on the passed parameters ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------------- | | **1** | object | **Required** | A JSON object representing the properties of the new account user | ## Example This sample code adds a new account user and specifies both a default business unit as well as associated business units for the user based on the provided external keys: ``` var newUser = { "Name" : "Andrea Cruz", "UserID" : "acruz", "Password" : "PASSWORD", "Email" : "acruz@example.com", "ClientID" : 123456789, "DefaultBusinessUnitKey": "childBUKey", "AssociatedBusinessUnits" : ["childBUKey", "grandchildBUKey"] }; var status = AccountUser.Add(newUser); ``` # Add ## Overview Adds a new content area to your account and returns an initialized object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------------------------------- | | **1** | object | **Required** | JSON object representing the properties of the new content area | ## Example This sample code adds a content area to your account: ``` var exampleArea = { "CustomerKey" : "exampleArea", "Name" : "SSJS Content Area Example", "CategoryID" : 123456 //Use only if you wish to assign the content area to a specific folder "Layout" : "RawText", //Use only if you wish to create a specific layout format for a content area "LayoutSpecified" : true, //Use only if you specify a layout type "Content" : "This is example content" }; var addedCA = ContentAreaObj.Add(exampleArea); ``` # Add Creates a data extension and returns an initialized DataExtension object. ## Syntax `Add(1)` ## Function Properties | Ordinal | Type | Description | | ------- | ------ | ---------------------------------------------------------------------------- | | `1` | Object | Required. An object that specifies the properties of the new data extension. | ## Examples This code example creates a sendable data extension that contains four fields. The field `SubKey` is associated with the contact’s subscriber key. ``` var deObj = { CustomerKey : "SendableDE", Name : "Sendable Data Extension", Fields : [ { "Name" : "SubKey", "FieldType" : "Text", "IsPrimaryKey" : true, "MaxLength" : 50, "IsRequired" : true }, { "Name" : "SecondField", "FieldType" : "Text", "MaxLength" : 50 }, { "Name" : "ThirdField", "FieldType" : "Text", "MaxLength" : 50 }, { "Name" : "DifferentSubKey", "FieldType" : "Text", "MaxLength" : 50 } ], SendableInfo : { Field : { "Name" : "SubKey", "FieldType" : "Text" }, RelatesOn : "Subscriber Key" } }; var de = DataExtension.Add(deObj); ``` For information about specifying data extension fields, see [Fields.Add](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionFieldsAdd.md). # Add ## Overview Adds a new delivery profile to the account and returns the created object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------------------- | | **1** | object | **Required** | JSON object representing the properties of the new delivery profile | ## Example This sample code adds a delivery profile to your account: ``` var newDP = { "Name" : "SSJS Added Delivery Profile", "CustomerKey" : "test_delivery_profile", "Description" : "An SSJS Added Profile", "SourceAddressType" : "DefaultPrivateIPAddress" }; var newProfile = DeliveryProfile.Add(newDP); ``` # Add ## Overview Adds a new email to your account and returns an initialized object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------- | | **1** | object | **Required** | JSON object containing new email properties | ## Example This sample code adds an email to your account: ``` var newMail = { "CustomerKey" : "test_email_key", "Name" : "Test Email", "CategoryID" : "123456", "HTMLBody" : "This is a test email", "TextBody" : "This is a test email", "Subject" : "Test Email Subject", "IsActive" : "true", "IsHTMLPaste" : "true", "Status" : "active", "EmailType" : "HTML", "CharacterSet" : "US-ASCII", "HasDynamicSubjectLine" : "false" }; var myEmail = Email.Add(newMail); ``` The CategoryID value in the above code sample assigns the new email message to a specific folder. To save the new email message to the default folder in your account, remove the CategoryID value entirely. # Add ## Overview Adds a new filter definition to your account ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------------------------- | | **1** | object | **Required** | JSON object including properties of new filter definition | ## Example This example code adds a filter definition to your account. ``` var filterObj = { Property : "LuckyNumber", SimpleOperator : "equals", Value : 77 }; var newFD = { Name : "SSJS Filter Definition" CustomerKey : "myFilterDef", Filter : filterObj, DataSource : { Type : "SubscriberList", CustomerKey : "example_list_key" } }; var status = FilterDefinition.Add(newFD); ``` This example code adds a complex filter definition. ``` var filterObj = { LeftOperand: { Property: "LuckyNumber", SimpleOperator: "equals", Value: 77 }, LogicalOperator: "AND", RightOperand: { Property: "UnluckyNumber", SimpleOperator: "equals", Value: 13 } }; var newFD = { Name: "SSJS Filter Definition", CustomerKey: "myFilterDef", Filter: filterObj, DataSource: { Type: "DataExtension", CustomerKey: "example_external_key" } }; try { var result = FilterDefinition.Add(newFD); Write(Stringify(result)); } catch (e) { Write(Stringify(e)); } ``` # Add ## Overview Adds a new folder to your account as a child to a previously existing folder and returns the status ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ---------------------------------------------- | | **1** | object | **Required** | JSON object representing new folder properties | ## Example This sample code adds a folder to your account: ``` var newFolder = { "Name" : "Test Add Folder", "CustomerKey" : "test_folder_key", "Description" : "Test added", "ContentType" : "email", "IsActive" : "true", "IsEditable" : "true", "AllowChildren" : "false", "ParentFolderID" : 123456 }; var status = Folder.Add(newFolder); ``` # Add ## Overview Adds a new list to your account and returns the initialized list object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ---------------- | | **1** | string | **Required** | Name of new list | ## Example This sample code adds a list to your account. ``` var myNewList = List.Add({CustomerKey:"libList",Name:"testLib",Description:"desc"}); ``` # Add ## Overview Adds a new content area to your account and returns an initialized object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | -------------------------------------------------------------------- | | **1** | object | **Required** | JSON object containing parameters associated with a Portfolio object | ## Example This sample code adds a new portfolio object to the Portfolio folder specified by CategoryID. ``` var newPortfolio = { DisplayName : "SSJS Portfolio Object", CustomerKey : "myPortfolioCK", CategoryID: 12345, FileName : "logo.png", FileLocation : "http://www.example.com/Portals/0/images/global/logo_main.png" }; var status = Portfolio.Add(newPortfolio); ``` # Add ## Overview Adds a new query defintion to your account ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | -------------------------------------------------------- | | **1** | object | **Required** | JSON object representing new query definition properties | ## Examples This sample code adds a query definition to your account: ``` var queryDef = { Name : "Example Query Definition", CustomerKey : "myQueryDef", TargetUpdateType : "Overwrite", TargetType : "DE", Target : { Name : "Example Target DE", CustomerKey : "example_target_de" }, QueryText : "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=77" }; var status = QueryDefinition.Add(queryDef); ``` This sample code adds a query definition and places it inside a specific folder: ``` var queryDef = { Name : "Example Query Definition", CustomerKey : "myQueryDef", CategoryID : 123456, TargetUpdateType : "Overwrite", TargetType : "DE", Target : { Name : "Example Target DE", CustomerKey : "example_target_de" }, QueryText : "SELECT SubKey, Email, Name FROM [Example Target DE] where FavoriteItemID=77" }; var status = QueryDefinition.Add(queryDef); ``` # Add ## Overview Adds a new send to your account and returns the status of the send's creation ### Syntax Add(1, 2, 3) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------------------------------------ | | **1** | string | **Required** | CustomerKey of email message to associate with send | | **2** | array | **Required** | Array of list IDs to associate with send | | **3** | string | **Required** | Options to associate with the send, such as a different message subject or send time | ## Examples This sample code adds a send to your account, which sends the specified email message to the provided lists: ``` var status = Send.Add("test_email", [ 12345, 12346 ]); ``` This sample code adds a send to your account, which sends the specified email message to the provided lists using the additional From name, From email address, and subject specified in the options variable: ``` var options = { FromName : "JSON Specified Name", FromAddress : "aruiz@example.com", Subject : "JSON Test Mail" }; var status = Send.Add('test_email', [ 12345, 12346 ], options); ``` # Add ## Overview Adds a send classification to the account ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------- | | **1** | object | **Required** | JSON object representing new send classification properties | ## Example This sample code adds a send classification to your account: ``` var newSC = { CustomerKey : "mySCKey", Name : "SSJS Test SC", Description : "Test SSJS description", SenderProfileKey : "mySPKey", DeliveryProfileKey : "myDPKey" }; SendClassification.Add(newSC); ``` # Add ## Overview Adds a new sender profile to the account and returns the created object ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------ | | **1** | object | **Required** | JSON object representing new sender profile properties | ## Example This sample code adds a sender profile to your account: ``` var newSP = { "Name" : "SSJS Added Send Profile", "CustomerKey" : "test_send_profile", "Description" : "An SSJS Added Profile", "FromName" : "Andrea Cruz", "FromAddress" : "acruz@example.com" }; var newSenderProfile = SenderProfile.Add(newSP); ``` # Add ## Overview Adds a new subscriber to your list and returns a status ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------------- | | **1** | object | **Required** | JSON object representing the properties of the new subscriber | ## Example This sample code adds a subscriber to the specified list: ``` var newSubscriber = { "EmailAddress": "test.008@example.com", "SubscriberKey": "20100730001", "EmailTypePreference": "Text", "Attributes":{"First Name": "test.008", "Last Name": "test.008" }, "Lists": {"Status": "Active", "ID": 12345, "Action": "Create"} }; var status = Subscriber.Add(newSubscriber); ``` # Add ## Overview Adds a new template to your account and returns the status of the operation ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------- | | **1** | object | **Required** | JSON object representing properties of the new template | ## Example This sample code adds a template to your account: ``` var myTemp = { "CustomerKey":"test_template", "TemplateName":"SSJS Test Template", "LayoutHTML":"this is some HTML" }; var status = Template.Add(myTemp); ``` # Add ## Overview Adds a triggered send to your account and returns an initialized object if successful ### Syntax Add(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------ | | **1** | string | **Required** | Properties of the new triggered send | ## Example This sample code adds a triggered send to your account: ``` var newTSD = { "Name" : "Test TSD", "CustomerKey" : "ssjs_tsd_key", "FromName" : "Test From Name", "FromAddress" : "me@example.com", "EmailID" : 12345, "SendClassificationID" : 54321 }; var tsd = TriggeredSend.Add(newTSD); ``` # Add a User to an Account To give a new person access to your account and specify the actions that the user can perform, add a user to your account. You can perform this action via the SOAP API to add new users to accounts owned by embedded partners. You can also use this code to add users from information taken from third-party sources, such as HR systems. ## Sample SOAP Envelope This example includes the required attributes for the user by using the `AccountUser` object. ```xml Create https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN 12345 ACRUZ XXX ACRUZ acruz@example.com true true true true true true true 12345 3 true true ACRUZ ``` ## Related Items - [Add a User](https://help.salesforce.com/articleView?id=mktg.mc_overview_add_a_user.htm) - [Roles and Permissions in Marketing Cloud Engagement](https://help.salesforce.com/articleView?id=mktg.mc_overview_roles.htm) - [AccountUser Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/accountuser.md) # Add an Asset Create an asset and add it to the Einstein Content Selection asset pool. Asset class or type, and custom attributes are created implicitly if they don’t exist. ## Method and Endpoint ``` POST "/ecs/ecs/external/api/v1/asset" ``` ## Request Body Parameters | Name | Type | Description | | ------------------ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | availability | string, enum | Required. Set whether the asset can be selected. Possible values are: Y, N | | content_builder_id | string, Content Builder ID | Instead of loading the image from a hosted URL or Data URL, create an image for this asset using HTML from the specified Content Builder item. | | custom | map, string → string | The Asset Attributes to associate with this asset. New Attributes are created implicity if they don't exist. For example: locale: JP and segment: A3 | | display_time_zone | string | The timezone to show in-app timestamps for this asset. For example: UTC, Eastern Time (US & Canada) | | end_datetime | datetime, ISO-8601 | The date and time the asset is no longer allowed to be selected. For example: 2021-07-23T13:45:15Z | | fallback | string, enum | Set whether the asset can be selected as a fallback when rules disqualify all other content. Possible values are: Y, N | | image_url | string, URL, data URL | Required. Can be either a web-accessible URL hosting an image or a base-64 encoded Data URL containing image data. | | key | string | Required. The asset's name. Must be unique to the account. | | start_datetime | datetime, ISO-8601 | The start date and time the asset is allowed to be selected. For example: 2021-06-23T13:45:15Z | | type | string | Required. Name of the asset's asset_class. | | url | string, URL | The redirect link to use when an asset is clicked. | ## Example Request ``` POST "/ecs/ecs/external/api/v1/asset" BODY: { "key": "Einstein Content", "type": "Icon", "availability": "Y", "fallback": "N", "start_datetime": "2021-06-23T00:00:00Z", "end_datetime": "2221-06-23T23:59:59Z", "display_time_zone": "Osaka", "url": "https://www.example.com/einstein-content", "custom": { "locale": "JP" }, "image_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAAAXNSR0IArs4c6QAACJBJREFUaAXtWn1sHEcVn7d7Pn8kcMRJSgkgaCoQLQ1pVRAhCiRqQSpV2ioqjWigFQXUUPk+9i6OE0soWG1JwjX23dm+SlAhGlGRJuUPSosErRBEIqBSSptIFc0/2H+gpGpiJ07l5Hx3O8Pvnb32er23d3s5Ly4w0mVm3nsz7/32vTdfMQmUnp7YR4pTKk1CbFFKfYhpS6UQ0VklxB/DrdSTTg/9y69dxOBKU+okgHX6HRykPICOt7TSer8gNfbcUgfHH5JtZFv9flSNw9LvoP+UfCO2hpw5lx3MY56lU4x4F1JwujhttehetebF/G/g/R/ge92LoaAB7EokNpnC3I1E/5xSQgkSf9OF/kR/LvenxbAl0BBNGV29UpjHsebfPb1gqDXcZhrz3tMA2XNK0eMAtuCjMo15LNNskAuUNVuBNR+HpRs4i888lrH6zaoDA8g5V8voemRqzeHkBwbQqditX1l03BhXQQsMII4jr9a0EytqTRmfAoEB5K0ANwJZzT7msUw1fqP0wADyPkekvu8GkmnMW4y9MDCA7IGBbP6AJvTNgujXAHWWf9xmGvMa9ZLXuIZPMslksl2YpRM4ifwzkxv+mpcSO2/GS4tyarHrsdoNe1CZpR6ctG7B/nWvYcTqBmgpDqpuCCA/c+CO3WMZSVIe6uvra7P6S6luKETLBXkQIDosINgCPnZx/DyfQh6zaG41PkJ44sL5n+KIfTnSueoR9Kuuqm7jG6H59mAqFdsAq3YsVKb2Tnt2IceiTFwYexQh/U2E9sMA+j2L7lVjIZr04tfi+QII40iaMotJ3Z41OrwehaYP0sp21lT7DcOo+USpt7StBcgMdJZqgXHj+wrRXUbsGwivz7tNVKEpdb9hRPPZ7PAJuwxCcfnEhXOHcRSb/aBoR0iUc5DbzrLJROygUDKBC+Ik9sQ3oOfnkc7VRzH2HbBTyWTsD8pUz7GsnzKrsNYgKOpAaHHueRacVXKQnTfvpfGxDACtdQ5ERNyXisfvZDoppSOXsVCplZC9He2nJ8bPnQFwvoVQJjP0Ap4AH3DOUas/zxAvYeTPHij+sJcM8/ARbkV+PWTJpRJdW6WQ37X6zlqSmT927JguNXrFyQPIFUrJdMqIPcm8gdywbw+S/VmOJ3F7NkylUh9VZvE0vmQ7y9QqROIdvELfImVbuVwqnMKt/YOzY4guov0qkngUmRwWUnyhnfQvTYVCbWapMDor52iQrn81kxn8rYNcs1tXDgIcv37XBY41wtPXFAvqNNGVAly6yrICwN+MrFj1GYTwgu0BtPDF8YIlurA25eMgNh9gKhXfKMvm1xdqrElZDqDL7VLof+rSpbH1oL2eSkSxXYgtyL7TbR3iaQA8l0xEJ/Ehl9nHWG0OfSw0m5GLxy1aPbVnDnJyS9PkbaFZRVdl9RTPyxOi/g7n2JVJOQrA94Ey7qlIyrs8+S5MzxxMJWIPSiUPu4zzTcJeVsSgXwpNez4S6fwVPFZMxqNvwDPsUVwqsP4qVYRXsZK6F3yVtxXRW6TEGuTvFL7Ty6SLo/DqX91HCFE1B7u7u5eVi4WmXGFg2PN6i0geOjQ8YjcEoPLw4k+YhpqjqSq4iowQ10LwWnwEDKj8s06Z2CMTXYORFat34aOVmWovVQGapSt7IbjGLtxIGwvLDzK5/KM8lkMTOX07mfJbuOF+Gd5b3ciczjHI7Ti2prOgL9inqwKE8MPOiXz3iY7grlgBx8cyhPwRgNo8/fHR8j2h64ASImFfu9B/5satusjgyPS624B6afDcu4JCu1h+z549EaHKLzG4esf7kAshNDYWlXs0VPXg2uvpnpER2oAn59lrkVOpJK2qE0JKe/uJbJbDRhQLk/0w4ibn+Cb1seaIu8rCvNOIR9Mf6Fy1z56LVQHG40NTMOD41RqRTEY/i0Pyt692njrG68jyXpxfb0Sub0PYVj5+1RCtY8L6RKTgmz8W0mAKUN2DA0ElNVjj4gNU4tPBQJvTQlI91tMTrewAhOPRGbi05sVzbrh3iwSdzAwO32yX6u6OXmeWxG1YNh/BQnOrnbdYbSxyg9ieEmQkor/AAnB/ExVdRkQe1IT2Wusy85UDB/Jj1tx8LfrLieMDvG9ZNKtGDL+Acb9HTF2npNiKfLoePJzpaBQBjqsU/R12FkHYAln+/0XP6LM+9GL/IRAbeEppWn8mk3uGEx8rnIZN+WUYeNssOKInsV92WX2ue3u7VprmsmI6nX7XTud2Mt61DWe7Y5jDdZGEzrda2ugr/EdDleTnx6LF/FMuKHwJr2j3TkxMmEqWnoUn7raMBuhJXKGuAXB4vv5ixGP9QsiUcwTmezFCoQf6slm+dwa3urEyt3SwQon5fspew/h4QZZGrDHIuQkS2u6B3NBTFo1rzzi2C15tG/vhOrdcV6Q8brnVtR7MZkcB6vycBP3m/StWHp7rT7dcY9gp1Iw+HpW2VnZej8lSRhTvphTO5Ib4oF8pfIYlWT6qkx49lMudsuiVWhHyU1VeDJCPO/Byx4ATdpnAPLhh4+Y06eGbdE3bQaT9CKH5mt0QbkspHsK/+M0VTZU3YWv5YlmZd8xRZ1pkXa/oDLLth1pI+7FTJjAPbt++3YTyN2d+R9iQ3YZxMwzfxu2ZwiEWtjpch1rFiVJB/JlC9Ds7ndsAfhFJtu+GG9Yd3rlzZ0MPw845F72PUCO7EqyuHZXbiJ0402aeC3kead5k8zgBd3p7Y6sLl9WzULsJrvkHYJ7EcXk9vLQeS/8VLEa7s9l83q9ZgeVgLcOmJsV+3vzxCzMorLgPVmoMBK1dSOqHxzyfNNx0LBmAktT73Ayco6lWIcbm5eccr3pryQDUhHqmuplYI4me6+sbuuQl48ZbMgAHcvkXW4T+SWwln9AEDWEbGcFGvj8UprVhreVGHOd2uAH4n6f9GydjfCNTHqEaAAAAAElFTkSuQmCC" } ``` ## Example Response ``` CODE: 201 CREATED BODY: { "key": "Einstein Content", "uuid": "cf868607-9eec-4e2b-ae87-3d2ca7ed7911", "type": "Icon", "url": "https://www.example.com/einstein-content", "image_url": null, "custom": { "locale": "JP" }, "created_at": "2021-08-02T22:20:52.861Z", "updated_at": "2021-08-02T22:20:53.215Z", "availability": "Y", "fallback": "N", "file_ext": "png", "status": "ready", "image_updated_at": "2021-08-02T22:20:53.162Z", "image_processing_completed_at": "2021-08-02T22:20:53.211Z", "image_checksum": "1dc357753245e9b30fa20dde079734f9-1", "asset_class_id": "de8f1883-5dec-4793-917f-3ca95306528c", "content_builder_id": null, "archived": false, "ect_tags": null, "start_datetime": "2021-06-23T00:00:00.000Z", "end_datetime": "2221-06-23T23:59:59.000Z", "display_time_zone": "Osaka", "image_link": "https://ecs-asset-images-qa.s3.us-west-2.amazonaws.com/3612/21575198/f/cf868607-9eec-4e2b-ae87-3d2ca7ed7911.png?v=1dc357753245e9b30fa20dde079734f9-1", "display_time_zone_name": "Asia/Tokyo", "display_start_datetime": "2021-06-23T09:00:00+09:00", "display_end_datetime": "2221-06-24T08:59:59+09:00" } ``` # Add an Attribute To retain more information about your subscriber, add an attribute. An attribute gives you more information to use when targeting or excluding subscribers from your sends. You need to know this information to create an attribute: - The name of the attribute - The data type of the attribute - Any applicable default value - Whether the attribute accepts send time values - Any required picklist options - Minimum and maximum lengths - Whether the attribute is required - Whether the attribute is read-only - Whether the attribute is hidden You can’t create an attribute using the name of an existing attribute. After an attribute is added to a list, it’s available in all lists. # Add Column to a Data Extension To capture additional information in an existing data extension, add a column to it. ## Sample SOAP Envelope ```xml Update https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN b9bdce33-b849-4298-a288-462535f8e145 New Field 200 true ``` # Add Subscribers to a List You can use SOAP API to add subscribers to a subscriber, publication, or suppression list. You can add a subscriber to a list when you create their subscriber record, or you can update an existing subscriber to add them to a list. If your use case requires you to add a batch of subscribers to a list, start by performing an `Update` operation. After that, perform a `Create` operation to create the contacts that weren’t found during the `Update` operation. ## Sample SOAP Envelopes Use these sample SOAP envelopes as guidelines for creating requests that suit your use case. ### Create a Subscriber and Add to List This example shows how to create a subscriber and add that subscriber to a list. ```xml Create https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN dangelo.cunningham@example.com dangelo.cunningham@example.com 99887766 First Name D'Angelo Last Name Cunningham Company DreamHouse Realty ``` The body of the SOAP response contains information about the subscriber that you created and the list that they were added to. ```xml OK Created Subscriber. 0 1106974556 1106974556 dangelo.cunningham@example.com dangelo.cunningham@example.com First Name D'Angelo Last Name Cunningham Company DreamHouse Realty 99887766 2206d1db-0629-4a9d-8529-8036c06943a9 OK ``` ### Add Existing Subscriber to a List Add an existing subscriber to a list by updating the subscriber record. This sample request updates the `List.ID` property for a specified contact. ```xml Update https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN dangelo.cunningham@example.com 33445566 ``` The response body includes information about the updated subscriber. ```xml OK Updated Subscriber. 0 1234567890 dangelo.cunningham@example.com 33445566 94e3b699-0501-443a-82e0-c717154f5c1d OK ``` # Add Subscribers to a Lock and Publish Account Share content from a central administrator account to lock and publish accounts, which can edit selected content areas and send emails to their subscribers. Adding subscribers to a lock and publish account ensures that account users can send only to specific subscribers, and can only do so using approved content. ## Usage Use this code example to construct your own calls to add subscribers at the lock and publish account level. You can use ClientID or ChannelMemberID to identify the account in which to add the subscriber. ```xml USERNAME PASSWORD 123 help@example.com 123 ``` # Add Subscribers to an On-Your-Behalf Account Use On-Your-Behalf accounts to send messages from a central managing account. Messages that you send in this way include the From address of the On-Your-Behalf user. When you add subscribers to an On-Your-Behalf account, messages sent from the managing account target the appropriate subscribers. ## Sample SOAP Envelope This example code creates a subscriber in an On-Your-Behalf account. ```xml Create https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN help@example.com ChannelMemberID 123 123 ``` ## Related Items - [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) # Add() Returns the sum of two numbers. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` Add(number1, number2) ``` The `Add()` function has two parameters: - `number1` (number): Required. The first number to add. - `number2` (number): Required. The second number to add. ## Usage To use this function, pass it two numbers. The numbers can be positive or negative integer or decimal numbers. ``` %%=Add(512,256)=%% ``` The function outputs the sum of the two numbers: `768`. # Adding AMPscript to Your Content There are three ways to add AMPscript code to your content: by using inline code, by adding code blocks, or by using tag-based scripting. The first two of these methods use special delimiters to denote the beginning and ending of the code that you want Marketing Cloud Engagement to interpret. In the third method, you delineate the AMPscript code with ` ``` # Adding Data to Data Extension Object Add more data to an existing data extension object when you add new records to your data extension. ## Usage This code example contains a SOAP envelope that you can use to add data to an existing data extension. ```xml XXXXX XXXXX Definition_Key EmailAddress johndoe@example.com FirstName John LastName Doe PrimaryKey PrimaryKey ``` # Additional Resources for Marketing Cloud Marketing Cloud Next brings the power of the Salesforce platform to your team’s marketing efforts. Because it’s a tightly integrated component of the Salesforce platform, you can quickly learn important concepts by using existing content. - [Documentation Resources](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-resources-documentation.md) - [Salesforce Platform Developer Tools](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-resources-tools.md) - [Learning Resources for Marketing Cloud](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-resources-trailhead.md) - [Marketing Cloud Next Video Library](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-resources-videos.md) # AddMscrmListMember() Adds a record—such as a lead, contact, or account—to a Microsoft Dynamics CRM marketing list. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` AddMscrmListMember(recordGuid, listGuid) ``` The `AddMscrmListMember()` function has two parameters: - `recordGuid` (string): Required. The GUID of the record that you want to add to the marketing list. - `listGuid` (string): Required. The GUID of the marketing list that you want to add the record to. ## Usage To use the function, pass it the GUID of the record that you want to add, and the GUID of the marketing list to add the record to. This example adds a lead, contact, or account to a marketing list. ``` %%[ Var @guid, @list_guid Set @guid = '58318475-9054-41e0-8b07-b66cedef9e72' Set @list_guid = '1ba5b049-e65f-4576-b8c7-78fbcd9124eb' AddMscrmListMember(@guid, @list_guid) ]%% ``` The function doesn’t return a value. # AddObjectArrayItem ## Overview Creates an item within an array for a specified API object ### Syntax AddObjectArrayItem(1, 2, 3) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ---------------------------------- | | **1** | string | **Required** | Object on which to set array value | | **2** | string | **Required** | Name of array | | **3** | string | **Required** | New array value | ## Example ``` ``` # AddObjectArrayItem() Adds an object to an array in a Marketing Cloud Engagement API object. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` AddObjectArrayItem(apiObject, arrayProperty, itemToAdd) ``` The `AddObjectArrayItem()` function has three parameters: - `apiObject` (API Object): Required. The API object that contains the array that you want to modify. - `arrayProperty` (string): Required. The array property to receive the new item. - `itemToAdd` (string): Required. The item to add to the array. ## Usage This example adds the attribute `myNewAttribute` to the `Attributes` array on the `mySubscriber` API object. ``` %%[ AddObjectArrayItem(@mySubscriber,'Attribute',@myNewAttribute) ]%% ``` Address # Address Validates email addresses to reduce the likelihood that sending an email to an address results in a bounce or spam complaint. This table lists the use cases that the Email Address Validation API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Validate an email address | [POST](/docs/marketing/marketing-cloud/references/mc_rest_address?meta=Validate%2Ban%2Bemail%2Baddress) | /address/v1/validateEmail | **Version:** 1 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### POST Validates an email address `POST /address/v1/validateEmail` Operation ID: `validateEmail`. Processes an email address through one or more validators. This operation can perform three types of validation: * `SyntaxValidator`: Validates that the email address includes a name, an at sign (@), and a domain. * `MXValidator`: Validates that a DNS mail exchange (MX) record exists on the domain of the email address. * `ListDetectiveValidator`: Validates the email address by using [List Detective](https://help.salesforce.com/s/articleView?id=mktg.mc_es_list_detective.htm), a proprietary database of email addresses that are known to be invalid or inactive. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) An object that contains the address to validate and the types of validation to perform against it. Media type: `application/json`. Schema: `validationRequestBody`. #### Responses * **200** Provides the result of the validation tests specified in the request body. If the email address passed the validation tests, the `failedValidation` property isn’t included in the response. When an email address fails a validation test, we recommend that you stop sending email to that address. This step helps reduce your bounce and complaint rates. Media type: `application/json`. Schema: `validationFail`. * **400** Indicates that your request contained errors that prevented the validation process. When you receive a 400 response, verify that the request syntax is accurate. For example, this error can occur if you specify an invalid validator type. Media type: `application/json`. Schema: `internalError`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that Marketing Cloud Engagement wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Found" } ``` * **404** Indicates that the URI in your request couldn't be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` * **500** Indicates that Marketing Cloud Engagement encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Specifically, verify that the filter query uses the required syntax and that it uses only the supported fields. Media type: `application/json`. Schema: `httpError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ## Schemas ### validationRequestBody * `email` (_string_) The email address to validate. * `validators` (_array of string_) An array that lists the validators to run against the specified email address. Items: Allowed values: `SyntaxValidator`, `MXValidator`, `ListDetectiveValidator`. _Example_ ``` { "email": "rachel.rodriquez@example.com", "validators": [ "SyntaxValidator", "MXValidator", "ListDetectiveValidator" ] } ``` ### validationFail * `email` (_string_) The email address that was processed for validation. * `valid` (_boolean_) If the value of this property is `true`, the email address passed all of the specified validations. If the value is `false`, the address failed one or more of the specified validations. * `failedValidation` (_string_) The validation test that the email address failed. If the email address passed all of the specified validations, this property isn’t included in the response. _Example_ ``` { "email": "rachel.rodriquez@example.com", "valid": false, "failedValidation": "ListDetectiveValidator" } ``` ### internalError * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. * `message` (_string_) The error message. ### httpError * `documentation` (_string_) Contains a link to [Marketing Cloud Engagement developer documentation about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The HTTP error code. * `message` (_string_) The error message. ### validationPass * `email` (_string_) The email address that was processed for validation. * `valid` (_boolean_) If the value of this property is `true`, the email address passed all of the specified validations. If the value is `false`, the address failed one or more of the specified validations. _Example_ ``` { "email": "rachel.rodriquez@example.com", "valid": true } ``` # AddressStatus Indicates the status of a subscriber address. ## Properties | Name | Data Type | Description | | -------- | ---------------------------------------------- | ------------------------- | | `Status` | [SubscriberStatus](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriberstatus.md) object | The status of an address. | ## Related Items - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber_appex.md) # AddressStatus Indicates the status of a subscriber address. ## Properties | Name | Data Type | Description | | -------- | ------------------------------------------------------------ | ------------------------- | | `Status` | [SubscriberAddressStatus](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriberaddressstatus.md) object | The status of an address. | ## Related Items - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) # Administration The following are administration technical articles for SOAP API. - [Add a User to an Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_a_new_user_to_an_existing_account.md) - [Create an Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_account.md) - [Create an Agency Client Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_agency_client_object.md) - [Access Child Account Objects](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/impersonating_another_user.md) - [Manage Enterprise 2.0 Accounts](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/managing_enterprise_20_accounts_with_the_web_services_api.md) - [Retrieve Account Object Using the CustomerKey Attribute](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_account_object_using_the_partnerkey_attribute.md) - [Set User Permissions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/setting_user_permissions_via_the_web_services_api.md) - [Use ClientID for Account Association](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/using_clientid_in_your_soap_api_code.md) - [Rate Limiting](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting.md) # Advanced Retrieves via WSProxy You can perform more complex retrieves, including the ability to set other properties on the retrieve request, including SOAP RetrieveOptions. - The first three parameters are the same as the parameters in simple retrieves. - The fourth parameter specifies the properties on the RetrieveOptions on the request. - The fifth parameter specifies any remaining properties to set on the request. These properties include “QueryAllAccounts”, “RepeatLastResult”, “RepeatAllSinceLastBatch”, and so on. ``` var prox = new Script.Util.WSProxy(); var props = { QueryAllAccounts: true }; var cols = ["Name","CustomerKey","CategoryID","IsSendable"]; var filter = { Property: "CategoryID", SimpleOperator: "equals", Value: 101367 }; var opts = { BatchSize: 25 }; var data = prox.retrieve("DataExtension", cols, filter, opts, props); ``` ## Pagination of Retrieves To retrieve more pages, use the getNextBatch function. - The first parameter is the object type. - The second parameter is the RequestID from any previous retrieve. This example loops through every email in an account and writes the Name property, then outputs the total number returned after outputting all of the items. ``` var prox = new Script.Util.WSProxy(), objectType = "Email", cols = ["Name"], moreData = true, reqID = null, numItems = 0; while(moreData) { moreData = false; var data = reqID == null ? prox.retrieve(objectType, cols) : prox.getNextBatch(objectType, reqID); if(data != null) { moreData = data.HasMoreRows; reqID = data.RequestID; if(data && data.Results) { for(var i=0; i< data.Results.length; i++) { Platform.Response.Write(data.Results[i].Name); numItems++; } } } } Platform.Response.Write("
" + numItems + " total " + objectType); ``` # AMPscript AMPscript is a scripting language that you can embed within HTML emails, text emails, landing pages, SMS messages, and push notifications from MobilePush. The system processes the script at the point where you include it in the message to render content on a subscriber-by-subscriber basis. Marketing Cloud Engagement handles all AMPscript calls at the end of the email send. AMPscript can also interact with your data extensions. Use AMPscript to include information from your data extensions in your messages and to update data extensions with information from your landing pages. For more information about AMPscript, see the [AMPscript Developer Guide](/docs/marketing/marketing-cloud-ampscript/overview). # AMPscript API Functions Use the AMPscript API functions to interact with the [Marketing Cloud Engagement SOAP API](https://developer.salesforce.com/docs/marketing/guides/mc-apis/web_service_guide.md). This table lists all the AMPscript functions related to the SOAP API. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ------------------------------------------------------------------------ | ---------------------------------------------------------------------- | ----------- | ---------- | | [AddObjectArrayItem()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-add-object-array.md) | Adds an object to an array in a Marketing Cloud Engagement API object. | ✅ Yes | ❌ No | | [CreateObject()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-create-object.md) | Creates an API object. | ✅ Yes | ❌ No | | [InvokeCreate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-create.md) | Invokes the Create method on an API object. | ✅ Yes | ❌ No | | [InvokeDelete()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-delete.md) | Invokes the Delete method on an API object. | ✅ Yes | ❌ No | | [InvokeExecute()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-execute.md) | Invokes the Execute method on an API object. | ✅ Yes | ❌ No | | [InvokePerform()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-perform.md) | Invokes the Perform method on an API object. | ✅ Yes | ❌ No | | [InvokeRetrieve()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-retrieve.md) | Invokes the Retrieve method on an API object. | ✅ Yes | ❌ No | | [InvokeUpdate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-invoke-update.md) | Invokes the Update method on an API object. | ✅ Yes | ❌ No | | [SetObjectProperty()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api-set-object-property.md) | Sets a value for an object created by the `CreateObject()` function. | ✅ Yes | ❌ No | # AMPscript Built-In Variables AMPscript includes several built-in variables that you can use to personalize your sites and messages. - [Personalization Strings Related to the Recipient](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-recipient.md) - [Personalization Strings Related to the Sender](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-sender.md) - [System Time and Date Strings](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-system.md) - [Message Context Variables](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-message-context.md) These variable names are case-insensitive. For emails and SMS messages, the values of time and date variables equal the date each message was sent. For CloudPages, the values of time and date variables are based on the date and time the page was rendered. # AMPscript Contact Functions Use the AMPscript Contact functions to interact with contacts in Marketing Cloud Engagement. There’s only one function related to managing contacts. You can use the [UpsertContacts()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-contacts/mc-ampscript-reference-contacts-upsert-contact.md) function to create or update contact records. This function isn’t supported in Marketing Cloud Next. # AMPscript Core Extension for Visual Studio Code Salesforce Labs has created the AMPscript Core extension for Visual Studio Code (VS Code). This extension provides AMPscript developers with several benefits, including syntax highlighting for AMPscript code. The extension can also create a server on your local computer that provides a live preview of your rendered HTML and AMPscript code. **note:** The AMPscript Core extension is a community-supported project, not an official Salesforce product. Salesforce Support can’t assist with this extension. The extension uses the Apache License, version 2.0. ## Capabilities The AMPscript Core extension for VS Code includes several capabilities: - AMPscript syntax highlighting. - A server that runs on your computer, providing a live preview of HTML and AMPscript content in your browser. - The ability to test data extension functions using local .csv files. ## Syntax Support The extension supports the majority of AMPscript keywords and syntactical elements. | Element | Example | Currently Supported? | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- | -------------------- | | [Inline AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-adding-to-content.md#inline-ampscript) | `%%=...=%%` | ✅ Yes | | [AMPscript blocks](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-adding-to-content.md#ampscript-code-blocks) | `%%[...]%%` | ✅ Yes | | [AMPscript tag syntax](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-adding-to-content.md#ampscript-tag-based-syntax) | `` | ✅ Yes | | [AMPscript variables](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-variables.md) | `@varName` | ✅ Yes | | [Logical operators](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-condition-evaluation.md) | `==`, `>=`, `<=`, `!=` | ✅ Yes | | [Loops](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-for-loops.md) | `For @counter = 1 to @repetitions do ...` | ✅ Yes | | [`If` statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-if-statements.md) | `If @value == 42 then ...` | ✅ Yes | | [System time & date strings](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-personalization-strings-system.md) | `xtlongdate`, `xtyear`, `xtmonth` | 🚫 No | | System [sender](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-personalization-strings-sender.md) and [recipient](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-personalization-strings-recipient.md) variables | `_emailaddr`, `_fullname`, `replyname` | 🚫 No | ## Function Support The extension supports AMPscript functions that are commonly used to personalize messages and evaluate conditions. | Function category | Supported? | Notes | | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Marketing Cloud Engagement SOAP API functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-api/mc-ampscript-reference-api.html) | 🚫 No | | | [Contact model functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-contacts/mc-ampscript-reference-contacts.html) | 🚫 No | | | [Content functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content.html) | 🟡 Partial | The extension can’t retrieve content from your Marketing Cloud Engagement account, but it can use data from files stored on your computer. | | [Data extension functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension.html) | 🟡 Partial | The extension can’t retrieve data extensions from your Marketing Cloud Engagement account, but it can retrieve data from CSV files stored on your computer. | | [Date and time functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time.html) | 🟡 Partial | The extension can’t retrieve information from your Marketing Cloud Engagement account, such as the timestamp for the beginning of a send. | | [Encryption functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption.html) | 🚫 No | | | [HTTP functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http.html) | 🚫 No | | | [Math functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math.html) | ✅ Yes | | | [Microsoft Dynamics CRM functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-mscrm/mc-ampscript-reference-microsoft-dynamics-crm.html) | 🚫 No | | | [Sales and Service Cloud functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce.html) | 🚫 No | | | [Site functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites.html) | 🚫 No | | | [SMS functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms.html) | 🚫 No | | | [Social functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social.html) | 🚫 No | | | [String functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string.html) | 🟡 Partial | `StringToDate()` and `StringToHex()` functions aren’t available. | | [Utility functions](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities.html) | 🟡 Partial | The extension can’t interact with your Marketing Cloud Engagement account. For example, you can’t use the `RaiseError()` function to cancel an email send. | # AMPscript Data Extension & Marketing Object Functions Use the AMPscript Data Extension functions to manage data extensions and marketing objects and work with the data that they contain. This table lists all AMPscript functions related to managing data extensions. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ----------- | ----------- | | [ClaimRow()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-claim-row.md) | Returns the first unclaimed row from a data extension. | ✅ Yes | ✅ Yes | | [ClaimRowValue()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-claim-row-value.md) | Searches a data extension for an unclaimed row and returns a value from that row. | ✅ Yes | ✅ Yes | | [DataExtensionRowCount()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-de-row-count.md) | Returns the number of rows in a data extension. | ✅ Yes | ❌ No | | [DeleteData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data.md) | Deletes rows from a data extension in CloudPages, microsites, landing pages, and SMS messages. | ✅ Yes | ❌ No | | [DeleteDE()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-de.md) | Deletes rows from a data extension in an email. | ✅ Yes | ❌ No | | [ExecuteFilter()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-execute-filter.md) | Executes a data filter and returns an unordered rowset that contains the results. | ✅ Yes | ❌ No | | [ExecuteFilterOrderedRows()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-execute-filter-ordered-rows.md) | Executes a data filter and returns an ordered rowset that contains the results. | ✅ Yes | ❌ No | | [InsertData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-insert-data.md) | Inserts rows into a data extension in CloudPages, microsites, landing pages, and SMS messages. | ✅ Yes | ❌ No | | [InsertDE()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-insert-de.md) | Inserts rows into a data extension in emails. | ✅ Yes | ❌ No | | [Field()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-field.md) | Returns a specific field from a data row or record. | ✅ Yes | ✅ Yes | | [Lookup()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup.md) | Returns a value from a data extension or marketing object. | ✅ Yes | ✅ Yes | | [LookupOrderedRows()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-ordered-rows.md) | Returns rows from a data extension sorted in ascending or descending order (case-insensitive). | ✅ Yes | ✅ Yes | | [LookupOrderedRowsCS()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-ordered-rows-cs.md) | Returns rows from a data extension sorted in ascending or descending order (case-sensitive). | ✅ Yes | ❌ No | | [LookupRows()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-rows.md) | Returns an unordered rowset from a data extension (case-insensitive). | ✅ Yes | ✅ Yes | | [LookupRowsCS()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-rows-cs.md) | Returns an unordered rowset from a data extension (case-sensitive). | ✅ Yes | ❌ No | | [Row()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row.md) | Returns a row from a rowset, array, or object. | ✅ Yes | ✅ Yes | | [RowCount()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row-count.md) | Returns the number of rows in a rowset, array, or object. | ✅ Yes | ✅ Yes | | [UpdateData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-update-data.md) | Updates data in a data extension in CloudPages, microsites, landing pages, and SMS messages. | ✅ Yes | ❌ No | | [UpdateDE()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-update-de.md) | Updates data in a data extension in emails. | ✅ Yes | ❌ No | | [UpsertData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-upsert-data.md) | Upserts data in a data extension in CloudPages, microsites, landing pages, and SMS messages. | ✅ Yes | ❌ No | | [UpsertDE()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-upsert-de.md) | Upserts data in a data extension in emails. | ✅ Yes | ❌ No | # AMPscript Date and Time Functions Use the AMPscript Date and Time functions to retrieve, transform, and display times and dates. This table lists all of the AMPscript functions related to dates and times. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ---------------------------------------------------------------------------------------- | ------------------------------------------------------- | ---------- | ----------- | | [DateAdd()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-add.md) | Adds a specified time value to a date. | ✅ Yes | ✅ Yes | | [DateDiff()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-diff.md) | Returns the difference between two dates or times. | ✅ Yes | ✅ Yes | | [DateParse()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-parse.md) | Returns a DateTime object from a date string. | ✅ Yes | ✅ Yes | | [DatePart()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-date-part.md) | Extracts a date part from a date or timestamp string. | ✅ Yes | ✅ Yes | | [FormatDate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-format-date.md) | Formats a string as a date value. | ✅ Yes | ✅ Yes | | [GetSendTime()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-get-send-time.md) | Returns a timestamp for the beginning or end of a send. | ✅ Yes | ❌ No | | [LocalDateToSystemDate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-local-date-to-system-date.md) | Converts a local datetime string to the system time. | ✅ Yes | ❌ No | | [Now()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-now.md) | Returns the current system timestamp. | ✅ Yes | ✅ Yes | | [StringToDate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-string-to-date.md) | Converts a date string to a .NET datetime object. | ✅ Yes | ✅ Yes | | [SystemDateToLocalDate()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-system-date-to-local-date.md) | Converts the system time to a local datetime string. | ✅ Yes | ❌ No | # AMPscript Encryption Functions Use the AMPscript encryption functions to encrypt or encode data. This table lists all of the AMPscript functions related to encryption. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------- | ---------- | | [DecryptSymmetric()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-decrypt-symmetric.md) | Decrypts encrypted data using the supplied algorithm and encryption values. | ✅ Yes | ❌ No | | [EncryptSymmetric()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-encrypt-symmetric.md) | Encrypts plain text data using the supplied algorithm and encryption values. | ✅ Yes | ❌ No | | [GetJwt()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-get-jwt.md) | Creates a JSON Web Token (JWT). | ✅ Yes | ❌ No | | [GetJwtByKeyName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-get-jwt-by-key-name.md) | Creates a JSON Web Token (JWT) by using a key stored in Key Management. | ✅ Yes | ❌ No | | [MD5()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-md5.md) | Converts a string to a 128-bit hexadecimal MD5 hash. | ✅ Yes | ✅ Yes | | [SHA1()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-sha1.md) | Converts a string to a 160-bit hexadecimal SHA-1 hash. | ✅ Yes | ✅ Yes | | [SHA256()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-sha256.md) | Converts a string to a 256-bit hexadecimal SHA-2 hash. | ✅ Yes | ✅ Yes | | [SHA512()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-sha512.md) | Converts a string to a 512-bit hexadecimal SHA-2 hash. | ✅ Yes | ✅ Yes | # AMPscript Examples These examples demonstrate how you can use AMPscript in your Marketing Cloud Engagement account to accomplish specific tasks. Each example includes sample AMPscript code that you can modify and use in your own account. - [Display Send-Time Content Contextually](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-examples-send-time-content.md) - [Include Content from an RSS Feed in an Email Message](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-examples-rss-feed-email.md) # AMPscript Function Parameters AMPscript functions use parameters that you must specify in a specific order. The reference section of this guide lists the parameters for each function in the order in which they must be passed. For example, the entry for the `FormatCurrency()` function shows that it has this syntax: `FormatCurrency(number, cultureCode, decimalPlaces, currencySymbol)` In this function, the number that you want to convert to a currency value (`number`), must always be listed first, followed by the locale code to use when formatting the string (`cultureCode`), and so on. ## Optional Parameters Some functions have one or more optional parameters. In the `FormatCurrency()` function, the last two parameters (`decimalPlaces` and `currencySymbol`) are optional. If you want to pass a value for the `currencySymbol`, you must also pass a value for the parameter that precedes it in order (`decimalPlaces`). In this situation, you can pass `null` or an empty string ("") to skip over parameters that you don’t want to specify. ## Function Input Types AMPscript functions accept any of these input types: - Constant values, such as `Lowercase("Mary Smith")` - Attribute values, such as `Lowercase(Name)` - Variable values, such as `Lowercase(@Name)` To prevent infinite loops, you can’t call AMPscript functions recursively. Recursive functions result in a "104 - RecursiveScriptError" exception. Email, SMS, and push messages that result in this type of exception are considered "Errored/NotSent," and count against the subscriber error limit threshold. # AMPscript Function Reference AMPscript is a scripting language for Marketing Cloud Engagement and Marketing Cloud Next. With AMPscript, you can integrate the data in your customer database with your marketing content. This integration helps you send highly personalized messages across all communication channels, including email, SMS, and mobile app messaging. In Marketing Cloud Engagement, you can also use AMPscript to create customized landing pages and microsites. This document contains reference information for AMPscript functions. For an overview of AMPscript syntax, click the [Guides](/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-get-started.html) tab. # AMPscript Functions for Mobile Messages Use these functions with mobile messages that you send using MobileConnect. These functions return values that only apply to mobile messages. You can’t use these functions in email messages, landing pages, or other content types. - `Msg(0)` - : The [Msg()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-msg.html) function returns the entire content of a mobile-originated (MO) message. A mobile-originated message is a message sent from the mobile device of a subscriber to your SMS phone number. Compare MO messages to mobile-terminated (MT) messages, which are messages that you send to a subscriber’s mobile device. The function only accepts a value of `0` as its parameter. - `Verb` - : The [Verb](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-verb.html) helper function, used together with `Msg(0)`, returns the keyword from an MO message. The function doesn’t accept any arguments. It can only retrieve the current keyword specified in MobileConnect. For example, if the keyword is “OFFER” and the MO message is “OFFER 2065550042”, then the function `Msg(0).Verb` returns a value of “OFFER”. - `Nouns` - : The [Nouns](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-nouns.html) helper function, used together with `Msg(0)`, returns all of the message content that follows the keyword. For example, if the keyword is “OFFER” and the MO message is “OFFER John Smith”, then the function `Msg(0).Nouns` returns a value of “John Smith”. - `Noun()` - : The [Noun()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-noun.html) helper function, used together with `Msg(0)`, returns a specific word in a mobile message. This function requires you to pass a parameter that indicates the position of the word in the message. A value of `0` indicates the first word in a message after the keyword, a value of `1` indicates the next word in a message, and so on. For example, `Msg(0).Noun(1)` returns the second word in the message after the keyword. - MMS_Content_URL() - : The [MMS_Content_URL()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-mms-content-url.html) function returns the URL of incoming MMS content used in a mobile message. This function works only with MobileConnect accounts when sending MMS messages. You must retrieve and store this data within your own system for later usage. For example, you can send the URL to another program that distributes the content residing at the URL to another person for review. We recommend that you use this feature with an approval filter in Media Share and Media Response message templates to prevent unauthorized content from reaching your contacts. This function requires you to provide the ordinal of the MMS content contained in the MO MMS message. A value of `0` indicates the MMS content in the current MO message. ## Usage Examples These examples illustrate common use cases for mobile-specific functions in SMS messages. ### `Msg(0)` and `Noun()` Functions This example checks the MO message for the presence of a specific word. ``` %%[ Var @msg If (Uppercase([Msg(0).Noun(0)]) == "PARTY") then Set @msg = "Downtown Luxury Hotel, 7pm, May 2" Else Set @msg = "We're sorry, but that's incorrect" EndIf ]%% %%= v(@msg) =%% ``` If the MO message contains the specified word, the value of the `@msg` variable contains a string that provides additional information. If the MO message contains a different word, then the variable contains a string that tells the subscriber that they provided the wrong keyword. ### MMS_Content_URL() Function In the Media Share template, enter an outbound response. ``` Thanks for Responding YOURKEYWORD %%=MMS_Content_URL(0)=%%. ``` The outbound message takes the URL of the MMS content from the incoming MO message. You can then take the URL and forward it to another source, such as an external site or an RSS feed. ## Other Functions In addition to these mobile-specific functions, you can also use the [InsertData()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-insert-data.html) and [DeleteData()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data.html) functions in MobileConnect messages. # AMPscript Functions for Salesforce Sales Cloud and Service Cloud Use the Salesforce AMPscript functions to interact with data in Salesforce Sales Cloud and Service Cloud. This section contains information about these AMPscript functions. | Function Name | Description | Engagement | Next | | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------- | ---------- | | [CreateSalesforceObject()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-create-object.md) | Creates a record in a Sales Cloud or Service Cloud object. | ✅ Yes | ❌ No | | [LongSfid()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-long-sfid.md) | Returns an 18-character Salesforce ID when provided with a 15-character ID. | ✅ Yes | ❌ No | | [RetrieveSalesforceJobSources()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-retrieve-job-sources.md) | Returns a rowset that contains information about a send. | ✅ Yes | ❌ No | | [RetrieveSalesforceObjects()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-retrieve-objects.md) | Returns a rowset that contains data that matches the criteria you specify. | ✅ Yes | ✅ Yes | | [UpdateSingleSalesforceObject()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-salesforce/mc-ampscript-reference-salesforce-update-single-object.md) | Updates a record in a Salesforce object. | ✅ Yes | ❌ No | # AMPscript HTTP Functions Use the AMPscript HTTP functions to retrieve and transform web data. This table lists all of the AMPscript functions related to working with web content. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ----------- | ----------- | | [HttpGet()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-get.md) | Returns the content from a specified URL. | ✅ Yes | ❌ No | | [HttpPost()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post.md) | Sends data to a URL using the POST method. | ✅ Yes | ❌ No | | [HttpPost2()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post2.md) | Sends data to a URL using the POST method with additional error handling. | ✅ Yes | ❌ No | | [IsChtmlBrowser()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-is-chtml-browser.md) | Returns a value that indicates if a device’s user agent is a CHTML browser. | ✅ Yes | ❌ No | | [RedirectTo()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-redirect-to.md) | Creates a link using data from an attribute, data extension field, or variable. | ✅ Yes | ❌ No | | [RequestHeader()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-request-header.md) | Retrieves the header from an HTTP request for a landing page. | ✅ Yes | ❌ No | | [UrlEncode()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-url-encode.md) | Modifies a string to only include characters that are safe to use in URLs. | ✅ Yes | ✅ Yes | | [WrapLongURL()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-wrap-long-url.md) | Returns a shortened URL when provided with a long URL. | ✅ Yes | ❌ No | # AMPscript Math Functions Use the math AMPscript functions to perform mathematical operations on numeric values. This table lists all of the math-related AMPscript functions. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ----------------------------------------------------- | --------------------------------------------------------------------------------- | ----------- | ----------- | | [Add()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-add.md) | Returns the sum of two numbers. | ✅ Yes | ✅ Yes | | [Divide()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-divide.md) | Returns the result of dividing the first parameter by the second parameter. | ✅ Yes | ✅ Yes | | [Mod()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-mod.md) | Returns the remainder after dividing the first parameter by the second parameter. | ✅ Yes | ✅ Yes | | [Multiply()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-multiply.md) | Returns the product of two numbers. | ✅ Yes | ✅ Yes | | [Subtract()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-subtract.md) | Returns the result of subtracting the second parameter from the first parameter. | ✅ Yes | ✅ Yes | # AMPscript Personalization Strings Related to the Recipient AMPscript includes several strings that you can use to personalize the messages that you send to your subscribers. For a complete list of supported strings, see [Personalization Strings in Email Studio](https://help.salesforce.com/s/articleView?language=en_US&id=mc_es_available_personalization_strings.htm). ## Commonly Used Strings This table shows some of the most commonly used strings related to the message recipient. | String | Description | Example | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | | `_carrierId` | An ID associated with the subscriber's mobile carrier. Based on the profile attribute "CarrierID." | 4 | | `_channel` | The messaging channel associated with the contact, as entered in the "Channel" field. | Mobile | | `_city` | The city associated with the contact, as entered in the "City" field. | Seattle | | `_createdBy` | The entity that created the contact, as entered in the contact "CreatedBy" field. | 9230589 | | `_createdDate` | The date on which the contact was created, contained in the contact CreatedDate field. | 2023-08-05 13:41:59 | | `_country_code` | Country code associated with the contact, contained in the contact CountryCode field. | US | | `_emailaddr` | The subscriber's email address. | pooja@example.com | | `_firstname` | The subscriber's first name, as entered in the profile attribute "Full Name." This string extracts the word before the first space. | Pooja | | `_fullname` | The subscriber's full name, as entered in the profile attribute "Full Name." | Pooja Chatterjee | | `_lastname` | The subscriber's last name, as entered in the profile attribute "Full Name." This string extracts the words after the first space. | Chatterjee | | `_messageTypePreference` | The subscriber's text or HTML preference. | TEXT | | `_mobileNumber` | The contact mobile number, as entered in the "MobileNumber" field. | 12065550042 | | `_modifiedBy` | The last user to modify contact information, contained in the contact ModifiedBy field. | 39958224 | | `_modifiedDate` | The last time a process modified the contact information for the subscriber. | 2023-08-05 11:31:42 | | `_priority` | The priority to use when sending a message to a contact, contained in the contact "Priority" field. | 1 | | `_source` | The source of contact information, contained in the contact "Source" field. | Mobile Opt-In | | `_sourceObjectID` | The object ID of the source of contact information, contained in the contact "SourceObjectID" field. | 4 | | `_state` | The state associated with a contact, contained in the contact "State" field. | WA | | `_status` | The send status associated with a contact, contained in the contact `Status` field. Possible values: | -1 | | `_UTCOffset` | The time offset from UTC associated with a contact, contained in the contact "UTCOffset" field. | -8 | | `_zipCode` | The ZIP code associated with a contact, contained in the contact "ZipCode" field. | 98105 | ## See Also - [Personalization Strings Related to the Sender](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-sender.md) - [System Time and Date Strings](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-system.md) # AMPscript Personalization Strings Related to the Sender AMPscript includes several strings that you can use to personalize the messages that you send to your subscribers. For a complete list of supported strings, see [Personalization Strings in Email Studio](https://help.salesforce.com/s/articleView?language=en_US&id=mc_es_available_personalization_strings.htm). ## Commonly Used Strings This table shows some of the most commonly used strings related to the sender of the message. | String | Description | Example | | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `memberid` | Your account ID (MID). | 98765 | | `replyname` | Your reply name, as defined in your account settings. | NTO Support | | `replyemailaddress` | Your reply email address. | reply-to@example.com | | `member_busname`, `member_addr`, `member_city`, `member_state`, `member_postalcode`, and `member_country` | The data entered in the Address in Email Footer fields located in your Account Information workspace. If you're creating an email based on a standard template, this data is included by default in the email footer. | Northern Trail Outfitters, 415 Mission Street, San Francisco, CA, 94105, United States | ## See Also - [Personalization Strings Related to the Recipient](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-recipient.md) - [System Time and Date Strings](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-system.md) # AMPscript Site Functions Use the functions to interact with site content in Marketing Cloud Engagement, such as CloudPages and microsites. This table lists all of the AMPscript functions related to sites. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ----------- | ----------- | | [AuthenticatedEmployeeId()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-employee-id.md) | Returns the employee ID of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEmployeeNotificationAddress()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-employee-notification-address.md) | Returns the email address of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEmployeeUserName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-employee-username.md) | Returns the username of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEnterpriseID()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-enterprise-id.md) | Returns the enterprise ID of the current authenticated landing page user. | ✅ Yes | ❌ No | | [AuthenticatedMemberID()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-member-id.md) | Returns the member ID of the authenticated landing page user. | ✅ Yes | ❌ No | | [AuthenticatedMemberName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-authenticated-member-name.md) | Returns the member name of the authenticated landing page user. | ✅ Yes | ❌ No | | [CloudPagesURL()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-cloud-pages-url.md) | Returns a CloudPages URL with an encrypted query string. | ✅ Yes | ❌ No | | [IsNullDefault()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-is-null-default.md) | Lets you create default values for empty fields in Smart Capture forms. | ✅ Yes | ✅ Yes | | [LiveContentMicrositeURL()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-live-content-microsite-url.md) | Returns a link to view live content on a microsite. | ✅ Yes | ❌ No | | [MicrositeURL()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-microsite-url.md) | Returns a microsite URL with an encrypted query string. | ✅ Yes | ❌ No | | [QueryParameter()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-query-parameter.md) | Retrieves a value from a URL query string. | ✅ Yes | ❌ No | | [Redirect()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-redirect.md) | Redirects landing page visitors to a different URL. | ✅ Yes | ❌ No | | [RequestParameter()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sites/mc-ampscript-reference-sites-request-parameter.md) | Returns the value of a parameter from a form field or landing page URL parameter. | ✅ Yes | ❌ No | # AMPscript SMS Functions Use the SMS AMPscript functions to manage SMS conversations with your contacts. This table lists all of the AMPscript functions related to SMS messaging. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------- | ---------- | | [CreateSmsConversation()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-create-sms-conversation.md) | Creates an SMS conversation. | ✅ Yes | ❌ No | | [EndSmsConversation()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-end-sms-conversation.md) | End an active SMS conversation. | ✅ Yes | ❌ No | | [SetSmsConversationNextKeyword()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-set-sms-conversation-next-keyword.md) | Sets the keyword in an SMS conversation. | ✅ Yes | ❌ No | | [Msg()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-msg.md) | Returns the body of an incoming message. | ✅ Yes | ❌ No | | [Noun()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-noun.md) | Returns a word from an incoming message based on its position. | ✅ Yes | ❌ No | | [Nouns](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-nouns.md) | Returns all of the message content after the keyword in an incoming message. | ✅ Yes | ❌ No | | [Verb](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-verb.md) | Returns the keyword from an incoming message. | ✅ Yes | ❌ No | | [MMS_Content_URL()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-sms/mc-ampscript-reference-sms-mms-content-url.md) | Returns the URL of a content item from an inbound MMS message. | ✅ Yes | ❌ No | # AMPscript Social Functions Use the AMPscript Social functions to interact with the Social Forward feature in Marketing Cloud Engagement. This table lists all of the AMPscript functions related to social forwarding. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------- | ---------- | | [GetPublishedSocialContent()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social-get-published-social-content.md) | Returns content to share on a social media site. | ✅ Yes | ❌ No | | [GetSocialPublishUrl()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social-get-social-publish-url.md) | Returns HTML code for sharing a content region on a supported social network. | ✅ Yes | ❌ No | | [GetSocialPublishUrlByName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social-get-social-publish-url-by-name.md) | Returns HTML code for sharing a content region on a supported social network. | ✅ Yes | ❌ No | # AMPscript String Functions Use the AMPscript string functions to display and manipulate strings. This table lists all of the AMPscript functions related to modifying strings. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | -------------------------------------------------------------- | --------------------------------------------------------------------------- | ----------- | ----------- | | [Char()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-char.md) | Returns a character when passed an ASCII character code. | ✅ Yes | ✅ Yes | | [Concat()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-concat.md) | Concatenates strings of text. | ✅ Yes | ✅ Yes | | [Format()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-format.md) | Formats a string in the specified format. | ✅ Yes | ✅ Yes | | [IndexOf()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-index-of.md) | Returns the position at which a substring occurs within a string. | ✅ Yes | ✅ Yes | | [Length()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-length.md) | Returns the number of characters in a string. | ✅ Yes | ✅ Yes | | [Lowercase()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-lowercase.md) | Returns the provided string using only lowercase letters. | ✅ Yes | ✅ Yes | | [ProperCase()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-propercase.md) | Returns specified string with the first letter of each word capitalized. | ✅ Yes | ✅ Yes | | [RegExMatch()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-regex-match.md) | Searches for a pattern in a string using a regular expression. | ✅ Yes | ✅ Yes | | [Replace()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-replace.md) | Replaces every occurrence of one substring with a different substring. | ✅ Yes | ✅ Yes | | [ReplaceList()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-replace-list.md) | Replaces one or more substrings with another string. | ✅ Yes | ✅ Yes | | [StringToHex()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-to-hex.md) | Converts each character in a string to its hexadecimal equivalent. | ✅ Yes | ✅ Yes | | [Substring()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-substring.md) | Returns a portion of a string, beginning at a specified character position. | ✅ Yes | ✅ Yes | | [Trim()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-trim.md) | Removes white space from the beginning and end of a string. | ✅ Yes | ✅ Yes | | [Uppercase()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-uppercase.md) | Returns the provided string using only uppercase letters. | ✅ Yes | ✅ Yes | # AMPscript System Time and Date Strings You can use the system date and time strings to output or log the date. For emails and SMS messages, the values of time and date strings are fixed to the date on which the messages were sent. For CloudPages, the values of time and date strings are based on the date on which the page was rendered. | String | Description | Example | | ---------------- | -------------------------------------------- | ------------------------ | | `xtmonth` | The full name of the month. | August | | `xtmonthnumeric` | The month expressed as a number from 1-12. | 8 | | `xtday` | The day of the month, expressed as a number. | 5 | | `xtdayofweek` | The day of the week. | Saturday | | `xtyear` | The year, expressed in four digits | 2023 | | `xtshortdate` | The full date in short format. | 08/05/2023 | | `xtlongdate` | The full date in long format. | Saturday, August 5, 2023 | ## Using Time and Date Strings with AMPscript Functions You can combine system date strings with AMPscript functions. This example shows how to change the way that the system date is presented using the `FormatDate()` function. ```

This email was sent %%=v(xtdayofweek)=%%, %%=FormatDate(xtlongdate, "d MMMM YYYY")=%%.

``` This example outputs the day, month, and year in the specified format: ``` This email was sent Saturday, 5 August 2023. ``` ## See Also - [Personalization Strings Related to the Sender](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-sender.md) - [Personalization Strings Related to the Recipient](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-personalization-strings-recipient.md) # AMPscript Utility Functions Use the AMPscript utility functions to perform several different types of tasks. The utility functions evaluate conditions, format numbers, output text, and more. This table lists all the AMPscript utility functions. The value in the Engagement column indicates whether Marketing Cloud Engagement supports the function. The value in the Next column indicates whether Marketing Cloud Next supports the function. | Function Name | Description | Engagement | Next | | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | ----------- | ----------- | | [AttributeValue()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-attribute-value.md) | Returns the value of an attribute. | ✅ Yes | ❌ No | | [Base64Decode](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-base64-decode.md) | Converts Base64-encoded binary data to a string of plain text. | ✅ Yes | ✅ Yes | | [Base64Encode](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-base64-encode.md) | Converts plain text to Base64-encoded binary data. | ✅ Yes | ✅ Yes | | [Domain()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-domain.md) | Returns the domain part of an email address. | ✅ Yes | ✅ Yes | | [Empty()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-empty.md) | Tests to see if a variable has a value. | ✅ Yes | ✅ Yes | | [FormatCurrency()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-formatCurrency.md) | Formats a number as a currency value. | ✅ Yes | ✅ Yes | | [FormatNumber()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-formatNumber.md) | Formats a number as a numeric type. | ✅ Yes | ✅ Yes | | [Guid()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-guid.md) | Returns a Globally Unique Identifier (GUID). | ✅ Yes | ✅ Yes | | [Iif()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-iif.md) | Returns one parameter if a condition is true and a different parameter if it’s false. | ✅ Yes | ✅ Yes | | [IsEmailAddress()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-is-email-address.md) | Tests whether an email address is well-formed. | ✅ Yes | ✅ Yes | | [IsNull()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-is-null.md) | Tests whether the value of a variable or function is null. | ✅ Yes | ✅ Yes | | [IsPhoneNumber()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-is-phone-number.md) | Tests whether the supplied parameter is a valid North American phone number. | ✅ Yes | ❌ No | | [Output()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output.md) | Returns the result of an AMPscript function. | ✅ Yes | ✅ Yes | | [OutputLine()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-output-line.md) | Returns the result of an AMPscript function followed by a newline character. | ✅ Yes | ✅ Yes | | [RaiseError()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-raise-error.md) | Raises an error and stops the processing of an email job. | ✅ Yes | ✅ Yes | | [Random()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-random.md) | Returns a random number within a defined range. | ✅ Yes | ✅ Yes | | [v()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-v.md) | Outputs the value of a variable. | ✅ Yes | ✅ Yes | # AMPscript Variable Functions The Variable object retrieves values from declared AMPscript variable in the JavaScript context, allowing you to use both languages as necessary for your activities. All variables must follow the AMPscript variable-naming syntax. Variable server-side JavaScript functions will add a @ prefix to any variable that does not include that prefix. These functions can only work with AMPscript variables in the current context. # API Best Practices and Use Cases Review the following API best practices and use cases: - [Best Practices to Prevent Rate-Limiting](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting-best-practices.md) - [Developer Community Integration Scenario](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/developer_community_integration_scenario.md) - [Developer Community Triggered Send Scenario](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/developer_community_triggered_send_scenario.md) - [Working with Triggered Emails in Email Studio](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggered_email_scenario_guide_for_developers.md) - [Optimize API Calls and Data Structures to Improve Performance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sfmc_data_struct_and_api_call_optimzn.md) # API Call Volume History and Usage Health Evaluate and optimize your API requests by using the API Call Volume History and Usage Health report. The report includes the API call volumes and success rates for your Marketing Cloud Engagement account. To get this report, contact your account executive. The report is available as a PDF or CSV file. ## Metrics Included in the API Call Volume History and Usage Health Report The API Call Volume History and Usage Health report includes metrics related to inbound SOAP and REST API requests made to Marketing Cloud Engagement from other applications. The report counts a batched API request as an individual request. The report also includes metrics for outbound Journey Builder custom API requests. It doesn’t count other types of outbound API requests, such as Event Notification Service requests or HTTPS postbacks for asynchronous SOAP API requests. The report also doesn’t count API requests that initiate message sends on the email, SMS, and push channels. Message sends for these channels count as super messages. See your monthly super message usage report. ## API Call Volume History and Usage Health Fields The API Call Volume History and Usage Health report includes these fields. | Field | Description | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Protocol** | The API type associated with the request. For inbound requests, the value can be either `SOAP` or `REST`. Outbound requests are identified as `Outbound`, regardless of whether the API that receives the request is a SOAP or REST API. | | **Client ID** | The client ID that was used to authenticate the request. This field is populated only for REST API requests that were authenticated using OAuth2. For all inbound SOAP API requests and outbound requests, the value of this field is `N/A`. | | **API** | The feature or service that the API request invoked. For REST requests, this field maps to the API service listed in the URL. For example, in the URL `{subdomain}.auth.marketingcloudapis.com/hub/v1/rest`, the value of the `API` field is `hub`. For SOAP requests, this field maps to a SOAP [object type](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_web_service_objects.md). The value of this field is `Other` for SOAP API requests that contain no objects, requests that contain a batch of mixed object types, and requests that fail to authenticate. For example, `GetSystemStatus` requests or requests to describe a subscriber have no objects, so the result is a value of `Other` in this field. | | **Route or Object** | For REST API requests, this field contains the endpoint URL of the request. For SOAP API requests, this field contains the name of the object that the request invoked. | | **Method** | For REST API requests, this field contains the HTTP verb that's associated with the request, such as `GET` or `POST`. For SOAP API requests, this field contains the web service API method for the request, such as `Create` or `Update`. | | **Last Month Volume** | The number of requests for the API during the most recent full calendar month. | | **Last Month Success Rate** | The percentage of requests that were completed successfully during the most recent full calendar month. The success rate is calculated by dividing the number of successful requests by the total number of requests. | | **Peak Month Volume** | The number of requests during the full calendar month that had the highest total volume of requests. | | **Overall Volume** | The total number of API requests over the specified time period. The time period can contain data from the most recent 24 calendar months. The report is sorted in descending order based on the values in this column. | ## Status Messages Whether a request counts as a success or failure depends on the response that the API returns. This table shows which SOAP API responses count as successes and which count as failures. | API Response | Status Used in Success Rate | Description | | --------------------- | --------------------------- | ------------------------------------------------------------------------------- | | **OK** | Success | All objects in the request were processed. | | **HasErrors** | Success | Some objects in the request failed, but at least one object was processed. | | **MoreDataAvailable** | Success | Additional pages of data can be retrieved. Returned only on a Retrieve request. | | **Error** | Error | None of the objects in the request were processed. | For REST requests, whether a request counts as a success or failure depends on the HTTP status code the API returns. This table shows which HTTP status codes count as successes and which count as failures. | API Response | Status Used in Success Rate | Description | | ---------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | **HTTP status code 100–199** | Success | These status codes are informational messages. | | **HTTP status code 200–299** | Success | These status codes indicate that the request was completed successfully. | | **HTTP status code 300–399** | Success | These status codes indicate that the URL of the resource has changed. | | **HTTP status code 400–499** | Failure | These status codes indicate a client-side error, such as an incorrectly formatted request, a lack of authorization, or an incorrect resource URL. | | **HTTP status code 500–599** | Failure | These status codes indicate a server-side error, such as the temporary or permanent unavailability of a resource. | Marketing Cloud Engagement doesn’t monitor success or failure responses for external APIs. As a result, all outbound requests count as successes. ## API Usage Health Indicators in the API Call Volume History and Usage Health Report Use the API Call Volume History and Usage Health report to improve the overall health of your API usage. For example, use the report to identify API types that have a low success rate. Investigate and resolve errors that occur in these APIs based on the status returned in the API response. The API Call Volume History and Usage Health report also helps you optimize your API requests so that you don’t exceed the API request limits for your account. Use the report to identify APIs with a high request volume. Next, consider batching objects in each API request to reduce the overall request volume. You can also use the report to optimize performance. For example, you can replace data extension API requests with data imports for large data extension updates. You can also use list-based sending instead of using the API to issue high-volume triggered sends. ## See Also - [Best Practices to Prevent Rate-Limiting](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting-best-practices.md) - [Optimize API Calls and Data Structures to Improve Performance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sfmc_data_struct_and_api_call_optimzn.md) - [SOAP API Performance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/api-performance.md) # API Errors For information about common API errors and resolutions, see: - [REST API Errors](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.md) - [SOAP Error Codes](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error_codes.md) - [SOAP Faults](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_faults.md) # API Functions Access the SOAP API using these functions, allowing you to create objects using SOAP API. These objects can include new messages, subscribers, or other entities within your account. For a more performant way to make API calls, see [Use Server-Side JavaScript via WSProxy with the SOAP API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_WSProxy_useSSJS.md). # API Integration To obtain credentials for authentication, add an API integration to your installed package. Under the component details, locate the client ID and client secret, if applicable. Use these credentials with your Authentication Base URI to get an access token to authenticate your API requests. Store your client ID and secret securely. Never expose this information about the client side via JavaScript or store it in a mobile application. To create an API integration, you must have the `Installed Package | Administer` permission. This permission is automatically applied to the Administrator and Marketing Cloud Administrator system-defined roles. Add the permission for a role or user in the Administration area. An enhanced package can have a server-to-server integration or a web or public app integration. These types of integration use OAuth 2.0 authentication to obtain an access token. Legacy packages don’t support OAuth 2.0, and they use legacy routes for API authentication. ## Related Items - [Installed Packages Scope](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/data-access-permissions.md) - [Your Subdomain and Your Tenant's Endpoints](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/your-subdomain-tenant-specific-endpoints.md) - [Create an OAuth 2.0 API Integration in Enhanced Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create-integration-enhanced.md) - [Create an API Integration in Legacy Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create-integration-legacy.md) # API Integration Permission Scopes To give your API integration access to the capabilities of Marketing Cloud Engagement, assign it permission scopes in Installed Packages. A scope usually represents a collection of related permissions and behaviors. Assign only the scopes that your package needs. To learn about how these scopes map to permission IDs and API resources, see [REST Permissions and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md). Server-to-server integrations that use the Client Credentials grant type perform tasks on behalf of the integration. The scopes that you assign to these integrations represent the capabilities that the integration can access. Web app and public app integrations that use the Authorization Code grant type perform tasks on behalf of an end user. These integrations use the permissions that the app and the user have in common. The scopes that you assign to these integrations represent which features the integration can access. However, the scopes don’t account for the functionality that the end user can access. To request and compare scopes against user permissions, issue a GET request to the [v2/userinfo](/docs/marketing/marketing-cloud/references/mc_rest_auth?meta=getUserInfo) endpoint after your app completes the authorization code flow. ## Channels - Email - : Enables email message management and sending. Available scopes: Read, Write, and Send. - OTT - : Enables Chat message management and sending. Available scopes: Read and Send. - Push - : Enables Push message management and sending. Available scopes: Read, Write, and Send - SMS - : Enables SMS message management and sending. Available scopes: Read, Write, and Send. - Social - : Available scopes: Read, Write, Publish, and Post. - Web - : Available scopes: Read, Write, and Publish. ## Assets - Documents and Images - : Enables management of documents and images in the portfolio or image library. Available scopes: Read and Write. - Saved Content - : Enables management of content saved in content areas, surveys, and coupons. Available scopes: Read and Write. ## Automation - Automations - : Enables management of Programs and activities. Available scopes: Read, Write, and Execute. - Journeys (Interactions) - : Enables management of Journeys. Available scopes: Read, Write, and Execute. ## Contacts - Audiences - : Available scopes: Read and Write - Lists and Subscribers - : Enables management of subscribers, lists, groups, filters, measures, and preference management. Available scopes: Read, Write ## Data - Data Extensions - : Enables management of data extensions and relationships. Available scopes: Read and Write. - File Locations - : Available scopes: Read, Write - Tracking Events - : Enables management of tracking event data associated with channels. Available scope: Read ## Hub - Approvals - : Enables management of approval items. Can edit and delete approval comments. Can enable approvals for any channel. Available scope: Write. - Calendar - : Enables management of calendar events. Available scopes: Read and Write. - Campaign - : Enables management of campaigns. Available scopes: Read and Write. - Tags - : Available scope: Write. - Workflows - : Enables management of workflow teams. Available scope: Write. ## Provisioning - Organizations - : Enables management of accounts, business units, and child accounts. Available scopes: Read and Write. - OTT Channels - : Enables management of Chat message resources. Available scopes: Read and Write. - Users - : Enables management of users, roles, and permissions. Available scopes: Read and Write. ## Webhooks - Webhooks - : Available scopes: Read, Write ## Operations That Don’t Require Permissions This table lists SOAP API operations that Installed Packages can access. You can’t change the ability of Installed Packages to access these operations. | Object | Operation | Description | | -------------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------- | | `AccountTrackingAggregate` | Retrieve | Contains email tracking information aggregated at the account level. | | `Activity` | Retrieve | Contains the definition of a workflow step or action in an automation. | | `ActivityInstance` | Retrieve | Contains information about the execution of an activity in an automation instance. | | `AsyncActivityStatus` | Retrieve | Contains information about the status of an asynchronous job. | | `AutomationInstance` | Retrieve | Contains information about the execution of an automation. | | `FrameworkHealthCheck` | Create, Delete, Retrieve, Update | Provides system health information. | | `ImportResultsSummary` | Retrieve | Contains status and summary information about an import job. | | `LinkClickTrackingAggregate` | Retrieve | Contains aggregated tracking data for link clicks. | | `ListSendTrackingAggregate` | Retrieve | Contains email tracking information aggregated by list send. | | `LowLatencyTransactionalSend` | Create | Send a transactional email. | | `Program` | Create, Delete, Perform, Retrieve, Update | Contains the definition of an automation, including its schedule and tasks. | | `ProgramInstance` | Retrieve | Contains information about a single run or execution of an automation. | | `ResultItem` | Retrieve | Contains result data for API operations. | | `ResultMessage` | Retrieve | Contains result and error messages from API operations. | | `ScheduledConversation` | Delete | Asynchronously delete a scheduled conversation. | | `ScheduledRequest` | Delete | Asynchronously delete a scheduled request. | | `SubscriberTrackingAggregate` | Retrieve | Contains email tracking information aggregated at the subscriber level. | | `Task` | Retrieve | Contains the definition of a group of activities in an automation. | | `TaskInstance` | Retrieve | Contains information about the execution of a task in an automation instance. | | `TrackingEvent` | Retrieve | Contains generic tracking events. | | `TriggeredSendTrackingAggregate` | Retrieve | Contains email tracking information aggregated by triggered send. | ## See Also - [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md) - [v2/userinfo Resource](/docs/marketing/marketing-cloud/references/mc_rest_auth?meta=getUserInfo) - [Server-to-Server Integrations with Client Credentials Grant Type](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-s2s-client-credentials.md) - [Web and Public App Integrations with Authorization Code Grant Type](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-app-auth-code.md) # API Integration Security Keep the following security considerations in mind when integrating your Salesforce apps with the Marketing Cloud Engagement API. For general guidelines around web application penetration testing for your composite app, review the [OWASP Top Ten checklist](https://www.owasp.org/index.php/Top_10_2013-Top_10). ## Enforce Least Privilege Request minimum required scope for the OAuth token for your app API token. This follows the principle of least privilege and reduces risk associated with the API token. ## Secure Storage Store only the refresh token on your external web server. Keep the access token in memory only and request a new access token when needed. Follow industry best practices to securely store the refresh token on an external platform. Treat the refresh token like a Salesforce credential. ## Secure in Transit Always enforce TLS when making calls to the Marketing Cloud Engagement APIs. Provide the access token only as the authorization header and never as query parameters. Maintain up-to-date TLS configurations on your external web server. ## Authentication and Session Management Implement authentication and session management correctly by using secure procedures to create, manage, and end a session for each authorized user. Rotate session IDs out and set them with the correct cookie flags. We recommend you use your framework’s session management features as they’re thoroughly tested and more frequently updated. ## Access Control Your app must verify the user’s session and permission levels before giving access to any restricted data or function. For example, a standard user shouldn't be able to access admin-only pages, or user A shouldn't view user B’s purchase history. ## Sensitive Information in Errors Your app must handle errors and responses correctly to avoid most of the fingerprinting and enumeration process by a possible attacker. Hide common error responses from the user, such as stack traces and debug logs, because an attacker can use these to gain more information about the server or app. ## Cross Site Request Forgery (CSRF) Attackers use this vulnerability to trick an authenticated user into performing an unwanted action on the vulnerable server. The attacker crafts a URL or a FORM inside a malicious page and tricks the user to access to it. CSRF attacks typically target state-changing requests, as there is no way for the attacker to see the response of the forged request. ## HTML Injection and Cross Site Scripting (XSS) HTML injection vulnerabilities occur when an attacker injects HTML into a vulnerable website and makes it appear as if it was originally there. For example, the attacker injects an iframe and displays a completely different page. With Cross Site Scripting, an attacker injects Javascript that executes in the context of a vulnerable domain. The attacker then crafts a payload and tricks a user into visiting the link. The attacker’s Javascript then executes on the user’s browser. ## Arbitrary Redirects A vulnerable server may perform a redirect function using user-controlled data in some URL. This allows an attacker to use a normal-looking server URL to redirect a user to a malicious site. In addition, if your site uses one page to perform forwards to other resources, an attacker could modify the input parameter and bypass permission checks. ## Remote Code Execution A web app or server may run some code that is vulnerable to specially crafted input data. That input data executes commands in the target machine. Attackers typically execute code remotely from one of three sources: 1. Web server runs some vulnerable service that listens to open ports on the internet. Resolution: Check each service that is listening at a port on your web server for vulnerabilities or public exploits. 2. Web app uses vulnerable components. Resolution: Double check every software package in your app, such as gems, nodes, or libraries, that support process documents, process images, open connections like external URI, or parse XML. 3. Application is processing user input as serialized data. Resolution: Execute deserialized user data cautiously as it could lead to remote code execution. ## Insecure Software Most applications use some kind of third-party components, such as Javascript libraries, server side frameworks, and application servers. Ensure you are using the latest available version with no known security vulnerabilities. Vulnerable versions are easy to identify and can open up your application to a broader attack surface. ## SQL Injection A SQL injection attack inserts a SQL query via the input data from the client to the application. In SQL injection attacks, SQL commands are injected as a part of user supplied input in order to effect the execution of predefined SQL commands. ## Storage of Sensitive Data Store sensitive data, such as passwords, credit card information, Social Security Numbers, and other PII, securely on servers using your platform's industry best practices for secure storage. # API Objects for Triggered Email Sends Use these API objects when you send triggered emails with Email Studio. ## TriggeredSend Objects - `TriggeredSendDefinition` - : The triggered email interaction - `TriggeredSend` - : An instance of the email being triggered. - `TriggeredSendCreateResult` - : The result of creating a TriggeredSend object. - `TriggeredSendExclusionList` - : Used to exclude subscribers from a send definition. - `TriggeredSendType` - : The triggered send type, represented by a numeric value. - `TriggeredSendStatus` - : The triggered send status, represented by a numeric value. - `SendClassification` - : The send classification of the triggered email interaction. - `DeliveryProfile` - : The record that contains the IP address, domain, header inclusion, and footer inclusion information for the triggered email interaction. - `SenderProfile` - : The record that contains the sender name and address for the triggered email interaction. ## Tracking Objects - `OpenEvent` - : An instance of a subscriber opening an email. - `SentEvent` - : An instance of a subscriber being sent an email. - `NotSentEvent` - : An instance of an email not being sent to a subscriber due to an issue with the subscriber information-for example, the subscriber being unsubscribed. - `BounceEvent` - : An instance of an email bouncing. - `UnsubEvent` - : An instance of a subscriber unsubscribing. - `ClickEvent` - : An instance of a subscriber clicking a link in an email. - `ForwardedEmailEvent` - : An instance of a subscriber forwarding an email message using the Forward-to-a-Friend feature. - `ForwardedEmailOptinEvent` - : An instance of a new subscriber opting in to a mailing list after receiving an email forwarded using the Forward-to-a-Friend feature. ## Related Items - [Working with Triggered Emails in Email Studio](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggered_email_scenario_guide_for_developers.md) - [Triggered Email Error Codes](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggered_email_scenario_guide_for_developers_errors.md) - [Triggered Email Timezone Strings](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggered_email_scenario_guide_for_developers_timezones.md) # APIObject The base object that other SOAP API objects inherit. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `ModifiedDate` | DateTime | Last time object information was modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | # APIObject The base object that other SOAP API objects inherit. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | # APIProperty Contains information related to an object, stored as a name-value pair. ## Properties | Name | Data Type | Description | | ------- | --------- | --------------------------------------------------- | | `Name` | String | Name of the object or property. | | `Value` | String | Defines value to be used in filter or other object. | # APIProperty Contains information related to an object, stored as a name-value pair. ## Properties | Name | Data Type | Description | | ------- | --------- | -------------------------- | | `Name` | String | The name of the property. | | `Value` | String | The value of the property. | ## Related Items - [Add Data to a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_data_to_data_extension_object.md) # Appexchange API Methods The following are soap_web_service_methods for Appexchange API. # Appexchange Objects This section provides objects related to AppExchange API. # Appexchange Parameters This section provides parameters related to AppExchange API. # AppExchange Partners, Upgrade SSO Claim v2 **note:** These instructions apply only to multi-tenant applications, such as apps on AppExchange. Ensure that your multi-tenant applications use the tenant-specific endpoints returned in the Claim v2 JWT for new customers on an instance other than S1 through S10. For customers on S1 through S10, your multi-tenant applications continue to make calls against the legacy ExactTarget endpoints. To support customers using tenant-specific endpoints, your app must: - Use the SSO Claim v2 JSON Web Token, or JWT, found in the App component. To update your app, contact your Partner Account Manager and see [Upgrade SSO Claim Version](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/upgrade-sso.md). - Correctly consume the Claim v2 JWT with tenant-specific endpoints. For REST API requests, make sure that your app constructs its requests using the account-specific values for the `authEndpoint` and the `apiEndpointBase` parameters. For SOAP API requests, make a REST call to request an access token. Next, issue a [GET request to the platform/v1/endpoints endpoint](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_platform?meta=Get%2BEndpoints) to find the SOAP endpoint for your account. ## Decoded JWT Before and After Upgrade ![Example Claims v2 JWT before without tenant-specific endpoints and after with tenant-specific endpoints](https://developer.salesforce.com/docs/media/images/Claimsv2JWT_sidebyside_Oct2018Release_10-31.png) ## See Also - [Upgrade SSO Claim Version](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/upgrade-sso.md) - [Single Sign-On](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/single-sign-on.md) - [Explanation of Decoded JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/explanation-decoded-jwt.md) - [Your Subdomain and Your Tenant's Endpoints](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/your-subdomain-tenant-specific-endpoints.md) # Application Utility Functions Use these functions to interact with the Marketing Cloud Engagement application. ## Load In your Server-side JavaScript code, first load the core library using this syntax: ``` Platform.Load("core","1"); ``` Use the associated sample code as models to construct your own Server-side JavaScript code. # Apply Filter to Subscriber List Use the FilterActivity object to associate a data filter to a filter activity to be used in an automation. A FilterActivity applies the logic of a data filter to a subscriber list you select to create a group of subscribers who satisfy the filter criteria. ## Sample SOAP Envelope ```xml XXXXX XXXXX eSTcdVv9GBJGgiTLlEPDuRnpTXk= 2011-05-20T14:57:13Z FilterActivityAPI FilterActivityAPI df07a3ad-cc8c-475b-bc74-b6ebe68d3892 bab35f2e-9c18-e711-ada2-38eaa791d4a1 dd4e5eee-e829-e711-ada2-38eaa791d4a1 2 2 ``` ## See Also - [FilterActivity Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filteractivity.md) # Archive an Asset Remove an asset from the Einstein Content Selection asset pool. The asset is also marked as unavailable for selection. ## Method and Endpoint ``` POST "/ecs/ecs/external/api/v1/asset//archive" ``` ## Example Request ``` POST "/ecs/ecs/external/api/v1/asset/cf868607-9eec-4e2b-ae87-3d2ca7ed7911/archive" BODY: {} ``` ## Example Response ``` { "key": "Einstein Content", "uuid": "cf868607-9eec-4e2b-ae87-3d2ca7ed7911", "type": "Other-Icons", "url": "https://www.example.com/einstein-content", "image_url": null, "custom": { "locale": "SE" }, "created_at": "2021-08-02T22:20:52.861Z", "updated_at": "2021-08-02T22:38:28.804Z", "availability": "N", "fallback": "N", "file_ext": "png", "status": "ready", "image_updated_at": "2021-08-02T22:38:28.755Z", "image_processing_completed_at": "2021-08-02T22:38:28.802Z", "image_checksum": "16afe520c3489cc77f668cb2dcfa571c-1", "asset_class_id": "f0bc4b14-c19c-49a5-a72f-1736a2afa8f9", "content_builder_id": null, "archived": true, "ect_tags": null, "start_datetime": "2021-07-23T00:00:00.000Z", "end_datetime": null, "display_time_zone": "Helsinki", "image_link": "https://ecs-asset-images-qa.s3.us-west-2.amazonaws.com/3612/21575198/f/cf868607-9eec-4e2b-ae87-3d2ca7ed7911.png?v=16afe520c3489cc77f668cb2dcfa571c-1", "display_time_zone_name": "Europe/Helsinki", "display_start_datetime": "2021-07-23T03:00:00+03:00", "display_end_datetime": null } ``` # Asset Model Examples Use these examples to created basic HTML paste and template-based emails. :::Note When pasting HTML into the content attribute, HTML contains certain reserved chars that need to be escaped in JSON. Run the HTML through a JSON escape tool first to ensure that the HTML is valid in the JSON payload. ::: - [Asset Model Examples](#asset-model-examples) - [HTML Paste Email Example](#html-paste-email-example) - [Simple Template Based Email Example](#simple-template-based-email-example) - [Complex Template Based Email Example](#complex-template-based-email-example) - [Related Items](#related-items) ## HTML Paste Email Example ```json { "name": "my first message", "channels": { "email": true, "web": false }, "views": { "html": { "content": "This is a simple html paste email." }, "text": {}, "subjectline": {}, "preheader": {} }, "assetType": { "name": "htmlemail", "id": 208 } } ``` ## Simple Template Based Email Example ```json { "assetType": { "id": 207 }, "name": "NTO Welcome Series Email", "views": { "subjectline": { "content": "Welcome %%First_Name%% to Northern Trail Outfitters" }, "preheader": {}, "html": { "content": "
", "slots": { "myslot": { "content": "", "design": "

Drop blocks or content here

" } }, "template": { "id": 108494, "assetType": { "id": 4 } } } }, "data": { "email": { "options": { "characterEncoding": "utf-8" } } } } ``` ## Complex Template Based Email Example ```json { "id": 108495, "customerKey": "090c69e7-59ac-4286-8733-f8f7613ab470", "objectID": "1cd57450-3f4a-46a8-9177-068f031ff56f", "contentType": "application/vnd.etmc.email.Message; kind=template", "assetType": { "id": 207, "name": "templatebasedemail", "displayName": "Template-Based Email" }, "name": "NTO Welcome Series Email", "description": "", "owner": { "id": 10817573, "email": "user@example.com", "name": "User" }, "createdDate": "2016-12-05T21:28:43.317-06:00", "createdBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "modifiedDate": "2016-12-07T07:43:15.17-06:00", "modifiedBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "enterpriseId": 10806781, "memberId": 10806781, "status": { "id": 1, "name": "Draft" }, "sharingProperties": { "sharedWith": [333, 555], "sharingType": "view" }, "category": { "id": 1467802, "parentId": 0, "name": "Content Builder" }, "views": { "subjectline": { "contentType": "application/vnd.etmc.email.View; kind=subjectline", "thumbnail": { "thumbnailHtml": "Welcome %%First_Name%% to Northern Trail Outfitters" }, "content": "Welcome %%First_Name%% to Northern Trail Outfitters", "meta": {}, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "preheader": { "thumbnail": { "thumbnailHtml": "" }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "text": { "data": { "email": { "options": { "generateFrom": "html" } } }, "generateFrom": "html", "modelVersion": 2 }, "viewAsAWebPage": { "thumbnail": { "thumbnailHtml": "" }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "subscriptioncenter": { "thumbnail": { "thumbnailHtml": "" }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "forwardHTML": { "thumbnail": { "thumbnailHtml": "" }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "forwardText": { "thumbnail": { "thumbnailHtml": "" }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "html": { "content": " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n Northern Trail Outfitters\n
%%Member_Busname%% registered address: \n
%%Member_Addr%% %%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%%.\n
\n
\n Contact Us | \n Store Locator | \n Manage Subscriptions | \n Update Profile | \n Unsubscribe \n
\n
\n \n \n \n \n
\n
\n \n
\n
\n
\n \n ", "slots": { "preheader": { "content": "
", "design": "

Drop blocks or content here

", "blocks": { "szcm0z6zm01hp015izi2akyb9": { "assetType": { "id": 197, "name": "htmlblock" }, "content": "
Welcome aboard!
WEB VERSION
", "design": "
", "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "heroimage": { "content": "
", "design": "

Drop blocks or content here

", "blocks": { "j0amkj3nxauswhdnyr4b73nmi": { "assetType": { "id": 199, "name": "imageblock" }, "content": "
", "design": "
", "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell01": { "content": "
", "design": "

Drop blocks or content here

", "blocks": { "2p58k7y5gk7g0kcnb6jgeklnmi": { "assetType": { "id": 197, "name": "htmlblock" }, "content": "
%%First_Name%%,

Hello and welcome! Thanks for signing up by %%Opt_in_Source%% - you're officially registered with NTO. Expect to hear from us about the latest outdoor news and all of our best offers and discounts. In the meantime, here's a few things to get you started...
", "design": "
", "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell02": { "content": "
", "design": "

Drop blocks or content here

", "blocks": { "bxfltwledxksb8ozl95n91wcdi": { "assetType": { "id": 197, "name": "htmlblock" }, "content": "
Let's get to know each other.
Take a minute to fill out your profile and communications preferences so we can send you the most relevant and timely offers and discounts.
Complete Profile
", "design": "
", "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell03": { "content": "
", "design": "

Drop blocks or content here

", "blocks": { "nnrzge987d6b1jqk2n4b1emi": { "assetType": { "id": 201, "name": "dynamicblock" }, "content": "
{{#=if (([isNTOMember] == true))}}\n{{= BeginImpressionRegion(\"NTO Start Earning Rewards\")}}
\n \n \n \n \n \n \n
\n \n \n Start earning rewards with myNTO.\n \n
As an exclusive member of myNTO, you're on your way to earning points on every NTO purchase. Keep it up! \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
{{= EndImpressionRegion()}}\n{{.else}}\n{{= BeginImpressionRegion(\"NTO Join for Discounts\")}}
\n \n \n \n \n \n \n
\n \n \n Join myNTO for exclusive discounts.\n \n
Exclusive offers and rewards have never been so easy! Join myNTO and start earning points on every purchase. \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
{{= EndImpressionRegion()}}\n{{/if}}
", "superContent": "
\n \n \n \n \n \n \n
\n \n \n Join myNTO for exclusive discounts.\n \n
Exclusive offers and rewards have never been so easy! Join myNTO and start earning points on every purchase. \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
", "meta": { "options": { "dynamicContent": { "views": { "html": { "name": "", "defaultContent": { "id": 108497, "name": "NTO Join for Discounts", "type": { "id": 197, "name": "htmlblock", "displayName": "HTML Block" }, "textContent": "
\n \n \n \n \n \n \n
\n \n \n Join myNTO for exclusive discounts.\n \n
Exclusive offers and rewards have never been so easy! Join myNTO and start earning points on every purchase. \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
", "thumbnail": "http://image.example.com" }, "dataSource": { "type": "profileattribute", "name": "Profile Attributes" }, "variants": [ { "name": "Rule 1", "content": { "id": 108496, "name": "NTO Start Earning Rewards", "asset": { "id": 108496, "customerKey": "391fa72d-d3a5-47c8-8cb0-9aa18d5e805d", "objectID": "1e91f142-b6c7-45b0-acfc-8df0925ddb9f", "assetType": { "id": 197, "name": "htmlblock", "displayName": "HTML Block" }, "name": "NTO Start Earning Rewards", "owner": { "id": 10817573, "email": "user@example.com", "name": "User" }, "createdDate": "2016-12-05T21:34:41-06:00", "createdBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "modifiedDate": "2016-12-05T21:34:41-06:00", "modifiedBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "enterpriseId": 10806781, "memberId": 10806781, "status": { "id": 1, "name": "Draft" }, "thumbnailUrl": "/v1/assets/108496/thumbnail", "category": { "id": 1467802, "parentId": 0, "name": "Content Builder" }, "options": { "generateFrom": null }, "content": "
\n \n \n \n \n \n \n
\n \n \n Start earning rewards with myNTO.\n \n
As an exclusive member of myNTO, you're on your way to earning points on every NTO purchase. Keep it up! \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
", "modelVersion": 1, "model": { "id": 197, "fileExtension": "", "name": "HTML Block", "key": "htmlblock", "parentAssetTypeID": 3, "createdDate": "2015-07-31T20:17:59-06:00", "modifiedDate": "2016-05-20T18:11:48-06:00", "businessUnitAvailability": {}, "definitionData": { "filters": { "types": ["Code", "Content Block"] }, "listingType": "HTML Block" } } }, "textContent": "
\n \n \n \n \n \n \n
\n \n \n Start earning rewards with myNTO.\n \n
As an exclusive member of myNTO, you're on your way to earning points on every NTO purchase. Keep it up! \n \n \n \n \n \n \n \n \n \n
\n Learn More \n
\n
" }, "expression": { "operand": "AND", "conditions": [ { "name": "isNTOMember", "displayName": "isNTOMember", "dataType": "boolean", "uiID": 8676, "operator": "Equals", "value": true } ] }, "expressionText": "isNTOMemberistrue", "thumbnail": "http://image.example.com" } ] } } } } }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "template": { "id": 108494, "customerKey": "9422321d-1ec4-452e-a407-9dc6657025d9", "objectID": "83db8cbc-5cbd-49b4-b0ce-7993e03fff94", "assetType": { "id": 4, "name": "template", "displayName": "Template" }, "name": "NTO Example Template", "owner": { "id": 10817573, "email": "user@example.com", "name": "User" }, "createdDate": "2016-12-05T21:28:17-06:00", "createdBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "modifiedDate": "2016-12-05T21:38:07-06:00", "modifiedBy": { "id": 10817573, "email": "user@example.com", "name": "User" }, "enterpriseId": 10806781, "memberId": 10806781, "status": { "id": 1, "name": "Draft" }, "category": { "id": 1467802, "parentId": 0, "name": "Content Builder" }, "content": " \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n \n \n \n \n \n \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n Northern Trail Outfitters\n
%%Member_Busname%% registered address: \n
%%Member_Addr%% %%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%%.\n
\n
\n Contact Us | \n Store Locator | \n Manage Subscriptions | \n Update Profile | \n Unsubscribe \n
\n
\n \n \n \n \n
\n
\n \n
\n
\n
\n \n ", "slots": { "preheader": { "content": "", "design": "

Drop blocks or content here

", "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "heroimage": { "content": "", "design": "

Drop blocks or content here

", "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell01": { "content": "", "design": "

Drop blocks or content here

", "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell02": { "content": "", "design": "

Drop blocks or content here

", "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "cell03": { "content": "", "design": "

Drop blocks or content here

", "maxBlocks": 0, "allowedBlocks": [], "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 }, "data": { "email": { "options": { "generateFrom": "" } } }, "modelVersion": 2 } } }, "data": { "campaigns": { "campaigns": [ { "CampaignId": 14263, "CampaignAssociationId": 39882 } ] }, "email": { "options": { "characterEncoding": "utf-8" }, "attributes": [ { "DisplayName": "sample_attribute", "Name": "__AdditionalEmailAttribute1", "Value": "your_tracking", "Order": 1, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" }, { "DisplayName": "utm_medium", "Name": "__AdditionalEmailAttribute2", "Value": "salesforce", "Order": 2, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" }, { "DisplayName": "utm_campaign", "Name": "__AdditionalEmailAttribute3", "Value": "newsletter", "Order": 3, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" }, { "DisplayName": "utm_source", "Name": "__AdditionalEmailAttribute4", "Value": "email", "Order": 4, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" }, { "DisplayName": "__AdditionalEmailAttribute5", "Name": "__AdditionalEmailAttribute5", "Value": "50_percent_off", "Order": 5, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" } ], "legacy": { "legacyId": 3272283, "legacyKey": "090c69e7-59ac-4286-8733-f8f7613ab470", "legacyType": "email", "legacyCategoryId": 1609187 } } }, "modelVersion": 2 } ``` Character encoding in `data.email.options.characterEncoding` can be one of the following: - utf-8 - us-ascii - shift_jis - EUC-KR - iso-8859-1 - iso-8859-2 - iso-8859-6 - iso-8859-11 - big5 - koi8-r - iso-2022-jp - GB2312 ## Related Items [List of Asset Types](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/base-asset-types.md) # Asset Model Reference The asset model offers a comprehensive representation of content across Marketing Cloud Engagement. This model makes it easy for other clouds, partners, and clients to build their own content representation. The model supports all types of assets, such as emails, HTML, and images. Assets are hierarchical and can contain assets within assets, within assets. The examples in this documentation are in the context of a partner company that uses the CMS for its email business. - [Asset Type](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_type.md) - [File Upload](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/file_upload.md) - [Customer Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/customer_key.md) - [Categories](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/categories.md) - [Channels](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/channels.md) - [Views](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/views.md) - [Content](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/content.md) - [Slots](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/slots.md) - [Blocks](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/blocks.md) - [Design and Super Content](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/design_super_content.md) - [Data](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/data.md) - [Meta](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/meta.md) - [Sharing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sharing.md) - [Template](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_template.md) ## Related Items - [Asset Model Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) # Asset Type Every asset has a type, such as email, template, block, cloud page, jpg image, or pdf document. The asset model parses, stores, and searches all assets in the same way, regardless of type, but the type is important to distinguish assets in queries and in the Content Builder UI. Add an asset type to the asset as an object, using the `assetType` attribute. When creating an asset, only an assetType.id is required. If the assetType.name is omitted or doesn't match the ID, the API automatically sets the name. Creating a webpage (AssetTypeID 205) doesn't create the asset in the CloudPages UI. ## Sample Empty Asset ```json { "name": "NTO Welcome Series Email", "assetType": { "name": "templatebasedemail", "id": 207 } } ``` ## Related Items - [Asset Model](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset-model.md) - [Asset Model Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) - [List of Asset Types](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/base-asset-types.md) Assets # Assets Manage Content Builder assets and categories. This table lists the use cases that the API supports. | Supported Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Get assets by simple filter](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getAssetsSimpleQuery) | GET | /asset/v1/content/assets | | [Create asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=createAsset) | POST | /asset/v1/content/assets | | [Get assets by advanced query](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getAssetsAdvancedQuery) | GET | /asset/v1/content/assets/query | | [Get salutations](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getSalutations) | GET | /asset/v1/content/assets/salutations | | [Get asset by ID](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getAsset) | GET | /asset/v1/content/assets/{id} | | [Update asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=updateAsset) | PUT | /asset/v1/content/assets/{id} | | [Patch asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=patchAsset) | PATCH | /asset/v1/content/assets/{id} | | [Delete asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=deleteAsset) | DELETE | /asset/v1/content/assets/{id} | | [Get file](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getFile) | GET | /asset/v1/content/assets/{id}/file | | [Get header and footer](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getHeaderAndFooter) | GET | /asset/v1/content/assets/{id}/headerandfooter | | [Archive asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=archiveAsset) | POST | /asset/v1/content/assets/{id}/archive | | [Restore asset](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=restoreAsset) | POST | /asset/v1/content/assets/{id}/restore | | [Create category](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=createCategory) | POST | /asset/v1/content/categories | | [Get categories](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getCategories) | GET | /asset/v1/content/categories | | [Get category by ID](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getCategory) | GET | /asset/v1/content/categories/{id} | | [Update category](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=updateCategory) | PUT | /asset/v1/content/categories/{id} | | [Delete category](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=deleteCategory) | DELETE | /asset/v1/content/categories/{id} | | [Get channel view](/docs/marketing/marketing-cloud/references/mc_rest_assets?meta=getChannelView) | GET | /asset/v1/content/assets/{id}/channelviews/{viewname} | **Version:** 1 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant.` ## Operations ### GET Get assets by simple filter `GET /asset/v1/content/assets` Operation ID: `getAssetsSimpleQuery`. Retrieve a collection of assets by applying basic filters and sorting rules. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$page` (query, integer) Page number to return from the paged results. Start with 1 and continue until you get zero results. Typically provided along with the $pagesize parameter. * `$pagesize` (query, integer) Number of results per page to return. Typically provided along with the $page parameter. * `$orderBy` (query, string) Determines which property to use for sorting, and also determines the direction in which to sort the data. If you don’t provide the `$orderBy` parameter, results are sorted by ID in ascending order. For assets, use asset property name. For categories, use a property name, such as `name asc`. * `$filter` (query, string) Filter by property using a simple operator and value. For GET /assets, filter by an asset's property. For GET /categories, filter by ParentId. ParentId is the only allowed field. * `$fields` (query, string) Comma-delimited string of asset properties used to reduce the size of your results to only the properties you need. Used only for GET /asset/v1/content/assets. #### Responses * **200** Indicates that the assets were retrieved successfully. Media type: `application/json`. Schema: `AssetCollectionResponse`. _Example_ ``` { "count": 1, "page": 1, "pageSize": 25, "links": {}, "items": [ { "id": 999999, "customerKey": "e433dd9b-82a9-44cc-a3e3-66b8ed60550a", "assetType": { "id": 28, "name": "png", "displayName": "Image" }, "fileProperties": { "extension": "png", "fileSize": 6578, "fileCreatedDate": "2026-02-16T15:16:26.8284748-08:00", "width": 500, "height": 107, "publishedURL": "https://image.s4.sfmc-content.com/lib/ef3785739738647c7a77/m/1/NTOLogoHeader_small.png" }, "name": "NTOLogoHeader_small", "description": "Northern Trail Logo Header Small", "modelVersion": 2 } ] } ``` * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### POST Create asset `POST /asset/v1/content/assets` Operation ID: `createAsset`. Creates a new asset. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `AssetRequestBody`. #### Responses * **200** The asset was created successfully. Media type: `application/json`. Schema: `AssetResponseBody`. _Example_ ``` { "id": 992589, "customerKey": "e433dd9b-82a9-44cc-a3e3-66b8ed60550a", "objectID": "b5b90b6b-dd88-4d9e-8cbd-82a0411a1114", "assetType": { "id": 28, "name": "png", "displayName": "Image" }, "fileProperties": { "fileName": "NTOLogoHeader_small.png", "extension": "png", "fileSize": 6578, "fileCreatedDate": "2026-02-16T15:16:26.8284748-08:00", "width": 500, "height": 107, "publishedURL": "https://image.s4.sfmc-content.com/lib/ef3785739738647c7a77/m/1/NTOLogoHeader_small.png" }, "name": "NTOLogoHeader_small", "description": "Northern Trail Logo Header Small", "owner": { "id": 8888888, "email": "", "name": "API user", "userId": "5555555" }, "createdDate": "2026-02-16T15:16:26.8284748-08:00", "createdBy": { "id": 8888888, "email": "", "name": "API user", "userId": "5555555" }, "modifiedDate": "2026-02-16T15:16:26.8284748-08:00", "modifiedBy": { "id": 8888888, "email": "", "name": "API user", "userId": "5555555" }, "enterpriseId": 1111111, "memberId": 987654, "status": { "id": 2, "name": "Published" }, "category": { "id": 999999, "name": "Content Builder", "parentId": 0 }, "availableViews": [], "modelVersion": 2 } ``` * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### POST Get assets by advanced query `POST /asset/v1/content/assets/query` Operation ID: `getAssetsAdvancedQuery`. Use an advanced query to retrieve a collection of assets. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `AssetAdvancedQueryRequest`. #### Responses * **200** Indicates that the assets were retrieved successfully. Media type: `application/json`. Schema: `AssetCollectionResponse`. _Example: same as GET /asset/v1/content/assets 200 response._ * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### GET Get default salutations `GET /asset/v1/content/assets/salutations` Operation ID: `getSalutations`. Retrieves the default header and footer for an account. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Responses * **200** A salutation object. Media type: `application/json`. Schema: `Salutation`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. ### GET Get asset by ID `GET /asset/v1/content/assets/{id}` Operation ID: `getAsset`. Retrieves an asset by its ID. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Responses * **200** The asset was created successfully. Media type: `application/json`. Schema: `AssetResponseBody`. _Example: same as POST /asset/v1/content/assets 200 response._ * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### PUT Update an asset `PUT /asset/v1/content/assets/{id}` Operation ID: `updateAsset`. Modify the properties of an existing asset. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Request body (required) Media type: `application/json`. Schema: `AssetRequestBody`. #### Responses * **200** The asset was created successfully. Media type: `application/json`. Schema: `AssetResponseBody`. _Example: same as POST /asset/v1/content/assets 200 response._ * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### DELETE Delete an asset `DELETE /asset/v1/content/assets/{id}` Operation ID: `deleteAsset`. Deletes an asset. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. * `isCDNDelete` (query, integer) Permanently deletes the file and its URL in the Content Delivery Network (CDN) when the associated file is deleted in Content Builder. A value of 1 permanently deletes the file. If isCDNDelete is unspecified or if the value is 0, it doesn't permanently delete the file. #### Responses * **200** Indicates that the asset was deleted successfully. Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `OK`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### PATCH Patch an asset `PATCH /asset/v1/content/assets/{id}` Operation ID: `patchAsset`. Modify the properties of an asset deleted in the last 30 days. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Request body Media type: `application/json`. Schema: `AssetRequestBody`. #### Responses * **200** The asset was created successfully. Media type: `application/json`. Schema: `AssetResponseBody`. _Example: same as POST /asset/v1/content/assets 200 response._ * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### GET Get asset file `GET /asset/v1/content/assets/{id}/file` Operation ID: `getFile`. Gets the binary file for an asset. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Responses * **200** A Base64-encoded string of the file. Media type: `application/json`. Schema: `string`. Type: `string`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### GET Get email salutations `GET /asset/v1/content/assets/{id}/salutations` Operation ID: `getHeaderAndFooter`. Retrieves the header and footer of an email asset by specifying the asset ID. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Responses * **200** Successful response. Media type: `application/json`. Schema: `Salutation`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. ### PATCH Archive an asset `PATCH /asset/v1/content/assets/{id}/archive` Operation ID: `archiveAsset`. Archive an asset. When you archive an asset, Marketing Cloud Engagement removes it from availability for queries, triggered sends, and journeys, as if the asset were deleted. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Responses * **200** OK Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `OK`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### PATCH Restore asset `PATCH /asset/v1/content/assets/{id}/restore` Operation ID: `restoreAsset`. Restore an asset hidden by a prior archive operation, and make it available again for queries, triggered sends, journeys, and other operations. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. #### Responses * **200** OK Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `OK`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### GET Get channel view `GET /asset/v1/content/assets/{id}/channelviews/{viewName}` Operation ID: `getChannelView`. Returns the compiled HTML for a requested channel view of an asset. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The ID of the asset. * `viewName` (path, string, required) The name of the asset view to retrieve. * `thumbnail` (query, boolean) Set to true to return a base64-encoded thumbnail image. * `includeHeaderFooter` (query, boolean) If asset has HTML or text views, set to true to include the message header and footer. * `includeDesignContent` (query, boolean) Set to true to include design content in the thumbnail image. #### Responses * **200** Successful response. Media type: `application/json`. Schema: `ChannelViewResponse`. * **400** Indicates that the request contained information that the API couldn’t process. If you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` ### GET Get categories `GET /asset/v1/content/categories` Operation ID: `getCategories`. Returns one or more Content Builder categories that are owned by or reside in your MID. To request categories that have been shared with your MID, add a scope parameter to the call. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$filter` (query, string) Filter by property using a simple operator and value. For GET /assets, filter by an asset's property. For GET /categories, filter by ParentId. ParentId is the only allowed field. * `$page` (query, integer) Page number to return from the paged results. Start with 1 and continue until you get zero results. Typically provided along with the $pagesize parameter. * `$pagesize` (query, integer) Number of results per page to return. Typically provided along with the $page parameter. * `$orderBy` (query, string) Determines which property to use for sorting, and also determines the direction in which to sort the data. If you don’t provide the `$orderBy` parameter, results are sorted by ID in ascending order. For assets, use asset property name. For categories, use a property name, such as `name asc`. * `scope` (query, string) Determines which MIDs the query results come from. To return categories that reside in your MID, either don't add the scope parameter or call the endpoint like this .../categories?scope=Ours. To return categories that are shared to your MID, or that you’ve shared with other MIDs, call the endpoint like this `.../categories?scope=Shared`. To return all categories visible to your MID, call the endpoint like this `.../categories?scope=Ours,Shared`. #### Responses * **200** Indicates that the categories were retrieved successfully. Media type: `application/json`. Schema: `CategoryCollectionResponse`. _Example_ ``` { "count": 1, "page": 1, "pageSize": 25, "links": {}, "items": [ { "categoryType": "asset", "description": "A description of the category.", "enterpriseId": 1111111, "id": 999999, "memberId": 987654, "name": "My Folder", "parentId": 654321, "sharingProperties": { "sharedWith": [ 2222222 ], "sharingType": "view" } } ] } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. * **500** Indicates that the API encountered an error when processing the request. If you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 500, "message": "Internal Server Error" } ``` ### POST Create category `POST /asset/v1/content/categories` Operation ID: `createCategory`. Creates a category in Content Builder. A category is a folder that contains assets. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `CategoryRequestBody`. #### Responses * **200** Indicates that the category was retrieved, created, or updated successfully. Media type: `application/json`. Schema: `CategoryUpdateResponse`. _Example_ ``` { "categoryType": "asset", "description": "A description of the category.", "enterpriseId": 1111111, "id": 999999, "memberId": 987654, "name": "My Folder", "parentId": 654321, "sharingProperties": { "sharedWith": [ 2222222 ], "sharingType": "view" } } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. * **500** Indicates that the API encountered an error when processing the request. If you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 500, "message": "Internal Server Error" } ``` ### GET Get category by ID `GET /asset/v1/content/categories/{categoryId}` Operation ID: `getCategory`. Returns one Content Builder category by ID. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `categoryId` (path, integer, required) The ID of the category. #### Responses * **200** Indicates that the category was retrieved, created, or updated successfully. Media type: `application/json`. Schema: `CategoryUpdateResponse`. _Example: same as POST /asset/v1/content/categories 200 response._ * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. * **404** This response indicates that the URI in your request couldn’t be reached. If you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` * **500** Indicates that the API encountered an error when processing the request. If you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 500, "message": "Internal Server Error" } ``` ### PUT Update category `PUT /asset/v1/content/categories/{categoryId}` Operation ID: `updateCategory`. Updates a Content Builder category. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `categoryId` (path, integer, required) The ID of the category. #### Request body (required) Media type: `application/json`. Schema: `CategoryUpdateBody`. #### Responses * **200** Indicates that the category was retrieved, created, or updated successfully. Media type: `application/json`. Schema: `CategoryUpdateResponse`. _Example: same as POST /asset/v1/content/categories 200 response._ * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. * **404** This response indicates that the URI in your request couldn’t be reached. If you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` * **500** Indicates that the API encountered an error when processing the request. If you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 500, "message": "Internal Server Error" } ``` ### DELETE Delete category `DELETE /asset/v1/content/categories/{categoryId}` Operation ID: `deleteCategory`. Deletes a Content Builder category. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud Engagement API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `categoryId` (path, integer, required) The ID of the category. #### Responses * **200** Indicates that the category was deleted. Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `OK`. * **403** This response indicates that the API accepted your request but couldn’t authorize it. If you receive a 403 response, make sure that you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `ApiError`. * **404** This response indicates that the URI in your request couldn’t be reached. If you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` * **500** Indicates that the API encountered an error when processing the request. If you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `ApiError`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 500, "message": "Internal Server Error" } ``` ## Schemas ### AssetCollectionResponse Success response for GET assets and POST assets/query. * `count` (_integer_) The number of assets that match the query or filter criteria. * `page` (_integer_) The page number of the results. * `pageSize` (_integer_) The number of assets returned per page. * `links` (_object_) A dictionary of links to the resources related to the asset collection. * `items` (_array of Asset_) An array of assets that match the query or filter criteria. ### ApiError * `message` (_string_) The error message. * `errorcode` (_number_) The error code. For some errors, this value is 0. * `documentation` (_string_) A link to documentation that describes how to handle the error. ### AssetRequestBody A request body for creating or updating an asset. * `customerKey` (_string_) The user-defined key for the asset. * `contentType` (_string_) The type that the content attribute will be in. * `data` (_object_) Property bag containing the asset data. * `assetType` (_object_) The type of the asset saved as a key-value pair. * `version` (_number_) The version of the asset. * `locked` (_boolean_) Specifies if the asset can be modified or not. * `fileProperties` (_object_) Stores the different properties that this asset refers to if it’s a file type. * `name` (_string_) The user-defined name of the asset. * `description` (_string_) A description of the asset. * `category` (_object_) ID of the category the asset belongs to. * `tags` (_array of any_) List of tags associated with the asset. * `content` (_string_) The actual content of the asset. * `design` (_string_) Fallback for display when neither content nor supercontent are provided. * `superContent` (_string_) Content that supersedes content in terms of display. * `customFields` (_object_) Custom fields within an asset. * `views` (_object_) Views within an asset. * `blocks` (_object_) Blocks within the asset. * `minBlocks` (_number_) Minimum number of blocks within an asset. * `maxBlocks` (_number_) Maximum number of blocks within an asset. * `channels` (_object_) List of channels that are allowed to use this asset. * `allowedBlocks` (_array of any_) List of blocks that are allowed in the asset. * `slots` (_object_) Slots within the asset. * `businessUnitAvailability` (_object_) A dictionary of member IDs that have been granted access to the asset. * `sharingProperties` (_AssetSharingProperties_) * `template` (_object_) Template the asset follows. * `file` (_string_) Base64-encoded string of a file associated with an asset. * `generateFrom` (_string_) Tells the sending compiler what view to use for generating this view's content. _Example_ ``` { "name": "NorthernTrailLogo_Small", "assetType": { "name": "png", "id": 28 }, "fileProperties": { "fileName": "nto_logo_sm.png" }, "file": "goK5CYIIAAAANVBORw0KG...SUhEUi=" } ``` ### AssetResponseBody An object that contains information about an asset. * `assetType` (_object_) An object that contains information about the type of the asset. * `id` (_integer_) The ID of the asset type. * `displayName` (_string_) The display name of the asset type. * `name` (_string_) The name of the asset type. * `availableViews` (_array of any_) A list of views associated with the asset. * `category` (_object_) The ID of the category the asset belongs to. * `contentType` (_string_) The type of content. * `createdBy` (_object_) The user who created the asset. * `createdDate` (_string_) The date and time the asset was created. * `customerKey` (_string_) The customer-defined key for the asset. * `data` (_object_) An object that contains the asset data. * `description` (_string_) A description of the asset. * `enterpriseId` (_number_) The enterprise ID (EID) of the account that's associated with the asset. * `id` (_integer_) The system-generated ID of the asset. * `objectID` (_string_) The GUID of the asset. * `fileProperties` (_object_) Stores the properties that this asset refers to if it's a file type. * `memberId` (_number_) The member ID (MID) of the account that's associated with the asset. * `modifiedBy` (_object_) The user who last modified the asset. * `modelVersion` (_number_) The model version of the asset. * `modifiedDate` (_string_) The date and time the asset was last modified. * `name` (_string_) The user-defined name of the asset. * `owner` (_object_) The owner of the asset. * `status` (_object_) The status of the asset. * `id` (_integer_) The ID of the status. * `name` (_string_) The name of the status. * `tags` (_array of any_) A list of tags associated with the asset. ### AssetAdvancedQueryRequest * `fields` (_array of string_) An array that specifies the fields to return in the response. Each string in the array corresponds to an asset field. * `page` (_PageObject_) * `query` (_QueryObject_, required) * `sort` (_array of SortItem_) An object that specifies how to sort the items in the response. Each object specifies a method of sorting; you can sort on multiple properties. _Example_ ``` { "page": { "page": 1, "pageSize": 50 }, "query": { "leftOperand": { "property": "version", "simpleOperator": "equal", "value": 2 }, "logicalOperator": "AND", "rightOperand": { "property": "assetType.name", "simpleOperator": "equal", "value": "Template" } }, "sort": [ { "property": "id", "direction": "ASC" } ], "fields": [ "enterpriseId", "memberId", "thumbnail", "category", "content", "data" ] } ``` ### Salutation * `htmlHeader` (_string_) The HTML header. * `htmlFooter` (_string_) The HTML footer. * `textHeader` (_string_) The text header. * `textFooter` (_string_) The text footer. ### ChannelViewResponse * `compiled` (_string_) A representation of the view. ### CategoryCollectionResponse Success response for GET categories and POST categories/query. * `count` (_integer_) The number of categories that match the query or filter criteria. * `page` (_integer_) The page number of the results. * `pageSize` (_integer_) The number of categories returned per page. * `links` (_object_) A dictionary of links to the resources related to the category collection. * `items` (_array of Category_) An array of categories that match the query or filter criteria. ### CategoryRequestBody * `categoryType` (_string_) The type of category, either asset or asset-shared, which is automatically set to the categoryType of the parent category. If set to asset-shared, include the sharingProperties in the call. * `description` (_string_) A description of the category. * `enterpriseId` (_number_) The enterprise ID (EID) of the account that's associated with the category. * `memberId` (_number_) The member ID (MID) of the account that's associated with the category. * `name` (_string_, required) Required. The name of the category. * `parentId` (_number_, required) Required. The ID of the parent category. * `sharingProperties` (_object_) Allows you to share categories with one or more business units that have Content Builder Sharing enabled. See Sharing for additional information. Stores the MIDs of business units this category is shared with and the sharing type. Only included in the response if categoryType is `asset-shared`. * `sharedWith` (_array of integer_) A list of up to 100 member IDs (MIDs) the category is shared with. To share the category with all business units in the enterprise, and if your account has access to Content Builder Across Enterprise Sharing, set this to 0. sharedWith can't contain 0 and other MIDs simultaneously. Since shared categories live in and are owned by the enterprise business unit, don't include the enterprise business unit in the sharedWith property. * `sharingType` (_string_) Indicates the permission that you’re granting to the list of MIDs in sharedWith. The only possible value for categories is edit. Allowed values: `edit`. _Example_ ``` { "name": "NTO Email Assets", "parentId": 987654 } ``` ### CategoryUpdateResponse Indicates that the category was updated successfully. * `categoryType` (_string_) The type of category. Possible values are `asset` and `asset-shared`. * `description` (_string_) A description of the category. * `enterpriseId` (_number_) The enterprise ID (EID) of the account that’s associated with the category. * `id` (_integer_) System-assigned ID for the category. * `memberId` (_number_) The member ID (MID) of the account that's associated with the category. * `name` (_string_) The name of the category. * `parentId` (_number_) The ID of the parent category. * `sharingProperties` (_object_) An object that contains the business units that the category is shared with, with and the sharing type for each business unit. This object is included in the response only if the value of categoryType is `asset-shared`. ### CategoryUpdateBody * `id` (_number_, required) Required. The unique ID of the category. * `name` (_string_, required) Required. The name of the category. * `parentId` (_number_, required) Required. The ID of the parent category. * `enterpriseId` (_number_) The enterprise ID (EID) associated with the category. * `categoryType` (_string_) The type of category. Possible values are asset and asset-shared. Allowed values: `asset`, `asset-shared`. * `memberId` (_number_) The member ID (MID) of the account associated with the category. * `sharingProperties` (_object_) An object that contains the business units that the category is shared with, with and the sharing type for each business unit. This object is included in the response only if the value of categoryType is asset-shared. * `sharedWith` (_array of integer_) A list of member IDs (MIDs) that the category is shared with. * `sharingType` (_string_) Indicates the permission that you’re granting to the list of MIDs that the category is shared with. The only possible value is edit. Allowed values: `edit`. * `description` (_string_) A description of the category. _Example_ ``` { "id": 345678, "name": "NTO Email Assets", "parentId": 987654, "categoryType": "asset", "memberId": 1111111, "enterpriseId": 2222222 } ``` ### Asset A single asset. * `allowedBlocks` (_array of any_) List of blocks that are allowed in the asset. * `assetType` (_object_) The type of the asset saved as a key-value pair. * `blocks` (_object_) Blocks within the asset. * `businessUnitAvailability` (_object_) A dictionary of member IDs that have been granted access to the asset. * `category` (_object_) ID of the category the asset belongs to. * `channels` (_object_) List of channels that are allowed to use this asset. * `content` (_string_) The actual content of the asset. * `contentType` (_string_) The type that the content attribute will be in. * `customFields` (_object_) Custom fields within an asset. * `customerKey` (_string_) A user-defined key for the asset. * `data` (_object_) Property bag containing the asset data. * `description` (_string_) Description of the asset, set by the client. * `design` (_string_) Fallback for display when neither content nor supercontent are provided. * `file` (_string_) Base64-encoded string of a file associated with an asset. * `fileProperties` (_object_) Stores the different properties that this asset refers to if it's a file type. * `generateFrom` (_string_) Tells the sending compiler what view to use for generating this view's content. * `locked` (_boolean_) Specifies if the asset can be modified or not. * `maxBlocks` (_number_) Maximum number of blocks within an asset. * `minBlocks` (_number_) Minimum number of blocks within an asset. * `modelVersion` (_number_) The model version of the asset. * `name` (_string_) Name of the asset, set by the client. 200 character maximum. * `sharingProperties` (_AssetSharingProperties_) * `slots` (_object_) Slots within the asset. * `superContent` (_string_) Content that supersedes content in terms of display. * `tags` (_array of any_) List of tags associated with the asset. * `template` (_object_) Template the asset follows. * `version` (_number_) The version of the asset. * `views` (_object_) Views within an asset. ### AssetSharingProperties Allows you to share content with one or more business units that have Content Builder Sharing enabled. See Sharing for additional information. * `sharedWith` (_object_) List of MID IDs the asset is shared with. * `sharingType` (_string_) Indicates the permission that you’re granting to the list of MIDs in sharedWith. Possible values are view, edit, or local. Allowed values: `view`, `edit`, `local`. ### PageObject An object that controls the page number and page size. * `page` (_integer_) The page number of results to be returned in the response. The default value is 1. * `pageSize` (_integer_) The number of results to be returned on each page. The default value is 50. ### QueryObject An object that contains simple queries that are united by using AND or OR logic. Contains leftOperand and rightOperand; you can also embed queries within other queries. * `leftOperand` (_QueryOperand | QueryObject_) One of: `QueryOperand`, `QueryObject`. * `logicalOperator` (_string_) The value can be either AND or OR. Allowed values: `AND`, `OR`. * `rightOperand` (_QueryOperand | QueryObject_) One of: `QueryOperand`, `QueryObject`. ### SortItem * `property` (_string_) The name of the field to sort on. * `direction` (_string_) The sort direction for the specified property. Possible values are `ASC` (to sort results in ascending order) and `DESC` (to sort in descending order). Allowed values: `ASC`, `DESC`. ### Category * `categoryType` (_string_) The type of category. Possible values are `asset` and `asset-shared`. * `description` (_string_) A description of the category. * `enterpriseId` (_number_) ID of the enterprise this business unit belongs to. * `id` (_integer_) System-assigned ID for the category. * `memberId` (_number_) ID of the member who creates the category. * `meta` (_object_) Meta is used much like the data attribute on CMS assets but for internal functionality in Content Builder. If meta is returned, be sure to pass it through the API. * `name` (_string_) Name of the category. * `parentId` (_number_) ID of the parent category. * `sharingProperties` (_object_) Stores the MIDs of business units this category is shared with and the sharing type. Only included in the response if categoryType is `asset-shared`. ### QueryOperand * `property` (_string_) The name of the field to use in the comparison. * `simpleOperator` (_string_) The comparison operator to use in the query. Possible values are equal, notEqual, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual, like, isNull, isNotNull, contains, mustContain, startsWith, in. Allowed values: `equal`, `notEqual`, `lessThan`, `lessThanOrEqual`, `greaterThan`, `greaterThanOrEqual`, `like`, `isNull`, `isNotNull`, `contains`, `mustContain`, `startsWith`, `in`. * `value` (_any_) The value to compare the specified field to. String, number, boolean, or array. ### ArchiveMessageResponse Success response for archive. * `message` (_string_) The resource was successfully archived. ### RestoreMessageResponse Success response for restore. * `message` (_string_) The resource was successfully restored. # Associate Event Data with a Contact An event is the collection of behavioral data that describes either an action a customer has taken or something that has happened to the customer. Examples of actions a customer has taken are opening an email, subscribing to a newsletter, participating in a survey, making a purchase, or calling in to a call center. Events that happen to a customer include things like having an email sent to them, being included in a direct mail campaign, receiving a call from a rep. All of the data that is collected about customer events is organized and related back to the contact record in Contact Builder. The event data can be used for filtering, personalization and driving customer journeys. Use this sample SOAP envelope with the ContactEvent object to associate event data with a contact. To batch multiple items in a single request, include multiple objects that each contain data. Don't include multiple AttributeSets in one object. ## Sample SOAP Envelope ``` 2016-09-02T13:42:09Z 2016-09-02T13:47:09Z xxxxxxxxx xxxxx cs5vIFv5flSerLrzOy0AqCtVBrY= 2016-09-02T13:42:09Z Synchronous externalkeyforprods4 2015-06 Event to Group DE ContactKey MultiObjects1 Name MultiObjects1 externalkeyforprods4 2015-06 Event to Group DE ContactKey MultiObjects2 Name MultiObjects2 ``` ## Related Items [ContactEvent Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/contactevent.md) # Asynchronous Processing Asynchronous processing works by queueing SOAP API calls in an async server before they’re processed. Asynchronous processing improves the responsiveness and processing speed of SOAP API calls. API calls aren’t dropped, even if the system is temporarily unavailable. Queued calls can be processed in the order they’re received, scheduled for processing at a specific time, or processed according to their priority. ## Get Started - [Endpoints, Methods, and Objects for Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_support.md) — Make sure that the endpoints, methods, and objects you use support asynchronous processing. - [Understand the Options Base Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_options_object.md) — To make existing calls asynchronous, include the `Options` base object parameters and specify that you want to use asynchronous processing. - [Callback Handling for Asynchronous Calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_callback.md) — We recommend that you use an HTTP POST callback to return the results of asynchronous API requests. - [Asynchronous Processing Syntax Guide](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_syntax_guide.md) — View code examples for common asynchronous processing scenarios. ## Limitations of Synchronous Processing With synchronous call processing, the system processes API calls as soon as they’re received. If the system is temporarily unavailable, synchronous API calls can’t be received and aren’t processed. If calls aren’t processed, it’s difficult to identify when a call is dropped. For example, you can send some calls again with no significant impact to the system or your customers. For processing-heavy actions, such as an email send, duplicating the call isn’t recommended. # Asynchronous Processing Syntax Guide To build your asynchronous SOAP requests, check your syntax carefully and follow the code samples in this guide. - [Minimum Asynchronous Requirement](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_min_requirement.md) - [Identify One Call](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_one_call.md) - [Identify Multiple Calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_multiple_calls.md) - [Convert Existing SOAP Calls to Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_convert_existing.md) - [Asynchronous Response Options](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_response_options.md) - [Result Detail XML Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/async_guide_result_xml_processing.md) # AsyncRequestResult Contains information about the status of an asynchronous request. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | `CallMessage` | String | A message that provides more information about the status of the request. | | `CallStatus` | String | The status of the asynchronous request. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Contains information about the account that the asynchronous request was executed from. | | `CompleteDate` | DateTime | The date and time when the asynchronous request completed. | | `CorrelationID` | String | Identifies the correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the asynchronous request was created. | | `CustomerKey` | String | A user-defined unique identifier for the request. | | `ID` | Int | A system-defined unique identifier for the request. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | A system-defined unique identifier for the request. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes the account ownership of a subscriber in an on-your-behalf account. | | `PartnerKey` | String | A unique identifier provided by a partner for an object. This property is accessible only via the API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via the API. | | `Status` | String | The status of the asynchronous request. | ## Related Items - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) # AsyncResponse Contains data that’s returned in response to an asynchronous API request. Responses are retained for 30 days. ## Properties | Name | Data Type | Description | | ----------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | | `IncludeObjects` | Boolean | When `true`, the `Object` property in the response is populated in the result XML. | | `IncludeResults` | Boolean | When `true`, the response includes XML serialized Result objects. When `false`, the HTTP POST is a basic notification. | | `OnlyIncludeBase` | Boolean | When `true`, the `Object` property in the response includes only the base API object. | | `RespondWhen` | [RespondWhen](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/respondwhen.md) object | Specifies which events cause responses to be sent for the request. | | `ResponseAddress` | String | The email address or callback URL to send responses to. | | `ResponseType` | [AsyncResponseType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponsetype.md) object | The type of response to send. Accepted values are `Email`, `HTTPPost`, and `None`. | ## Related Items - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) # AsyncResponse Contains data that’s returned in response to an asynchronous API request. Responses are retained for 30 days. ## Properties | Name | Data Type | Description | | ----------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | `IncludeObjects` | Boolean | When `true`, the response includes the API object. | | `IncludeResults` | Boolean | When `true`, the response includes the Result objects. | | `OnlyIncludeBase` | Boolean | When `true`, the response object contains only the base API object information. Includes basic reference data associating object and request. | | `RespondWhen` | [RespondWhen](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/respondwhen.md) object | Specifies which events cause responses to be sent for the request. | | `ResponseAddress` | String | The email address or public URL to send responses to. | | `ResponseType` | [AsyncResponseType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponsetype.md) object | The type of response associated with an asynchronous operation. | ## Related Items - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) # AsyncResponseType The channels for delivering asynchronous API responses (App Exchange documentation). ## Values | Name | Description | | ---------- | ------------------------------------------------ | | `Email` | The email address to send the response to. | | `FTP` | Not used. | | `HTTPPost` | The callback URL to send HTTP Post responses to. | | `None` | Default response type for AsyncResponseType. | ## Related Items - [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) # AsyncResponseType The channels for delivering asynchronous API responses. ## Values | Name | Description | | ---------- | ---------------------------------------------------------------- | | `Email` | The email address to send the response to. | | `FTP` | Not used. | | `HTTPPost` | The callback URL to send HTTP Post responses to. | | `None` | Indicates that no response is sent for the asynchronous request. | ## Related Items - [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) # AttachFile() Attaches a file to an outgoing email message. You can optionally configure this function to include a link to the file when the email is viewed as a web page. Before you use this function, you must enable AMPscript email attachments. Contact your Salesforce account executive for more information about enabling this capability. You can also contact your account executive to adjust the error threshold that causes the send job to stop prematurely. This feature helps prevent a single error from stopping the entire job. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` AttachFile(fileLocationType, fileLocation, attachmentFileName, boolViewOnWeb, viewOnWebLocation, viewOnWebFileName, viewOnWebDuration, boolContentDispositionAttachment) ``` The `AttachFile()` function has eight parameters: - `fileLocationType` (string): Required. The type of location to pull the file from. Accepted values: `http`, `ftp`, `contentbuilder`. - `fileLocation` (string): Required. The location to pull the file from. This parameter can contain a maximum of 2088 characters. If you specify `http` for the first parameter, this parameter must contain a URL. If you specify `ftp` for the first parameter, this parameter must contain the name of a file in the Import folder of your Enhanced FTP site. If you specify `contentbuilder` for the first parameter, this parameter must contain the external key of the file to attach. - `attachmentFileName` (string): The name assigned to a file when it’s attached to an email message. If you don't specify a new name, the function uses the original file name. If you specify `http` for the first parameter and don't provide a value for this parameter, the function uses the Content-Disposition information from the HTTP header. If the server providing the file doesn’t provide Content-Disposition information, the function uses an auto-generated value. - `boolViewOnWeb` (boolean): If `true`, a link to the file is included when a recipient selects the "View as a Web Page" link in the email. If `false`, the link is omitted. You can only use this parameter if the value of the first parameter is `http`. - `viewOnWebLocation` (string): The URL to use when including a link to the file in the "View as a Web Page" context. If the value of `boolViewOnWeb` is true, you must provide a value for this parameter. You can only use this parameter if the value of the first parameter is `http`. - `viewOnWebFileName` (string): The file name to use when including a link to the file in the "View as a Web Page" context. You can only use this parameter if the value of the first parameter is `http`. - `viewOnWebDuration` (number): The number of days the link appears in the "View as a Web Page" context. You can only use this parameter if the value of the first parameter is `http`. - `boolContentDispositionAttachment` (boolean): If `true`, the function changes the value of the `content-disposition` header for the attachment to `attachment`. If `false`, the value of this header is set to `inline`. ## Supported File Types You can use the `AttachFile()` function to attach the types of files listed in this table to your emails. | File Type | MIME Type | | --------- | ------------------------------------------------------------------------- | | doc | application/msword | | pdf | application/pdf | | rtf | application/rtf | | pkpass | application/vnd.apple.pkpass | | xls | application/vnd.ms-excel | | ppt | application/vnd.ms-powerpoint | | docm | application/vnd.ms-word.document.macroEnabled.12 | | pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | | xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | | docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | | rar | application/x-rar-compressed | | ics | application/ics | | xml | application/xml | | zip | application/x-zip-compressed | | zip | application/zip | | wav | audio/wav | | wav | audio/x-wav | | gif | image/gif | | jpeg | image/jpeg | | jpg | image/jpeg | | jpg | image/jpg | | png | image/png | | png | image/x-png | | tif | image/tiff | | tiff | image/tiff | | ics | text/calendar | | csv | text/csv | | htm | text/html | | html | text/html | | txt | text/plain | | rtf | text/rtf | | vcf | text/vcard | | vcf | text/x-vcard | | xml | text/xml | | mp4 | video/mp4 | ## Usage To use this function, specify the type of location where the file is stored, and the location or external key of the file. You can optionally specify additional parameters. This function supports secure transmission over HTTPS. If the remote server doesn’t respond to the `AttachFile()` call within 30 seconds, the send is rescheduled for 15 minutes later. You can only attach files contained in the account used to send the email message. This function doesn’t support shared content from Content Builder or Portfolio. ### Basic Usage This example attaches a PDF document from a website to your outgoing email. In this example, a link to the file doesn’t appear when the recipient clicks the "View as a Web Page" link in the email. ``` %%=AttachFile('HTTP','http://example.com/catalog.pdf')=%% ``` ### Basic Usage with File Hosted on Enhanced FTP Site This example attaches a Word document from the Import folder of the Enhanced FTP site. ``` %%=AttachFile('FTP','productCatalog.doc')=%% ``` ### Renaming the File This example attaches a PDF file from a website and gives the file a new name. The specified name is shown to the recipient of the email. ``` %%=AttachFile('HTTP','http://example.com/catalog.pdf','newFileName.pdf')=%% ``` ### Specifying Link Text for the "View as a Web Page" Context This example attaches a PDF file from a website, gives it a new name, and sets the value of the `boolViewOnWeb` parameter to true. When this parameter is `true`, you must also specify the URL that you want to link to in the "View as a Web Page" context. The URL that you specify can be different from the URL of the file that is attached to the email. You must also specify the link text to include. The final parameter indicates that the link only remains active in the "View as a Web Page" context for four days. ``` %%=AttachFile('HTTP','http://example.com/catalog.pdf','newFileName.pdf',true,'http://example.com/catalog.pdf','Click here to download your catalog',4)=%% ``` ## See Also - [Email Attachments](https://help.salesforce.com/s/articleView?id=mktg.mc_es_email_attachments.htm) in the Marketing Cloud Engagement Email Help documentation # Attribute Defines an attribute for a subscriber. ## Properties | Name | Data Type | Description | | ------- | --------- | -------------------- | | `Name` | String | The attribute name. | | `Value` | String | The attribute value. | ## Related Items - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber_appex.md) # Attribute Defines an attribute for a subscriber. ## Properties | Name | Data Type | Description | | ------------- | -------------------------------------------------------------- | -------------------- | | `Compression` | [CompressionConfiguration](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/compressionconfiguration.md) object | Not used. | | `Name` | String | The attribute name. | | `Value` | String | The attribute value. | ## Related Items - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) # Attribute This sub-object allows you to interact with the information in a recipient's record using the GetValue() function. # AttributeMap A data structure that contains metadata for attributes. | Name | Data Type | Description | | -------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AdditionalData` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Not used. | | `ColumnName` | String | Not used. | | `ColumnNameMappedTo` | String | Not used. | | `EntityName` | String | Not used. | | `EntityNameMappedTo` | String | Specifies the name of the external entity mapped to a column. | | `Name` | String | Name of the object or property. | | `Value` | String | Defines value to be used in filter or other object. In filters, the BETWEEN operator requires two Values. IN can handle multiple Values. All other operators require only one Value. isNull and isNotNull ignore any supplied values and don't return an error. | # Attributes.Retrieve Returns an array of attributes that are associated with a subscriber. ## Syntax `Attributes.Retrieve()` ## Example To use this function, first initialize the subscriber by using the `Subscriber.Init()` function. ``` var subObj = Subscriber.Init("SubKey"); var attributes = subObj.Attributes.Retrieve(); ``` # AttributeValue() Returns the value of an attribute. The function determines this value using data sources related to the Contact or Subscriber that the message is sent to. These sources include email subscriber profiles, data extension fields, journey entry source attributes, and MobilePush attributes. This function is a better option than making a direct reference to the attribute because it returns `null` if no data is found. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` AttributeValue(attribute) ``` The `AttributeValue()` function has one parameter: - `attribute` (string): Required. The name of the attribute to return the value of. ## Usage This example returns the value of the `RewardTierPoints` attribute from the sendable data extension associated with the message. ``` %%[ Var @rewardTierPoints, @rewardTierText Set @rewardTierPoints = AttributeValue("RewardTierPoints") /* If there's no value for RewardTierPoints in the sendable data extension, the AttributeValue() function returns null rather than causing the email send to fail. You can then handle the situation where the value is null. */ If empty(@rewardTierPoints) Then Set @rewardTierText = "You haven’t registered yet. Sign up today!" Else Set @rewardTierText = Concat("You have ", @rewardTierPoints, " points.") EndIf ]%%

%%= v(@rewardTierText) =%%

``` # AudienceItem Defines the audience that a send is directed to. ## Properties | Name | Data Type | Description | | ------------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `CustomObjectID` | String | Represents the ID of the sendable data extension used as part of a send. | | `DataSourceTypeID` | [DataSourceTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/datasourcetypeenum.md) | Defines the data source to be used in the send. Valid values include: | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `List` | [List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list.md) object | List associated with an object. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `SendDefinitionListType` | [SendDefinitionListTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senddefinitionlisttypeenum.md) | Defines the type of send definition list. Valid values include: | ## Related Items - [List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list.md) Audits # Audits Retrieve logged Audit Trail audit events and security events for the current account and its child accounts. Logins are audited at the enterprise level. Timestamps for Audit Trail data use the US Central Standard Time (GMT-6, CST) timezone. This table lists the use cases that the Audit Trail API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | [Get audit events](/docs/marketing/marketing-cloud/references/mc_rest_audit?meta=getAuditEvents) | GET | /data/v1/audit/auditEvents | | [Get security events](/docs/marketing/marketing-cloud/references/mc_rest_audit?meta=getSecurityEvents) | GET | /data/v1/audit/securityEvents | **Version:** 1.0 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. Find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET GET /data/v1/audit/auditEvents `GET /data/v1/audit/auditEvents` Operation ID: `getAuditEvents`. Retrieve logged Audit Trail audit events for the current account and its child accounts. Logins are audited at the enterprise level. Timestamps for Audit Trail data use the US Central Standard Time (GMT-6, CST) timezone. **Required Permission Scopes** To retrieve Audit Trail data, you must have the `Data | Tracking Event | Read` permission scope. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$orderBy` (query, string) The field and sort method to use to sort the results. You can sort based on the value of `createdDate` in ascending (`ASC`) or descending (`DESC`) order. The default value is `createdDate DESC`. * `$page` (query, number) The page number of results to retrieve. The default value is `1`. * `$pagesize` (query, number) The number of items to return on a page of results. The default value is `50`. * `enddate` (query, string (date-time)) End date of the date range to search for security events. Specify the value as an ISO 8601 timestamp. The value of `enddate` must occur after the value of `startdate`. The default value is today's date. * `startdate` (query, string (date-time)) Start date of the date range to search for security events. Specify the value as an ISO 8601 timestamp. The value of `startdate` must occur before the value of `enddate`. The default value is 30 days before today's date. #### Responses * **200** OK Media type: `application/json`. Schema: `auditEventsResponse`. _Example_ ``` { "page": 1, "pageSize": 50, "count": 2, "items": [ { "id": 5432, "createdDate": "2026-02-18T16:25:42.012Z", "memberId": 114411, "enterpriseId": 9876543, "employee": { "id": 314159, "employeeName": "D'Angelo Cunningham", "userName": "dcunningham@example.com" }, "objectType": { "id": 2101, "name": "MemberEmployee" }, "operation": { "id": 2, "name": "Update" }, "object": { "id": "918273", "name": "Marketer" }, "transactionId": "d3c3ecaf-244d-4f87-a37c-17d0a0888fa2" }, { "id": 5433, "createdDate": "2026-02-18T16:23:52.012Z", "memberId": 114411, "enterpriseId": 9876543, "employee": { "id": 314160, "employeeName": "Business Automation User", "userName": "automationuser" }, "objectType": { "id": 2103, "name": "Member" }, "operation": { "id": 2, "name": "Update" }, "object": { "id": "1447640", "name": "MyObject" }, "transactionId": "18360eb4-0ba7-4f48-a9ab-403c0dbfcc06" } ] } ``` * **400** Bad request. Media type: `application/json`. Schema: `auditErrorResponse`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Invalid access token or tenant-specific endpoint. Media type: `application/json`. Schema: `auditErrorResponse`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` ### GET GET /data/v1/audit/securityEvents `GET /data/v1/audit/securityEvents` Operation ID: `getSecurityEvents`. Retrieve logged Audit Trail security events for the current account and its children. Logins are audited at the enterprise level. Timestamps for Audit Trail data use the US Central Standard Time (GMT-6, CST) timezone. **Required Permission Scopes** To retrieve Audit Trail data, you must have the `Data | Tracking Event | Read` permission scope. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$orderBy` (query, string) The field and sort method to use to sort the results. You can sort based on the value of `createdDate` in ascending (`ASC`) or descending (`DESC`) order. The default value is `createdDate DESC`. * `$page` (query, number) The page number of results to retrieve. The default value is `1`. * `$pagesize` (query, number) The number of items to return on a page of results. The default value is `50`. * `enddate` (query, string (date-time)) End date of the date range to search for security events. Specify the value as an ISO 8601 timestamp. The value of `enddate` must occur after the value of `startdate`. The default value is today's date. * `startdate` (query, string (date-time)) Start date of the date range to search for security events. Specify the value as an ISO 8601 timestamp. The value of `startdate` must occur before the value of `enddate`. The default value is 30 days before today's date. #### Responses * **200** OK Media type: `application/json`. Schema: `securityEventsResponse`. _Example_ ``` { "page": 1, "pageSize": 2, "count": 2556, "items": [ { "id": 7890, "createdDate": "2026-02-18T16:25:42.012Z", "memberId": 114411, "enterpriseId": 9876543, "employee": { "employeeName": "Event Notification App API app user", "userName": "dc36c890-6b7e-4f7f-b5ab-4615566b8eb0" }, "ipAddress": "192.168.1.100", "eventType": { "id": 1, "name": "Login Attempted" }, "loginStatus": { "id": 4, "name": "Successful" }, "eventSource": { "id": 21, "name": "Fuel API" } }, { "id": 7891, "createdDate": "2026-02-18T16:23:52.012Z", "memberId": 114411, "enterpriseId": 9876543, "employee": { "employeeName": "Event Notification App API app user", "userName": "740dd418-3844-406e-98e3-50f5e2025470" }, "ipAddress": "192.168.1.101", "eventType": { "id": 1, "name": "Login Attempted" }, "loginStatus": { "id": 4, "name": "Successful" }, "eventSource": { "id": 21, "name": "Fuel API" } } ] } ``` * **400** Bad request. Media type: `application/json`. Schema: `auditErrorResponse`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Invalid access token or tenant-specific endpoint. Media type: `application/json`. Schema: `auditErrorResponse`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` ## Schemas ### auditEventsResponse OK * `page` (_number_) The page number of results. * `pageSize` (_number_) The number of items per page. * `count` (_number_) The number of items returned. * `items` (_array of auditEventItem_) ### auditErrorResponse * `message` (_string_) Error message. * `errorcode` (_number_) Error code for the exception. * `documentation` (_string_) Documentation for the error. ### securityEventsResponse OK * `page` (_number_) The page number of results. * `pageSize` (_number_) The number of items per page. * `count` (_number_) The number of items returned. * `items` (_array of securityEventItem_) ### auditEventItem * `id` (_number_) ID of the audit event. * `createdDate` (_string (date-time)_) Creation date of the audit event. * `memberId` (_number_) Member ID associated with the audit event. * `enterpriseId` (_number_) Enterprise ID or parent to which the member belongs. * `employee` (_employee_) * `objectType` (_objectType_) * `operation` (_operation_) * `object` (_auditObject_) * `transactionId` (_string (uuid)_) Unique value to identify the transaction in which the audit event was captured. ### securityEventItem * `id` (_number_) ID of the security event. * `createdDate` (_string (date-time)_) Creation date of the security event. * `memberId` (_number_) Member ID associated with the security event. * `enterpriseId` (_number_) Enterprise ID to which the member belongs. * `employee` (_employee_) * `ipAddress` (_string_) IP address associated with the security event. * `sessionId` (_string_) Session ID associated with the security event. Available only with Advanced Audit Trail. * `userAgent` (_string_) User agent associated with the security event. Available only with Advanced Audit Trail. * `eventType` (_eventType_) * `loginStatus` (_loginStatus_) * `eventSource` (_eventSource_) ### employee User associated with the audit event. * `id` (_number_) * `employeeName` (_string_) * `userName` (_string_) ### objectType Type of object used to describe the audit event. * `id` (_number_) * `name` (_string_) ### operation Action taken against the objectType. * `id` (_number_) * `name` (_string_) ### auditObject Additional information about the audited object. Can contain an ID, the name of the object, or both. * `id` (_string_) * `name` (_string_) ### eventType Type of security event. * `id` (_number_) * `name` (_string_) ### loginStatus Status of the security event. * `id` (_number_) * `name` (_string_) ### eventSource Source of the security event. * `id` (_number_) * `name` (_string_) Auth # Auth Obtain information about your API user, including account permissions, organization data, and API URLs. You can also use the Authentication API to obtain API access tokens, which are required to authenticate other requests to the API. This table lists the use cases that the Authentication API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Obtain an API token | [POST](/docs/marketing/marketing-cloud/references/mc_rest_auth?meta=Obtain%2Ban%2Baccess%2Btoken) | /v2/token | | Get base URLs | [GET](/docs/marketing/marketing-cloud/references/mc_rest_auth?meta=Get%2Bbase%2Burls) | /v2/discovery | | Get user info | [GET](/docs/marketing/marketing-cloud/references/mc_rest_auth?meta=Get%2Buser%2Binfo) | /v2/userinfo | **Version:** 1.0 ## Servers * `https://{subdomain}.auth.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### POST Obtain an API access token `POST /v2/token` Operation ID: `getAccessToken`. Obtain a unique token that authorizes you to submit requests to the Marketing Cloud API. You can use the token for up to 20 minutes. When the token expires, request a new one to continue issuing API requests. #### Request body (required) Media type: `application/json`. Schema: `tokenRequestBody`. #### Responses * **200** A successful request returns a response that includes the API token that you must provide to execute other API operations. Media type: `application/json`. Schema: `tokenResponseBody`. _Example_ ``` { "access_token": "E0VHY1VmkiLCJjbGllbnRfaWQiOiIxb3pIcXd2ZzV2VtaUtkU0_vp8n_M3pfLtSlnFEoZL7VYZfj4-hlqscpnj3cJgmoPI...", "token_type": "Bearer", "expires_in": 1079, "scope": "offline documents_and_images_read documents_and_images_write saved_content_read saved_content_write automations_execute automations_read automations_write journeys_execute journeys_read journeys_write email_read email_send email_write push_read push_send push_write sms_read sms_send sms_write ...", "soap_instance_url": "https://{tsd}.soap.marketingcloudapis.com/", "rest_instance_url": "https://{tsd}.rest.marketingcloudapis.com/" } ``` * **401** This response indicates that Marketing Cloud wasn’t able to authorize your request. When you receive a 401 response, verify that your request contains the correct client ID, client secret, and member ID. Media type: `application/json`. Schema: `authTokenErrorResponseBody`. _Example_ ``` { "error": "invalid_client", "error_description": "Invalid client ID. Use the client ID in Marketing Cloud Installed Packages.", "error_uri": "https://developer.salesforce.com/docs" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### GET Get base URLs `GET /v2/discovery` Operation ID: `getBaseUrls`. Obtain the base URLs for the Marketing Cloud Auth and REST APIs. These application-specific URLs are unique to your Marketing Cloud account and installed package. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the Marketing Cloud API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `clientId` (query, string, required) Client ID for the application. You can find the client ID in Marketing Cloud Setup > Apps > Installed Packages > {your\_package\_name}. * `resource` (query, string, required) The Marketing Cloud username to retrieve URLs for. Use the format `acct:{username}`, where `{username}` is the Marketing Cloud username. #### Responses * **200** A successful request returns a response that includes the base URLs for the Authentication and REST APIs. Media type: `application/json`. Schema: `baseUrlResponseBody`. _Example_ ``` { "subject": "acct:michele.hansley", "links": [ { "rel": "auth_instance_url", "href": "https://mctf0q1y5r3hhc20--l3kexample.auth.marketingcloudapis.com/" }, { "rel": "rest_instance_url", "href": "https://mctf0q1y5r3hhc20--l3example.rest.marketingcloudapis.com/" } ] } ``` * **400** This response indicates that Marketing Cloud wasn’t able to execute your request. This error can occur when one or more required parameters are missing in the request. Make sure that the request includes both the `client_id` and `resource` parameters and that the values of these parameters are valid. Media type: `application/json`. Schema: `authTokenErrorResponseBody`. _Example_ ``` { "error": "invalid_client", "error_description": "Invalid client ID. Use the client ID in Marketing Cloud Installed Packages.", "error_uri": "https://developer.salesforce.com/docs" } ``` * **401** This response indicates that Marketing Cloud wasn’t able to authorize your request. When you receive a 401 response, verify that you've obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `authTokenErrorResponseBody`. _Example_ ``` { "error": "unauthorized", "error_description": "Unauthorized", "error_uri": "https://developer.salesforce.com/docs" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### GET Get user information `GET /v2/userinfo` Operation ID: `getUserInfo`. Retrieves information about the account and user that are associated with the access token. Supply the access token in the authorization header. User information includes the account name, email, and ID. Account information includes the member ID (MID) and enterprise ID (EID). Application information includes the base URLs for REST and SOAP APIs, redirect URLs, and scopes. Permission information includes the permission name and ID. For more information, see [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_rest_permission_scopes/rest-permissions-and-scopes.html). > **Note** > > Use a tenant-specific endpoint to retrieve user information. If you use a global endpoint, the API returns a `401 Unauthorized` error. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the Marketing Cloud API. Replace `YOUR_ACCESS_TOKEN` with your Marketing Cloud API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Responses * **200** A successful request returns a response that includes information about the user associated with the API access token. Media type: `application/json`. Schema: `userInfoResponseBody`. _Example_ ``` { "exp": 1691268129, "iss": "https://mc.exacttarget.com", "user": { "sub": "334455667", "name": "Michele Hansley", "preferred_username": "d8c80930-30d9-411a-8613-d4209e3de1d9", "email": "", "locale": "en-US", "zoneinfo": "America/Chicago", "timezone": { "longName": "(GMT-06:00) Central Time (US & Canada) *", "shortName": "GMT-6", "offset": -6, "dst": true } }, "organization": { "member_id": 99999, "enterprise_id": 99999, "enterprise_name": "Northern Trail Outfitters", "account_type": "core", "stack_key": "S1", "region": "NA1", "locale": "en-US", "zoneinfo": "America/Chicago", "timezone": { "longName": "(GMT-06:00) Central Time (US & Canada) *", "shortName": "GMT-6", "offset": -6, "dst": true } }, "rest": { "rest_instance_url": "https://mct3f0q1y5rhhc20--l3kexample.rest.marketingcloudapis.com/", "soap_instance_url": "https://mct3f0q1y5rhhc20--l3kexample.soap.marketingcloudapis.com/" }, "application": { "id": "06238661-8596-4abb-bd06-49e2a5465b9a", "name": "API Application", "redirectUrl": [], "appScopes": [ "campaign_read", "campaign_write" ] }, "permissions": [ { "objectTypeName": "Email", "operationName": "Create", "name": "Create", "id": 4 }, { "objectTypeName": "Email", "operationName": "View", "name": "View", "id": 5 }, { "objectTypeName": "Email", "operationName": "Update", "name": "Update", "id": 6 }, { "objectTypeName": "Email", "operationName": "Delete", "name": "Delete", "id": 7 } ] } ``` * **400** This response indicates that Marketing Cloud wasn’t able to execute your request. This error can occur when your request doesn’t include a valid API access token. Check to make sure that your request includes a token and that token is still valid. If the token is no longer valid, request a new one. Media type: `application/json`. Schema: `authTokenErrorResponseBody`. _Example_ ``` { "error": "Invalid request. Missing access token.", "error_description": "Make sure that the authorization header isn’t empty or null.", "error_uri": "https://developer.salesforce.com/docs" } ``` * **401** This response indicates that Marketing Cloud wasn’t able to authorize your request. When you receive a 401 response, verify that you've obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `authTokenErrorResponseBody`. _Example_ ``` { "error": "unauthorized", "error_description": "Unauthorized", "error_uri": "https://developer.salesforce.com/docs" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ## Schemas ### tokenRequestBody * `grant-type` (_string_) The type of access grant. Specify `client_credentials` as the value for this property. * `client_id` (_string_) The client ID of your Marketing Cloud account. * `client_secret` (_string_) The client secret for your Marketing Cloud account. * `account_id` (_string_) The member ID (MID) of your Marketing Cloud account. _Example_ ``` { "grant_type": "client_credentials", "client_id": "u62kv6duobqgod3t5example", "client_secret": "POiA9FJ6eWW2BuedVexample", "account_id": "99999" } ``` ### tokenResponseBody * `access_token` (_string_) The API access token. The access token contains 512 alphanumeric characters. * `token_type` (_string_) The type of token that was retrieved. This property always has the value `Bearer`. * `expires_in` (_integer_) The amount of time (in seconds) that the token remains valid. This property always has the value `1079`. * `scope` (_string_) The permissions that have been granted to your user. Multiple permission types are separated with a space. * `soap_instance_url` (_string_) The application-specific SOAP API URL. * `rest_instance_url` (_string_) The application-specific REST API URL. ### authTokenErrorResponseBody * `error` (_string_) The error message. * `error_description` (_string_) A description of the error that occurred. * `error_uri` (_string_) A link to the Salesforce developer documentation. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Developer Documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The HTTP error code. * `message` (_string_) The error message. ### baseUrlResponseBody * `subject` (_string_) The username of the user that you requested base URLs for. * `links` (_array of object_) An array that contains the base URLs. * `rel` (_string_) A string that indicates which API the URL applies to. Allowed values: `auth_instance_url`, `rest_instance_url`. * `href` (_string_) The application-specific URL. ### userInfoResponseBody * `exp` (_integer_) A Unix epoch timestamp that indicates when the API access token expires. * `iss` (_string_) The URL of the issuer of the API access token. * `user` (_object_) Information about the user that the access token is associated with. * `sub` (_string_) The unique ID of the user. * `name` (_string_) The user’s name. * `preferred_username` (_string_) The user’s Marketing Cloud user ID. * `email` (_string_) The email address associated with the user’s Marketing Cloud account. * `locale` (_string_) The account user’s language and country codes. * `zoneinfo` (_string_) The user’s timezone. This property uses the time zones specified in the [IANA Time Zone Database](https://www.iana.org/time-zones). * `timezone` (_object_) The user’s time zone information. * `longName` (_string_) A descriptive name for the user’s time zone. * `shortName` (_string_) A code that represents the user’s time zone offset from Coordinated Universal Time (UTC). * `offset` (_number (double)_) The offset from UTC. * `dst` (_boolean_) If this value is `true`, the user’s timezone observes daylight saving time. * `organization` (_object_) An object that contains information about the user’s organization. * `member_id` (_integer_) The Marketing Cloud account member ID (MID). * `enterprise_id` (_integer_) The Marketing Cloud top-level account enterprise ID (EID). * `enterprise_name` (_string_) The name of the top-level Marketing Cloud enterprise account. * `account_type` (_string_) The type of account. Allowed values: `core`, `reseller`, `tiered`, `enterprise`. * `stack_key` (_string_) The Marketing Cloud server instance that the account is on. * `region` (_string_) The account’s data center region. Allowed values: `NA1`, `EU1`. * `locale` (_string_) The language and country code for the top-level account. * `zoneinfo` (_string_) The organization’s timezone. This property uses the time zones specified in the [IANA Time Zone Database](https://www.iana.org/time-zones). * `timezone` (_object_) The organization’s time zone information. * `longName` (_string_) A descriptive name for the organization’s time zone. * `shortName` (_string_) A code that represents the organization’s time zone offset from Coordinated Universal Time (UTC). * `offset` (_number (double)_) The offset from UTC. * `dst` (_boolean_) If this value is `true`, the organization’s timezone observes daylight saving time. * `rest` (_object_) An object that contains API base URLs. * `rest_instance_url` (_string_) The base REST API URL. * `soap_instance_url` (_string_) The base SOAP API URL. * `application` (_object_) Information about the application. * `id` (_integer_) The application’s unique ID. * `name` (_string_) The application’s package name. * `redirectUrl` (_array of string_) The URLs for the application in the package. * `appScopes` (_array of string_) An array that lists the package scopes supported by the application. * `permissions` (_array of object_) Information about the permissions for the user. * `objectTypeName` (_string_) The type of object permission. * `operationName` (_string_) The name of the permission operation. * `name` (_string_) The permission name. * `id` (_integer_) The permission ID. For a list of permission IDs, see [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_rest_permission_scopes/rest-permissions-and-scopes.html). # Authenticate Your SOAP API Calls The first step in an API-based integration is authenticating your calls. OAuth access token authentication is the most secure way to authenticate SOAP API calls. You can also use a Marketing Cloud Engagement username and password to authenticate your calls. UsernameToken authentication isn't as secure as access token authentication. ## Authenticate with an Access Token 1. [Get a Client ID and Secret](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/api-integration.md). Obtain a client ID and secret by creating an installed package with an API Integration component. Once you have your client ID and secret credentials, use them to acquire an OAuth access token directly from the API authentication service. The user for your integrated account must have the ability to administer installed packages. 2. [Get an access token](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/create-integration-enhanced.md). Call the REST auth service to obtain an access token. 3. Use the access token to authenticate your SOAP calls in the header. This access token authorizes calls in the account where you created the token. It doesn't flow down through child accounts. ```xml YOUR_ACCESS_TOKEN ``` ## Authenticate with UsernameToken 1. When setting up the user, select **API User**. 2. For accounts with role-based permissions, select the **Role | Email | Admin | API Access | WebServices API** permission. For accounts with legacy permissions, select the **Grant the user access to the web services** permission. 3. Enable the username and password security setting. Go to **Setup | Security | Security Settings** and find the setting under **Username and Logins**. 4. Use the username and password to authenticate your SOAP calls in the header. ```xml XXXXX XXXXX ``` # AuthenticatedEmployeeId() Returns the employee ID of the current Marketing Cloud Engagement user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedEmployeeID()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedEmployeeID()) ]%% ``` The example outputs the employee ID of the Marketing Cloud Engagement user who is accessing the page. # AuthenticatedEmployeeNotificationAddress() Returns the email address of the current Marketing Cloud Engagement user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedEmployeeNotificationAddress()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedEmployeeNotificationAddress()) ]%% ``` The example outputs the email address of the Marketing Cloud Engagement user who is accessing the page. # AuthenticatedEmployeeUserName() Returns the username of the current Marketing Cloud Engagement user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedEmployeeUserName()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedEmployeeUserName()) ]%% ``` The example outputs the username of the Marketing Cloud Engagement user who is accessing the page. # AuthenticatedEnterpriseID() Returns the enterprise ID of the current authenticated landing page user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedEnterpriseID()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedEmployeeUserName()) ]%% ``` The example outputs the enterprise ID of an authenticated landing page user who is accessing the page. # AuthenticatedMemberID() Returns the member ID of the authenticated landing page user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedMemberID()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedMemberID()) ]%% ``` The example outputs the member ID for the authenticated landing page user. # AuthenticatedMemberName() Returns the member name of the authenticated landing page user. Use this function only with Microsites when using Sender Authenticated Redirection. Not for use with CloudPages. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `AuthenticatedMemberName()` function doesn’t accept any parameters. ## Usage You can call this function without passing any parameters. ``` %%[ Output(AuthenticatedMemberName()) ]%% ``` The example outputs the member name of the authenticated landing page user. # Authentication Contains authentication information. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # Authentication To make an authenticated call to a Marketing Cloud Engagement Einstein service, obtain an OAuth access token. For server-to-server API integrations, review [Access Token for Server-to-Server Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud-einstein/mc-app-development/access-token-s2s.md). For web or public app integrations, review [Access Token for Web and Public App Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud-einstein/mc-app-development/access-token-app.md). After you get an access token, use it make your request. You'll need your account’s [tenant-specific subdomain](https://developer.salesforce.com/docs/marketing/marketing-cloud-einstein/mc-apis/your-subdomain-tenant-specific-endpoints.md). ## URL Host Parameters | Name | Type | Description | | ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------- | | Region | string | Required. A region identifier that matches the region of your Marketing Cloud Engagement account. Possible values are: us, eu | ## Request Header Parameters | Name | Type | Description | | ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- | | Authorization | string | Required. A string that starts with `SFMC`, followed by your access token. Ensure there is a space between the two values. | | X-API-TSE | string | Required. Your tenant-specific subdomain. | ## Example Request ``` HOST: "https://api.YOUR_REGION.sfmc-einstein.com" POST "/ecs/v1/api/asset/edit" HEADERS: { "Authorization" : "SFMC YOUR_ACCESS_TOKEN", "X-API-TSE" : "YOUR_SUBDOMAIN", "Content-Type" : "application/json" } ``` # Authorization Code Reference Your application initiates the authorization code flow by directing the end user to the v2/authorize URL. You can specify the required scopes or permissions as part of the URL. Upon successful validation, the authorization service redirects the user’s web browser to the Marketing Cloud Engagement login page. ## JSON Parameters | Name | Type | Required | Description | | ------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | response_type | string | Required | Type of response. Must be "code" for web apps and public apps. | | client_id | string | Required | Client ID issued when you create the API integration in Installed Packages. | | redirect_uri | string | Required | Where the end user is directed after login. Must match a redirect URL specified on the API integration in Installed Packages. The URL must be encoded for this request. | | scope | string | no | Space-separated list of data-access permissions for your application. Review [REST API Permission IDs and Scopes](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-permissions-and-scopes.md) for a full list of permissions. If you don’t include the scope parameter in the request, the token is issued with the scopes assigned to the API integration in Installed Packages. If you include the scope parameter and use an empty string for the values, the token is generated with no scope permissions. | | state | string | no | Used by your application to maintain state between the request and the redirect. The authorization server includes this value when redirecting the end-user’s browser back to your application. This parameter is recommended because it helps to minimize the risk of cross-site forgery attack. | ## Example Request URL ```html https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com/v2/authorize?response_type=code&client_id=vqwyswrlzzfk024ivr682esb&redirect_uri=https%3A%2F%2F127.0.0.1%3A80%2F&scope=email_read%20email_write%20email_send&state=mystate ``` ## Authorization Code Return After the user logs in, Marketing Cloud Engagement generates an authorization code and redirects the user’s web browser to the callback URL specified by the redirect_uri parameter. The authorization code is appended to the redirect URL. ### Response Parameters | Name | Type | Description | | ----- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | code | string | Authorization code that must be exchanged for access tokens. Maximum length is 512 characters. Lifetime is 5 minutes. | | state | string | State value that you passed as part of the original request, if applicable. | | tssd | string | (AppExchange partners only) tssd is a dynamic value that represents the end user’s subdomain and is returned only when your customers use your app. Each of your customers has a unique tssd. Use the returned tssd to construct all subsequent requests on your customer’s behalf. [To make offline requests on behalf of a customer](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/integration-considerations.md), store this value so that you can construct requests at a later date. Ensure that your app validates tssd with the character set \[a-zA-Z0-9-]. tssd is not returned in local testing. | ### Example URL Response ```html https://127.0.0.1:80/?state=mystate&tssd={APPEXCHANGE_CUSTOMER’S_SUBDOMAIN} &code=aWekysIEeqM9PiThEfm0Cnr0MoLIfwWyRJcqOqHdF8f9INokharAS09ia7UNP6RiVScerfhc4w ``` ### Example Error Response Upon validation failure, the authorization service redirects the user’s web browser to the callback URL specified in the redirect_uri parameter with an error code and description. ```js { "error": "unauthorized_client" "error_description": "The client is not authorized to request an authorization code using this method." "error_uri": "https://developer.salesforce.com/docs" } ``` # Automation Defines an automation in Automation Studio. To modify or delete an automation, you must have the **Automation | Automations | Write** permission. To start an automation, you must have the **Automation | Automations | Execute** permission. ## Properties | Name | Data Type | Description | | ---------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AutomationInstanceID` | String | The unique ID for a specific run (instance) of an automation. | | `AutomationSource` | [AutomationSource](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationsource.md) object | An object that identifies the source of the automation. | | `AutomationTasks` | Array of [AutomationTask](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtask.md) objects | An array of objects. Each object specifies a task in the automation. | | `AutomationType` | String | The type of automation. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the automation. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedBy` | Long | The ID of the user who created the automation. | | `CreatedDate` | DateTime | The date and time when the object was created. Read-only. | | `CustomerKey` | String | A user-supplied unique identifier for the automation, sometimes referred to as the external key. | | `Description` | String | A description of the object. | | `ID` | Integer | A unique ID for the object. | | `InteractionObjectID` | String | A unique ID for activities within the asynchronous process of the overall conversation or program. | | `IsActive` | Boolean | Specifies whether the object is active. | | `Keyword` | String | Not used. | | `LastSavedBy` | Long | The ID of the user who last saved the automation. | | `ModifiedBy` | Long | The ID of the user who last modified the automation. | | `ModifiedDate` | String | The date and time when the object was last modified. Read-only. | | `Name` | String | The name of the automation. | | `NewObjectID` | String | The unique ID of the newly created automation object. This value is used in later API calls (Retrieve, Perform, Update, Pause) to refer to that specific automation. | | `Notifications` | Array of [AutomationNotification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationnotification.md) objects | An array of objects. Each object represents a notification to send when the automation completes. | | `ObjectID` | String | A unique ID for the object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes the account ownership of a subscriber in an account that is managed on your behalf. | | `PartnerKey` | String | A unique identifier for an object, provided by a partner. This property can only be accessed by using the API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. This property can only be accessed by using the API. | | `ProgramID` | String | An identifier for the automation. Read-only. | | `Schedule` | [ScheduleDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduledefinition.md) object | An object that represents the schedule for the automation. | | `ScheduledTime` | DateTime | The date and time when the automation is scheduled for publishing. Specify the value in ISO 8601 format with UTC time or a timezone offset. The specified time can be up to 30 days in the future. | | `Status` | Integer | A code that indicates the status of the automation. See [Status Codes](#status-codes) for more information. | **note:** The values of the `ScheduledTime` and `CreatedDate` properties are always shown as "0001-01-01T00:00:00.000". ## Status Codes The `Status` property can contain the values in this table. | Code | Description | | ---- | ------------------------------------------- | | `-1` | The automation failed. | | `0` | The automation failed while being built. | | `1` | The automation is being built. | | `2` | The automation is ready to start. | | `3` | The automation is running. | | `4` | The automation has been paused. | | `5` | The automation has been stopped. | | `6` | The automation is scheduled. | | `7` | The automation is waiting for a trigger. | | `8` | The trigger for the automation is inactive. | ## See Also - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Interact with Automation Studio](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/interacting_with_automation_studio_via_the_web_service_soap_api.md) # Automation Studio The following are Automation Studio technical articles for SOAP API. - [Interact with Automation Studio](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/interacting_with_automation_studio_via_the_web_service_soap_api.md) Automation Studio # Automation Studio Manage and execute multi-step marketing and data management activities on an immediate, triggered, or scheduled basis using automations. This table lists the use cases that the API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | [Get automations](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getAutomations) | GET | automation/v1/automations | | [Create an automation](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=createAutomation) | POST | automation/v1/automations | | [Get an automation](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getAutomation) | GET | automation/v1/automations/{id} | | [Execute automation activities](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=executeAutomationActivities) | POST | automation/v1/automations/{id}/actions/runallonce | | [Update an automation file trigger](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=updateAutomationFileTrigger) | PATCH | automation/v1/automations/filetrigger/{id} | | [Update an automation file trigger by key](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=updateAutomationFileTriggerByKey) | PATCH | automation/v1/automations/filetrigger/key:{key} | | [Execute automation activities by key](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=executeAutomationActivitiesByKey) | POST | automation/v1/automations/key:{key}/actions/runallonce | | [Execute triggered automation](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=executeTriggeredAutomation) | POST | automation/v1/automations/trigger | | [Update automation trigger](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=updateAutomationTrigger) | PATCH | automation/v1/automations/trigger/{id} | | [Get trigger status](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getTriggerStatus) | GET | automation/v1/automations/trigger/status/{requestId} | | [Get file transfer activities](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getFileTransferActivities) | GET | automation/v1/fileTransfers | | [Create file transfer activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=createFileTransferActivity) | POST | automation/v1/fileTransfers | | [Delete file transfer activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=deleteFileTransferActivity) | DELETE | automation/v1/fileTransfers/{fileTransferActivityId} | | [Get file transfer activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getFileTransferActivity) | GET | automation/v1/fileTransfers/{fileTransferActivityId} | | [Update file transfer activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=updateFileTransferActivity) | PATCH | automation/v1/fileTransfers/{fileTransferActivityId} | | [Start file transfer activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=startFileTransferActivity) | POST | automation/v1/fileTransfers/{fileTransferActivityId}/start | | [Get automation folders](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getAutomationFolders) | GET | automation/v1/folders | | [Get FTP locations](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getFtpLocations) | GET | automation/v1/ftpLocations | | [Get automation script activities](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=getAutomationScriptActivities) | GET | automation/v1/scripts | | [Execute script activity](/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=executeScriptActivity) | POST | automation/v1/scripts/{ssjsId}/start | Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant: **Version:** 1.0 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. Find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET Retrieve a list of all automations in the account. `GET /automation/v1/automations` Operation ID: `getAutomations`. ### Required Scopes To retrieve the automations in your account, your API user must have this permission: * Automation | Automations | Read (`automations_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Default: `1`. * `$pagesize` (query, integer) The number of records to return on each page of results. Default: `25`. * `$filter` (query, string) A string that describes the filter to apply to the response. The filter must be URL encoded. Use single quotes for field values. Filters can include the `eq` and `neq` operators. * `$orderBy` (query, string) The field and sort method to use to sort the results, such as `$orderBy=memberID ASC` to sort the results in ascending order by the value of the memberID field. * `view` (query, string) Defines the type of extra data to return. The only accepted value is `targetdes`. If you specify this parameter, the response includes automations that have target data extensions. #### Responses * **200** Indicates that the request to retrieve all automations was successful. Media type: `application/json`. Schema: `getAllAutomationsResponseBody`. _Example_ ``` { "page": 1, "pageSize": 25, "count": 3, "items": [ { "id": "471671be-09b1-4bed-a661-3f0c8561646f", "name": "Scheduled Automation", "description": "", "key": "Test123", "typeId": 1, "type": "scheduled", "statusId": 3, "status": "Running", "categoryId": 1157180, "lastRunTime": "2025-06-19T10:37:30.323", "lastRunInstanceId": "8ec9be34-ef49-42b4-95d4-daabc893592b", "schedule": { "scheduleStatus": "none" } }, { "id": "3ec3bec9-2eb5-4023-b49e-1ff51817ac01", "name": "File Drop Automation", "description": "", "key": "77158f0c-bdd1-eaf4-62f6-5281d63d608f", "typeId": 2, "type": "triggered", "statusId": 8, "status": "InactiveTrigger", "categoryId": 1157180, "fileTrigger": { "queueFiles": false, "isPublished": false, "fileNamePatternTypeId": 1, "fileNamingPattern": "footer", "folderLocationText": "triggered_automations\\", "triggerActive": false } }, { "id": "8eabb77c-1f7f-41e5-9f64-120009babcfe", "name": "Triggered Automation", "description": "", "key": "f24d848b-b77b-4b63-bed2-a573523166fc", "typeId": 2, "type": "triggered", "statusId": 8, "status": "InactiveTrigger", "categoryId": 1157180, "automationTrigger": { "queueFiles": true, "filenamePattern": "example.csv", "filenamePatternTypeId": 4, "fileTransferLocationId": "e039f099-5e14-454e-a369-689e309f7699", "sampleFileName": "example.csv", "status": 1 } } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Create an automation using existing Automation Studio activities. `POST /automation/v1/automations` Operation ID: `createAutomation`. ### Required Scopes To create an automation, your API user must have this permission: * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body Media type: `application/json`. Schema: `createAutomationRequestBody`. _Example: Create Scheduled Automation_ ``` { "name": "Example Scheduled Automation", "description": "Example create of a scheduled automation", "key": "example-scheduled-automation", "steps": [ { "annotation": "", "stepNumber": 0, "activities": [ { "name": "1 Minute Wait", "objectTypeId": 467, "displayOrder": 0, "activityObjectId": "00000000-0000-0000-0000-000000000000", "serializedObject": "{\"duration\":1,\"durationUnits\":\"Minutes\"}" } ] } ], "startSource": { "typeId": 1, "schedule": { "icalRecur": "FREQ=DAILY;INTERVAL=1;UNTIL=20241011", "startDate": "2024-08-11T06:00:00-04:00", "timezoneId": 1 } } } ``` _Example: Create File Drop Automation_ ``` { "name": "Example File Drop Automation", "description": "Example create for a file drop triggered automation", "key": "example-file-drop-automation", "steps": [ { "annotation": "", "stepNumber": 0, "activities": [ { "name": "1 Minute Wait", "objectTypeId": 467, "displayOrder": 0, "activityObjectId": "00000000-0000-0000-0000-000000000000", "serializedObject": "{\"duration\":1,\"durationUnits\":\"Minutes\"}" } ] } ], "startSource": { "typeId": 2, "fileDrop": { "filenamePattern": "example-pattern", "filenamePatternTypeId": 2, "folderLocation": "triggered_automations", "queueFiles": true } } } ``` _Example: Create AutomationTriggered Automation_ ``` { "name": "Example AutomationTriggered Automation", "description": "Example create for an automationTriggered automation", "key": "example-automation-triggered-automation", "steps": [ { "annotation": "", "stepNumber": 0, "activities": [ { "name": "1 Minute Wait", "objectTypeId": 467, "displayOrder": 0, "activityObjectId": "00000000-0000-0000-0000-000000000000", "serializedObject": "{\"duration\":1,\"durationUnits\":\"Minutes\"}" } ] } ], "startSource": { "typeId": 5, "automationTrigger": { "queueFiles": true, "filenamePattern": "example.csv", "filenamePatternType": 4, "fileTransferLocationId": "00000000-0000-0000-0000-000000000000", "sampleFileName": "example.csv" } } } ``` #### Responses * **200** Indicates that the request to create an automation was successful. Media type: `application/json`. Schema: `createAutomationResponseBody`. _Example_ ``` { "id": "00000000-0000-0000-0000-000000000000", "legacyId": "WV9HUWxHOKWSa2lhXzBrXzRaOVFkUToyNTow", "name": "Example Scheduled Automation", "description": "Example create for a scheduled automation", "key": "example-scheduled-automation", "categoryId": 3915, "statusId": 4, "lastSavedByName": "test-user", "createdDate": "2024-11-08T11:50:02.693", "createdByName": "test-user", "updateInProgress": false, "steps": [ { "annotation": "", "stepNumber": 0, "activities": [ { "id": "00000000-0000-0000-0000-000000000000", "name": "1 Minute Wait", "description": "", "activityObjectId": "00000000-0000-0000-0000-000000000000", "objectTypeId": 467, "displayOrder": 0, "serializedObject": "{\"duration\":1,\"durationUnits\":\"Minutes\"}" } ] } ], "startSource": { "typeId": 1, "schedule": { "scheduleTypeId": 3, "startDate": "2024-08-11T06:00:00-04:00", "endDate": "2024-10-11T02:00:00-04:00", "rangeTypeId": 1, "occurrences": 61, "icalRecur": "FREQ=DAILY;INTERVAL=1;UNTIL=20241011", "timezoneId": 1, "statusId": 0 } } } ``` * **400** Indicates that the request to create an automation failed. This error typically occurs when there’s an issue with the request body. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Name already exists: Name: Example_Automation_Name." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a specific automation by providing its ID. `GET /automation/v1/automations/{id}` Operation ID: `getAutomation`. ### Required Scopes To retrieve an automation in your account, your API user must have this permission: * Automation | Automations | Read (`automations_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the automation. #### Responses * **200** Indicates that the request to retrieve an automation was successful. Media type: `application/json`. Schema: `getAutomationResponseBody`. _Example_ ``` { "id": "62157360-59ec-4933-9058-f96b1f4e5b23", "name": "Scheduled Automation", "description": "", "key": "c556e3ec-210f-2d4d-a7ad-bfc25ec674c0", "typeId": 1, "type": "scheduled", "statusId": 2, "status": "Ready", "categoryId": 1157180, "schedule": { "scheduleStatus": "none" }, "steps": [ { "id": "b002f81e-dec9-4ff3-984c-b9964cbd9b23", "name": "", "step": 1, "activities": [ { "id": "1f5779e5-7ed1-4f16-b38a-137d21815a66", "name": "Bounce", "activityObjectId": "f9e9a893-3db0-e311-8f5c-ac162da3b19c", "objectTypeId": 45, "displayOrder": 1 } ] }, { "id": "9b9b0e94-1164-42a5-bd14-cfc2ef3a261e", "name": "", "step": 2, "activities": [ { "id": "01836759-0376-47f6-a0c8-10276c5ee85e", "name": "AMPscript and PDF", "activityObjectId": "f8aac5f0-494d-f011-ba70-d4f5ef3d4f4f", "objectTypeId": 42, "displayOrder": 1 }, { "id": "bc31f0f4-6e03-489d-a36f-4b5ec3335905", "name": "APINotOpened", "activityObjectId": "7d8fbdf6-494d-f011-ba70-d4f5ef3d4f4f", "objectTypeId": 45, "displayOrder": 2 } ] } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct email send definition key. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Not Found", "errorcode": 0, "documentation": "https://code.docs.exacttarget.com/rest/errors/404" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Run all activities in an automation one time by specifying its ID. `POST /automation/v1/automations/{id}/actions/runallonce` Operation ID: `executeAutomationActivities`. ### Required Scopes To run the activities in an automation, your API user must have these permissions: * Automation | Automations | Write (`automations_write`) * Automation | Automations | Execute (`automations_execute`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the automation. #### Responses * **201** Indicates that the request to run all activities in an automation one time was successful. Media type: `application/json`. Schema: `string`. Text that indicates that the automation started successfully. Type: `string`. _Example_ ``` Automation Started Successfully ``` * **400** Indicates that the request to run all activities in the automation failed. Typically, this error occurs when the automation is already running. This error is also returned if you try to run an automation that is triggered rather than scheduled. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "A run for this automation has already been started, you must wait for that run to complete before the automation can be started again." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct email send definition key. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Not Found", "errorcode": 0, "documentation": "https://code.docs.exacttarget.com/rest/errors/404" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### PATCH Activate or deactivate an automation file trigger by providing its ID. `PATCH /automation/v1/automations/filetrigger/{id}` Operation ID: `updateAutomationFileTrigger`. ### Required Scopes To update the status of a trigger request, your API user must have this permission: * Automation | Automations | Execute (`automations_execute`) * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique identifier of the file drop automation to update. This value is the same value that’s returned in the ID property from the `automation/v1/automations/` endpoint. #### Request body Media type: `application/json`. Schema: `object`. * `isActive` (_boolean_, required) The status of the automation file trigger. If the value is `true`, the automation file trigger is activated. If the value is `false`, the automation file trigger is deactivated. #### Responses * **200** The request to update the automation file trigger status succeeded. * **400** Indicates that the request to update the automation file trigger status failed. This error typically occurs when the folder is already in use. In this situation, deactivate any file drop automations that are listening for the same file pattern in the same folder. If any automations that use the same file trigger are running, wait for them to complete before deactivating the file trigger. If the Guid is invalid or the automation can’t be found, make sure that the `id` in the request is a valid GUID and corresponds to an existing file drop automation. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Folder triggered_automations location is in use." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### PATCH Activate or deactivate an automation file trigger by providing its key. `PATCH /automation/v1/automations/filetrigger/key:{key}` Operation ID: `updateAutomationFileTriggerByKey`. ### Required Scopes To update the status of a trigger request, your API user must have this permission: * Automation | Automations | Execute (`automations_execute`) * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `key` (path, string, required) The user-defined external key of the automation file trigger. #### Request body Media type: `application/json`. Schema: `object`. * `isActive` (_boolean_, required) The status of the automation file trigger. If the value is `true`, the automation file trigger is activated. If the value is `false`, the automation file trigger is deactivated. #### Responses * **200** The request to update the automation file trigger status succeeded. * **400** Indicates that the request to update the automation file trigger status failed. This error typically occurs when the folder is already in use. In this situation, deactivate any file drop automations that are listening for the same file pattern in the same folder. If any automations that use the same file trigger are running, wait for them to complete before deactivating the file trigger. If the Guid is invalid or the automation can’t be found, make sure that the `id` in the request is a valid GUID and corresponds to an existing file drop automation. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Folder triggered_automations location is in use." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Run all activities in an automation one time by specifying its external key. `POST /automation/v1/automations/key:{key}/actions/runallonce` Operation ID: `executeAutomationActivitiesByKey`. ### Required Scopes To run the activities in an automation, your API user must have these permissions: * Automation | Automations | Write (`automations_write`) * Automation | Automations | Execute (`automations_execute`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `key` (path, string, required) The user-defined external key of the automation. #### Responses * **201** Indicates that the request to run all activities in an automation one time was successful. Media type: `application/json`. Schema: `string`. Text that indicates that the automation started successfully. Type: `string`. _Example_ ``` Automation Started Successfully ``` * **400** Indicates that the request to run all activities in the automation failed. Typically, this error occurs when the automation is already running. This error is also returned if you try to run an automation that is triggered rather than scheduled. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "A run for this automation has already been started, you must wait for that run to complete before the automation can be started again." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct email send definition key. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Not Found", "errorcode": 0, "documentation": "https://code.docs.exacttarget.com/rest/errors/404" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Start an automation that uses a trigger start source. `POST /automation/v1/automations/trigger` Operation ID: `executeTriggeredAutomation`. When you upload a file, the Trigger API request passes the file details for Automation Studio to evaluate. You can queue a maximum of 200 Trigger requests at a time in each member ID (MID). ### Required scopes To trigger an automation, your API user must have this permission: * Automation | Automations | Execute (`automations_execute`) * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body Media type: `application/json`. Schema: `triggerAutomationRequestBody`. #### Responses * **200** Indicates that the request to trigger an automation was successful. Media type: `application/json`. Schema: `object`. * `requestId` (_string_) A unique identifier for the request to trigger the automation. If errors prevent the automation from being triggered, the value is `00000000-0000-0000-0000-000000000000`. * `errors` (_array of object_) An array of objects. Each object contains details about an error. If no errors occur, this property is omitted. * `message` (_string_) A message that describes the error. _Example: Successful Request_ ``` { "requestId": "b8439846-1837-4df4-b5a2-c9e3dec7d89f" } ``` _Example: Request with Errors_ ``` { "requestId": "00000000-0000-0000-0000-000000000000", "errors": [ { "message": "The following field is not valid for the current operation: 'FileTransferLocationKey'" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct email send definition key. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Not Found", "errorcode": 0, "documentation": "https://code.docs.exacttarget.com/rest/errors/404" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### PATCH Activate or Deactivate an Automation Trigger. `PATCH /automation/v1/automations/trigger/{id}` Operation ID: `updateAutomationTrigger`. ### Required scopes To update the status of a trigger request, your API user must have this permission: * Automation | Automations | Execute (`automations_execute`) * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the automation. #### Request body Media type: `application/json`. Schema: `updateAutomationTriggerRequestBody`. #### Responses * **200** Indicates that the request to update an automation trigger was successful. Media type: `application/json`. Schema: `string`. Text that indicates that the automation trigger was updated successfully. Type: `string`. _Example_ ``` OK ``` * **400** Indicates that the request to update an automation trigger failed. This error typically occurs when the automation trigger ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Check the status for a specified Trigger API requestID. `GET /automation/v1/automations/trigger/status/{requestId}` Operation ID: `getTriggerStatus`. > Note > > To see the automation details, make sure that the request’s file details meet the criteria for exactly one automation trigger configuration. See _Salesforce Help_: [Configure a Trigger Automation](https://help.salesforce.com/s/articleView?id=mktg.mc_as_define_a_file_trigger_automation.htm). ### Required scopes To check the status of a trigger request, your API user must have this permission: * Automation | Automations | Read (`automations_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `requestId` (path, string, required) The unique ID of the trigger request. The API returns this value in the `requestId` property of the response to the POST request to start the automation using the trigger start source. #### Responses * **200** Indicates that the request to check the status of a trigger request was successful. Media type: `application/json`. Schema: `getTriggerStatusResponseBody`. _Example_ ``` { "triggerdetails": { "status": "AutomationTriggered", "automationDetails": { "automationName": "My Import Automation", "automationExternalKey": "Import_Automation_API_Key" } }, "triggerRequestID": "e2dd2b55-431b-404e-b80b-6b1ad6bd527e", "resultMessages": [] } ``` * **400** Indicates that the request to check the status of a trigger request failed. This error typically occurs when the trigger request ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a list of all file transfer activities in the account. `GET /automation/v1/fileTransfers` Operation ID: `getFileTransferActivities`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Default: `1`. * `$pagesize` (query, integer) The number of records to return on each page of results. Default: `25`. * `$filter` (query, string) A string that describes the filter to apply to the response. The filter must be URL encoded. Use single quotes for field values. Filters can include the `eq` and `neq` operators. * `$orderBy` (query, string) The field and sort method to use to sort the results. The only supported properties for ordering are `name` and `customerkey`. You can sort results in ascending (`ASC`)or descending (`DESC`) order. #### Responses * **200** Indicates that the request to retrieve all file transfer activities was successful. Media type: `application/json`. Schema: `getFileTransferActivitiesResponseBody`. _Example_ ``` { "page": 1, "pageSize": 25, "count": 1, "items": [ { "id": "1aaca000-9c6d-40e0-95d9-2d7ca324970a", "name": "Transfer a File", "customerKey": "1AACA000-9C6D-40E0-95D9-2D7CA324970A", "createdDate": "2025-10-06T12:51:39.947", "modifiedDate": "2025-10-06T12:51:39.947" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Create a file transfer activity. `POST /automation/v1/fileTransfers` Operation ID: `createFileTransferActivity`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body Media type: `application/json`. Schema: `createFileTransferActivityRequestBody`. #### Responses * **200** Indicates that the request to create a file transfer activity was successful. Media type: `application/json`. Schema: `createFileTransferActivityResponseBody`. _Example_ ``` { "id": "f18d0533-912a-4545-923d-4b80495b92e8", "name": "Test Encryption", "customerKey": "b7d1949c-cfaf-4d74-97f6-e2b2da521b56", "fileSpec": "test-2.txt.pgp", "isEncrypted": true, "isCompressed": false, "maxFileAge": 0, "maxFileAgeScheduleOffset": 0, "maxImportFrequency": 0, "fileTransferLocationId": "1f91eb52-9a28-4469-8808-accdc4325ced", "isUpload": false, "isPgp": false, "isFileSpecLocalized": false, "createdDate": "2019-05-16T14:41:29.24", "modifiedDate": "2021-04-26T20:54:18.71" } ``` * **400** Indicates that the request to create a file transfer activity failed. This error typically occurs required properties are missing from the request body. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "The value specified for the following field is not valid: 'Name'." }, { "message": "The value specified for the following field is not valid: 'FileSpec'." }, { "message": "The value specified for the following field is not valid: 'FileTransferLocationId'." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a specific file transfer activity by providing its ID. `GET /automation/v1/fileTransfers/{fileTransferActivityId}` Operation ID: `getFileTransferActivity`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `fileTransferActivityId` (path, string, required) The unique ID of the file transfer activity. #### Responses * **200** Indicates that the request to retrieve a file transfer activity was successful. Media type: `application/json`. Schema: `createFileTransferActivityResponseBody`. _Example: same as POST /automation/v1/fileTransfers 200 response._ * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### DELETE Delete a specific file transfer activity by providing its ID. `DELETE /automation/v1/fileTransfers/{fileTransferActivityId}` Operation ID: `deleteFileTransferActivity`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `fileTransferActivityId` (path, string, required) The unique ID of the file transfer activity. #### Responses * **200** Indicates that the request to delete a file transfer activity was successful. The response body is empty. Media type: `application/json`. Schema: `object`. _Example_ ``` {} ``` * **400** Indicates that the request to delete a file transfer activity failed. This error typically occurs when the file transfer activity ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### PATCH Update a file transfer activity by providing its ID. `PATCH /automation/v1/fileTransfers/{fileTransferActivityId}` Operation ID: `updateFileTransferActivity`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `fileTransferActivityId` (path, string, required) The unique ID of the file transfer activity. #### Request body Media type: `application/json`. Schema: `createFileTransferActivityRequestBody`. #### Responses * **200** Indicates that the request to create a file transfer activity was successful. Media type: `application/json`. Schema: `createFileTransferActivityResponseBody`. _Example: same as POST /automation/v1/fileTransfers 200 response._ * **400** Indicates that the request to delete a file transfer activity failed. This error typically occurs when the file transfer activity ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Add a file transfer activity to the queue for processing. `POST /automation/v1/fileTransfers/{fileTransferActivityId}/start` Operation ID: `startFileTransferActivity`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `fileTransferActivityId` (path, string, required) The unique ID of the file transfer activity. #### Responses * **200** Indicates that the request to add a file transfer activity to the queue for processing was successful. The response body is empty. Media type: `application/json`. _Example_ ``` {} ``` * **400** Indicates that the request to add a file transfer activity to the queue for processing failed. This error typically occurs when the file transfer activity ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a list of all folders in the account. `GET /automation/v1/folders` Operation ID: `getAutomationFolders`. ### Required Scopes To retrieve automation folders, your API user must have this permission: * Automation | Automations | Read (`automations_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$filter` (query, string, required) A string that describes the filter to apply to the response. To retrieve all folders, use the filter `categorytype eq automations`. Example: `categorytype eq automations`. #### Responses * **200** Indicates that the request to retrieve all folders was successful. Media type: `application/json`. Schema: `getFoldersResponseBody`. _Example_ ``` { "count": 2, "page": 1, "pageSize": 25, "items": [ { "categoryId": 1157180, "categoryType": "automations", "hasChildren": false, "name": "Automation Folder", "parentId": "0" }, { "categoryId": 1157180, "categoryType": "automations", "hasChildren": true, "name": "Automation Folder 2", "parentId": "1157180" } ] } ``` * **400** Indicates that the request to retrieve all folders failed. Typically, this error occurs when the filter parameter is invalid. Media type: `application/json`. Schema: `object`. * `errors` (_array of object_) An array of objects. Each object contains details about an error. * `message` (_string_) The error message. _Example_ ``` { "errors": [ { "message": "The following URL parameter is required for this request: $filter" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a list of all FTP locations in the account. `GET /automation/v1/ftpLocations` Operation ID: `getFtpLocations`. ### Required Scopes To retrieve FTP locations, your API user must have this permission: * Automation | Automations | Read (`automations_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Responses * **200** Indicates that the request to retrieve all FTP locations was successful. Media type: `application/json`. Schema: `getFtpLocationsResponseBody`. _Example_ ``` { "page": 1, "pageSize": 2, "count": 2, "items": [ { "name": "NTO FTP Server", "id": "57a04cae-f8dd-4aa7-b45a-21a23b58465e", "locationTypeId": 2, "locationUrl": "sftp://test.example.com" }, { "name": "ExactTarget Enhanced FTP", "id": "89bcb5a0-352a-44ec-8f71-d24fa730e39d", "locationTypeId": 0 } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a list of automation script activities. `GET /automation/v1/scripts` Operation ID: `getAutomationScriptActivities`. ### Required Scopes To retrieve script activities, your API user must have this permission: * Automation | Scripts | Read (`scripts_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$filter` (query, string) A string that describes the filter to apply to the response. The filter must be URL encoded. Use single quotes for field values. Filters can include the `eq` and `neq` operators. * `$orderBy` (query, string) The field and sort method to use to sort the results, such as `$orderBy=memberID ASC` to sort the results in ascending order by the value of the memberID field. * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Default: `1`. * `$pagesize` (query, integer) The number of records to return on each page of results. Default: `25`. #### Responses * **200** Indicates that the request to retrieve all automation scripts was successful. Media type: `application/json`. Schema: `getScriptsResponseBody`. _Example_ ``` { "count": 2, "page": 1, "pageSize": 25, "items": [ { "ssjsActivityId": "d0f9a455-dd5d-49eb-8b97-2049a30a76e8", "name": "%%view_email_url%%", "key": "68f3d824-8507-4f6e-a2d4-f7ab3bb66502", "description": "", "script": "", "categoryId": 4291460, "createdDate": "2022-05-16T06:54:34.907", "modifiedDate": "2023-01-23T13:20:34.803" }, { "ssjsActivityId": "341393ca-a8c1-4a9e-8dfd-a117c2fe7d0c", "name": "0030e672-78b9-45ce-8708-eeabca3f5485", "key": "0030e672-78b9-45ce-8708-eeabca3f5485", "description": "0030e672-78b9-45ce-8708-eeabca3f5485", "script": "", "categoryId": 0, "createdDate": "2023-08-11T02:15:21.213", "modifiedDate": "2023-08-11T02:15:21.213" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Run a script activity one time. `POST /automation/v1/scripts/{ssjsId}/start` Operation ID: `executeScriptActivity`. ### Required Scopes To run a script activity, your API user must have this permission: * Automation | Automations | Execute (`automations_execute`) * Automation | Automations | Write (`automations_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `ssjsId` (path, string, required) The unique ID of the script activity. #### Responses * **201** Indicates that the request to run a script activity was successful. Media type: `application/json`. Schema: `string`. Text that indicates that the script activity started successfully. Type: `string`. _Example_ ``` OK ``` * **400** Indicates that the request to run a script activity failed. This error typically occurs when the script ID is invalid. Media type: `application/json`. Schema: `errorsObject`. _Example_ ``` { "errors": [ { "message": "Identifying Guid is invalid and could not be parsed" } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Insufficient Privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct email send definition key. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "Not Found", "errorcode": 0, "documentation": "https://code.docs.exacttarget.com/rest/errors/404" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ## Schemas ### getAllAutomationsResponseBody * `count` (_integer_) The total number of records that match the filter criteria. * `items` (_array of object_) An array of objects. Each object contains details about an automation. * `automationTrigger` (_object_) Defines the automation trigger start source properties if applicable to the automation. * `filenamePattern` (_string_) The file name format to match against files submitted to the API to start the automation. * `filenamePatternTypeId` (_integer_) Defines how the `fileNamePattern` property is matched against a filename to determine whether to run the automation. Possible values are `0` (none), `1` (contains), `2` (beginsWith), `3` (endsWith), and `4` (equals). Minimum: 0. Maximum: 4. * `fileTransferLocationId` (_string_) The `fileTransferLocationId` of a file transfer location defined in this account. This location is used to download the file for processing. * `queueFiles` (_boolean_) When true, dropped files queue if an automation instance is executing. When false, dropped files cause a skipped automation instance. * `sampleFileName` (_string_) An example filename used to validate the automation trigger parameters and also ensure other definitions do not match the same file. * `status` (_integer_) A numeric representation of the status of the automation trigger. * `categoryId` (_integer_) The ID of the category that the automation belongs to. * `description` (_string_) A description of the automation. * `fileTrigger` (_object_) An object that defines the file drop start source properties. This object is only included in the response if the automation type is `fileTrigger`. * `fileNamePatternTypeId` (_integer_) If a filename pattern is defined, this property indicates how to match the pattern against the file name. Possible values are `0` (none), `1` (contains), `2` (beginsWith), and `3` (endsWith). Minimum: 0. Maximum: 3. * `fileNamingPattern` (_string_) If a filename pattern is defined, this property contains the text to match in the file name. * `folderLocationText` (_string_) The folder to monitor for uploaded files. The path must be relative to the account’s home folder in the Enhanced SFTP service. * `isPublished` (_boolean_) Indicates whether the file drop is activated and monitoring for uploaded files. If the value is `true`, the file drop is activated and monitoring for uploaded files. * `queueFiles` (_boolean_) Indicates whether to add files to a queue if a file is added to the file drop location while the automation is running. If the value is `true`, files are added to a queue. If the value is `false`, the files are skipped. * `triggerActive` (_boolean_) Indicates whether the file drop automation is listening for uploaded files. This property matches the value of the `isPublished` property. * `id` (_string_) The unique ID of the automation. * `key` (_string_) A user-defined key for the automation. * `lastRunTime` (_string_) The date and time when the automation last finished running. * `lastRunInstanceId` (_string_) A unique identifier for the last finished run of the automation. * `name` (_string_) The name of the automation. * `schedule` (_object_) An object that defines the schedule of the automation. * `scheduleStatus` (_string_) The status of the schedule. Allowed values: `none`. * `status` (_string_) The status of the automation. Allowed values: `AwaitingTrigger`, `Building`, `BuildingError`, `Error`, `InactiveTrigger`, `Initialized`, `PausedExecution`, `PausedSchedule`, `Ready`, `Running`, `Scheduled`, `Stopped`. * `statusId` (_integer_) A numeric representation of the status of the automation. The value of this property corresponds to the value of the `status` property. Minimum: 0. Maximum: 10. * `type` (_string_) The start source of the automation. This property corresponds to the value of the `typeId` property. * `typeId` (_integer_) Numeric identifier to represent the type of automation start source. Possible values are `0` (unspecified), `1` (scheduled), `2` (triggered), `3` (chained), `4` (jbEvent), or `5` (automationTriggered). Minimum: 0. Maximum: 5. * `page` (_integer_) The current page number of results. * `pageSize` (_integer_) The number of records on each page of results. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### createAutomationRequestBody * `categoryId` (_integer_) The ID of the category that the automation belongs to. * `description` (_string_) A description of the automation. * `key` (_string_) A user-defined key for the automation. * `name` (_string_) The name of the automation. * `steps` (_array of object_) The steps of the automation. * `annotation` (_string_) A description of the step. * `stepNumber` (_integer_) The number of the step in the automation. The first step in the automation has a step number of `0`. * `activities` (_object_) An object that defines the activities that occur in the step. * `name` (_string_) The name of the activity. * `description` (_string_) A description of the activity. * `activityObjectId` (_string_) The unique ID of the activity. * `objectTypeId` (_integer_) The type of object that the activity belongs to. * `displayOrder` (_integer_) The order in which the activity occurs in the step. The first activity in the step has a display order of `0`. * `serializedObject` (_object_) The serialized object that defines the activity. * `startSource` (_object_) The start source of the automation. * `automationTrigger` (_object_) An object that defines the automation trigger start source properties. This object is required for triggered automations. * `customerKey` (_string_) The customer-defined unique identifier for this automation trigger. If you don’t explicitly define a value, the API generates a GUID. * `fileNamePattern` (_string_) The file name format to match against files submitted to the API to start the automation. * `fileNamePatternType` (_integer_) Defines how the `fileNamePattern` property is matched against a filename to determine whether to run the automation. Possible values are `0` (none), `1` (contains), `2` (begins with), `3` (ends with), and `4` (equals). Minimum: 0. Maximum: 4. * `fileTransferLocationId` (_string_) The ID of the file transfer location for the file transfer activity. For information about creating a file transfer location, see _Salesforce Help_: [Set Up an External FTP File Location with Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_set_up_external_ftp_location.htm). * `folderLocation` (_string_) The folder in the file transfer location to monitor for uploaded files. * `programId` (_string_) The unique system-generated automation definition ID associated with the automation trigger. * `queueFiles` (_boolean_) Indicates whether to add files to a queue if a file is added to the file drop location while the automation is running. If the value is `true`, files are added to a queue. If the value is `false`, the files are skipped. * `sampleFileName` (_string_) An example filename used to validate the automation trigger parameters and also ensure other definitions don’t match the same file. * `fileDrop` (_object_) An object that defines the file drop start source properties. This object is required for file drop automations. * `fileNamePattern` (_string_) The file name format to match against files submitted to the API to start the automation. * `fileNamePatternTypeId` (_integer_) Defines how the `fileNamePattern` property is matched against a filename to determine whether to run the automation. Possible values are `0` (none), `1` (contains), `2` (begins with), `3` (ends with), and `4` (equals). Minimum: 0. Maximum: 4. * `fileTransferLocationId` (_string_) The ID of the file transfer location for the file transfer activity. For information about creating a file transfer location, see _Salesforce Help_: [Set Up an External FTP File Location with Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_set_up_external_ftp_location.htm). * `folderLocation` (_string_) The folder in the file transfer location to monitor for uploaded files. * `isPublished` (_boolean_) Indicates whether the automation trigger is published. * `queueFiles` (_boolean_) Indicates whether to add files to a queue if a file is added to the file drop location while the automation is running. If the value is `true`, files are added to a queue. If the value is `false`, the files are skipped. * `schedule` (_object_) An object that defines the schedule of and recurrence rules for the automation. This object is required for scheduled automations. * `endDate` (_string_) The end date of the schedule. * `icalRecur` (_string_) The recurrence rules for the schedule in iCalendar format. * `occurrences` (_integer_) If the the value of `rangeTypeId` is `1`, this value defines the number of intervals before the schedule ends. * `rangeTypeId` (_integer_) Indicates whether the schedule ends after a specific date or after a number of intervals. If the value is `0`, the schedule ends after a specific date. If the value is `1`, the schedule ends after a specified number of intervals. * `startDate` (_string_) The start date of the schedule. * `scheduleTypeId` (_integer_) The recurrence type for the schedule. Possible values are `0` (every second), `1` (every minute), `2` (every hour), `3` (every day), `4` (every week), `5` (every month), `6` (every year). * `timeZoneId` (_integer_, required) The ID of the time zone of the schedule. This value is required for scheduled automations. For a list of time zones, see [Available Time Zones](/docs/marketing/marketing-cloud/guide/timezone.html#available-time-zones). Minimum: 1. Maximum: 92. * `typeId` (_integer_, required) The type of start source for the automation. Possible values are `0` (unspecified), `1` (scheduled), `2` (triggered), `3` (chained), `4` (Journey Builder event), or `5` (automation triggered). ### createAutomationResponseBody * `categoryId` (_integer_) The ID of the category that the automation belongs to. * `createdByName` (_string_) The name of the user who created the automation. * `createdDate` (_string_) The date and time when the automation was created. * `description` (_string_) A description of the automation. * `id` (_string_) The unique ID of the automation. * `key` (_string_) A user-defined key for the automation. * `legacyId` (_string_) The legacy ID of the automation. * `lastSavedByName` (_string_) The name of the user who last saved the automation. * `name` (_string_) The name of the automation. * `startSource` (_object_) The start source of the automation. * `automationTrigger` (_object_) An object that defines the automation trigger start source properties. This object is returned only when you create a triggered automation. * `customerKey` (_string_) The customer-defined unique identifier for this automation trigger. * `fileNamePattern` (_string_) The file name format to match against files submitted to the API to start the automation. * `fileNamePatternType` (_integer_) Defines how the `fileNamePattern` property is matched against a filename to determine whether to run the automation. Possible values are `0` (none), `1` (contains), `2` (begins with), `3` (ends with), and `4` (equals). Minimum: 0. * `fileTransferLocationId` (_string_) The ID of the file transfer location for the file transfer activity. * `folderLocation` (_string_) The folder in the file transfer location that’s being monitored for uploaded files. * `queueFiles` (_boolean_) Indicates whether to add files to a queue if a file is added to the file drop location while the automation is running. If the value is `true`, files are added to a queue. If the value is `false`, the files are skipped. * `sampleFileName` (_string_) An example filename used to validate the automation trigger parameters and also ensure other definitions don’t match the same file. * `statusId` (_integer_) The ID of the status of the automation. * `fileDrop` (_object_) An object that defines the file drop start source properties. This object is returned only when you create a file drop automation. * `fileNamePattern` (_string_) The file name format to match against files submitted to the API to start the automation. * `fileNamePatternTypeId` (_integer_) Defines how the `fileNamePattern` property is matched against a filename to determine whether to run the automation. Possible values are `0` (none), `1` (contains), `2` (begins with), `3` (ends with), and `4` (equals). Minimum: 0. Maximum: 4. * `folderLocation` (_string_) The folder in the file transfer location that’s being monitored for uploaded files. * `queueFiles` (_boolean_) Indicates whether to add files to a queue if a file is added to the file drop location while the automation is running. If the value is `true`, files are added to a queue. If the value is `false`, the files are skipped. * `statusId` (_integer_) The ID of the status of the automation. * `schedule` (_object_) An object that defines the schedule of and recurrence rules for the automation. This object is returned only when you create a scheduled automation. * `endDate` (_string_) The end date of the schedule. * `icalRecur` (_string_) The recurrence rules for the schedule in iCalendar format. * `occurrences` (_integer_) If the the value of `rangeTypeId` is `1`, this value defines the number of intervals before the schedule ends. * `rangeTypeId` (_integer_) Indicates whether the schedule ends after a specific date or after a number of intervals. If the value is `0`, the schedule ends after a specific date. If the value is `1`, the schedule ends after a specified number of intervals. * `scheduleTypeId` (_integer_) The recurrence type for the schedule. Possible values are `0` (every second), `1` (every minute), `2` (every hour), `3` (every day), `4` (every week), `5` (every month), `6` (every year). * `startDate` (_string_) The start date of the schedule. * `statusId` (_integer_) The ID of the status of the automation. * `timeZoneId` (_integer_) The ID of the time zone of the schedule. This value is required for scheduled automations. For a list of time zones, see [Available Time Zones](/docs/marketing/marketing-cloud/guide/timezone.html#available-time-zones). Minimum: 1. Maximum: 92. * `typeId` (_integer_) The type of start source for the automation. Possible values are `0` (unspecified), `1` (scheduled), `2` (triggered), `3` (chained), `4` (Journey Builder event), or `5` (automation triggered). * `statusId` (_integer_) The ID of the status of the automation. * `steps` (_array of object_) An array of objects. Each object contains details about a step in the automation. * `annotation` (_string_) The annotation of the step. * `stepNumber` (_integer_) The number of the step in the automation. The first step in the automation has a step number of `0`. * `activities` (_array of object_) An array of objects. Each object contains details about an activity in the step. * `name` (_string_) The name of the activity. * `description` (_string_) A description of the activity. * `activityObjectId` (_string_) The unique ID of the activity. * `objectTypeId` (_integer_) The type of object that the activity belongs to. * `displayOrder` (_integer_) The order in which the activity occurs in the step. The first activity in the step has a display order of `0`. * `serializedObject` (_object_) The serialized object that defines the activity. * `updateInProgress` (_boolean_) Indicates whether the automation is being updated. ### errorsObject * `errors` (_array of object_) An array of objects. Each object contains details about an error. * `message` (_string_) The error message. ### getAutomationResponseBody * `id` (_string_) The unique ID of the automation. * `name` (_string_) The name of the automation. * `description` (_string_) A description of the automation. * `key` (_string_) A user-defined key for the automation. * `typeId` (_integer_) Numeric identifier to represent the type of automation start source. Possible values are `0` (unspecified), `1` (scheduled), `2` (triggered), `3` (chained), `4` (jbEvent), or `5` (automationTriggered). Minimum: 0. Maximum: 5. * `type` (_string_) The start source of the automation. This property corresponds to the value of the `typeId` property. * `statusId` (_integer_) A numeric representation of the status of the automation. The value of this property corresponds to the value of the `status` property. Minimum: 0. Maximum: 10. * `status` (_string_) The status of the automation. Allowed values: `AwaitingTrigger`, `Building`, `BuildingError`, `Error`, `InactiveTrigger`, `Initialized`, `PausedExecution`, `PausedSchedule`, `Ready`. * `categoryId` (_integer_) The ID of the category that the automation belongs to. * `lastRunTime` (_string_) The date and time when the automation last finished running. * `schedule` (_object_) * `scheduleStatus` (_string_) The status of the schedule. Allowed values: `none`. * `steps` (_stepsArray_) ### triggerAutomationRequestBody * `fileTransferLocationKey` (_string_) The file location API identifier. * `filename` (_string_) The name of the file to use for the automation. * `relativePath` (_string_) The relative folder path from the top-level container, not including the bucket or container name. > Note > > When you upload a file to a folder with a dynamic structure or naming convention, we recommend that you create a file location at the root bucket, container, or directory. Then, use the `relativepath` parameter to dynamically specify the path to the file. * `deduplicationKey` (_string_) A unique alphanumeric key that identifies the request to initiate the automation. If the API receives multiple requests within 24 hours that contain the same `fileTransferLocationKey`, `fileName`, `relativePath`, and `deduplicationKey`, it ignores all requests after the first one. The maximum number of characters in this field is 256. _Example_ ``` { "fileTransferLocationKey": "S3_FTL", "filename": "new_registrations.csv", "relativePath": "marketing/2025_09_15", "deduplicationKey": "599393a2c526c680119d84155d90f1e5" } ``` ### updateAutomationTriggerRequestBody * `isActive` (_boolean_) The status of the automation trigger. ### getTriggerStatusResponseBody * `triggerdetails` (_object_) An object that contains the status of the trigger request. * `status` (_string_) The status of the trigger request. Allowed values: `Deduplicated`, `Error`, `ErrorMultipleAutomationsFound`, `NoAutomationFound`, `Processing`, `Queued`, `Skipped`, `Triggered`. * `automationDetails` (_object_) * `automationName` (_string_) The name of the automation. * `automationExternalKey` (_string_) The user-defined external key of the automation. * `triggerRequestID` (_string_) The unique ID of the trigger request. * `resultMessages` (_array of any_) Relevant result messages for the triggered API request. If there are no result messages, the array is empty. _Example_ ``` { "triggerdetails": { "status": "AutomationTriggered", "automationDetails": { "automationName": "My Import Automation", "automationExternalKey": "Import_Automation_API_Key" } }, "triggerRequestID": "e2dd2b55-431b-404e-b80b-6b1ad6bd527e", "resultMessages": [] } ``` ### getFileTransferActivitiesResponseBody * `count` (_integer_) The total number of file transfer activities returned. * `items` (_array of object_) An array of objects. Each object contains details about a file transfer activity. * `id` (_string_) The unique ID of the file transfer activity. * `name` (_string_) The name of the file transfer activity. * `customerKey` (_string_) The unique customer-defined key of the file transfer activity. * `createdDate` (_string_) The date and time when the file transfer activity was created. * `modifiedDate` (_string_) The date and time when the file transfer activity was last modified. * `page` (_integer_) The current page number of results. * `pageSize` (_integer_) The number of records on each page of results. ### createFileTransferActivityRequestBody * `customerKey` (_string_) The unique customer-defined key of the file transfer activity. * `description` (_string_) A description of the file transfer activity. * `fileSpec` (_string_) The file specification of the file transfer activity. * `fileTransferLocationId` (_string_) The ID of the file transfer location of the file transfer activity. * `isCompressed` (_boolean_) Indicates whether the file transfer activity is compressed. * `isEncrypted` (_boolean_) Indicates whether the file transfer activity is encrypted. * `isFileSpecLocalized` (_boolean_) Indicates whether the file transfer activity is a localized file transfer activity. * `isPgp` (_boolean_) Indicates whether the file transfer activity is a PGP file transfer activity. * `isUpload` (_boolean_) Indicates whether the file transfer activity is an upload. * `maxFileAge` (_integer_) The maximum file age of the file transfer activity. * `maxFileAgeScheduleOffset` (_integer_) The maximum file age schedule offset of the file transfer activity. * `maxImportFrequency` (_integer_) The maximum import frequency of the file transfer activity. * `name` (_string_) The name of the file transfer activity. * `publicKeyManagementId` (_integer_) The ID of the public key management of the file transfer activity. _Example_ ``` { "name": "Test Encryption", "description": "This file transfer activity is to test PGP encryption.", "customerKey": "b7d1949c-cfaf-4d74-97f6-e2b2da521b56", "fileSpec": "test-2.txt.pgp", "isEncrypted": true, "isCompressed": false, "maxFileAge": 0, "maxFileAgeScheduleOffset": 0, "maxImportFrequency": 0, "fileTransferLocationId": "1f91eb52-9a28-4469-8808-accdc4325ced", "isUpload": false, "isPgp": false, "isFileSpecLocalized": false, "publicKeyManagementId": 1234, "createdDate": "2023-07-20T10:45:19.5Z", "modifiedDate": "2023-07-20T10:45:19.5Z" } ``` ### createFileTransferActivityResponseBody * `customerKey` (_string_) The unique customer-defined key of the file transfer activity. * `description` (_string_) A description of the file transfer activity. * `fileSpec` (_string_) The file specification of the file transfer activity. * `fileTransferLocationId` (_string_) The ID of the file transfer location of the file transfer activity. * `id` (_string_) The unique ID of the file transfer activity. * `isCompressed` (_boolean_) Indicates whether the file transfer activity is compressed. * `isEncrypted` (_boolean_) Indicates whether the file transfer activity is encrypted. * `isFileSpecLocalized` (_boolean_) Indicates whether the file transfer activity is a localized file transfer activity. * `isPgp` (_boolean_) Indicates whether the file transfer activity is a PGP file transfer activity. * `isUpload` (_boolean_) Indicates whether the file transfer activity is an upload. * `maxFileAge` (_integer_) The maximum file age of the file transfer activity. * `maxFileAgeScheduleOffset` (_integer_) The maximum file age schedule offset of the file transfer activity. * `maxImportFrequency` (_integer_) The maximum import frequency of the file transfer activity. * `name` (_string_) The name of the file transfer activity. * `publicKeyManagementId` (_integer_) The ID of the public key management of the file transfer activity. * `createdDate` (_string_) The date and time when the file transfer activity was created. * `modifiedDate` (_string_) The date and time when the file transfer activity was last modified. ### getFoldersResponseBody * `count` (_integer_) The total number automation folders returned. * `items` (_array of object_) An array of objects. Each object contains details about a folder. * `categoryId` (_integer_) The unique ID of the folder. * `categoryType` (_string_) The type of folder. For automation folders, the value is `automations`. * `hasChildren` (_boolean_) Indicates whether the folder has child folders. If the value is `true`, the folder has child folders. * `name` (_string_) The name of the folder. * `parentId` (_string_) The unique ID of the parent folder. * `page` (_integer_) The current page number of results. * `pageSize` (_integer_) The number of records on each page of results. ### getFtpLocationsResponseBody * `count` (_integer_) The total number of FTP locations returned. * `items` (_array of object_) An array of objects. Each object contains details about an FTP location. * `id` (_string_) The unique ID of the FTP location. * `name` (_string_) The name of the FTP location. * `locationTypeId` (_integer_) The type of FTP location. * `locationUrl` (_string_) The URL of the FTP location. This property is omitted for the Marketing Cloud Engagement Enhanced SFTP service. Possible values are `0` (ExactTargetFTPSiteImport), `1` (ExternalFTPSite), `2` (ExternalSFTPSite), `3` (ExternalFTPSSite), `4` (SalesforceObjectsAndReports), `5` (Safehouse), `6` (ExactTargetFTPStieExport), `7` (OracleObjects), `8` (ExactTargetLegacyImport), `9` (ExactTargetFTPExtSite), and `10` (ExternalSignedHttpsSite). * `page` (_integer_) The current page number of results. * `pageSize` (_integer_) The number of records on each page of results. ### getScriptsResponseBody * `count` (_integer_) The total number of automation scripts returned. * `items` (_array of object_) An array of objects. Each object contains details about a script. * `ssjsActivityId` (_string_) The unique ID of the SSJS activity. * `name` (_string_) The name of the script. * `key` (_string_) A user-defined key for the script. * `description` (_string_) A description of the script. * `script` (_string_) The script code. * `categoryId` (_integer_) The ID of the category that the script belongs to. * `createdDate` (_string_) The date and time when the script was created. * `modifiedDate` (_string_) The date and time when the script was last modified. * `page` (_integer_) The current page number of results. * `pageSize` (_integer_) The number of records on each page of results. ### stepsArray An array of objects. Each object contains details about a step in the automation. Array of `object`. * `activities` (_array of object_) An array of objects. Each object contains details about an activity in the step. * `activityObjectId` (_string_) The unique ID of the activity object. * `displayOrder` (_integer_) The position of the activity in the step. * `id` (_string_) The unique ID of the step in the activity object. * `name` (_string_) The name of the activity. * `objectTypeId` (_integer_) The type of activity. * `id` (_string_) The unique ID of the step. * `name` (_string_) The name of the step. * `step` (_integer_) The position of the step in the automation. # Automation Studio API Use Automation Studio to perform multi-step marketing and data management activities on an immediate, triggered, or scheduled basis. You can use the Automation Studio REST APIs to initiate marketing automations. You can also use the APIs to upload, download, decrypt, compress, and decompress files. To see reference content for Automation Studio APIs, click the [Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_automation_studio_automations?meta=Summary) tab. # Automation Studio Events The Engagement Event Notification Service supports these Automation Studio instance event notification types and their corresponding payloads. | Notification Event Category | Notification Event Type | Description | | --------------------------- | --------------------------- | ------------------------------------------------------------------ | | SendEvents | AutomationInstanceStarted | Indicates that an automation instance has started. | | SendEvents | AutomationInstanceCompleted | Indicates that an automation instance has completed. | | SendEvents | AutomationInstanceStopped | Indicates that an automation instance has stopped. | | SendEvents | AutomationInstanceErrored | Indicates that an automation instance has stopped due to an error. | | SendEvents | AutomationInstanceSkipped | Indicates that an automation instance has been skipped. | ## Common Event Attributes These are the attributes shared for AutomationInstanceStatusEvent. | Attribute | Type | Description | | ------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | eventCategoryType | string | The taxonomy of the event. | | timestampUTC | number | UTC Epoch time. | | eid | number | Tenant Enterprise Id from which the event was produced. | | mid | number | Tenant Business Unit Id from which the event was produced. | | automationName | string | Name of the automation. | | automationCustomerKey | string | CustomerKey set by the customer. | | automationType | string | The type of automation - FileDrop, Trigger, or Schedule. | | automationInstanceID | string | The unique identifier of the automation's instance. | | automationInstanceStatus | string | The status of Automation. | | info.automationInstanceFilenameFromTrigger | string | The file name that was being processed. This field is set for file drop and automation trigger automations. It isn't set for scheduled automations. | | info.automationInstanceFileLocation | string | The name of the file transfer location that was used to retrieve the file for automation trigger automations. This field isn't set for other automation types. | | info.automationInstanceRelativePath | string | The relative path was used to retrieve the file based on the initial directory of the file transfer location. This field is only applicable to automation trigger automations. | | info.automationInstanceScheduledTimeUTC | number | Scheduled time for Scheduled automations in UTC. | ## Automation Started Status Event This example shows the payload that your callback receives for a `SendEvents.AutomationInstanceStarted` event. ### Started Status Info Attributes | Attribute | Type | Description | | ----------------------------------- | ------ | ----------------------------------------- | | info.automationInstanceStartTimeUTC | number | The start time for the automation in UTC. | ### Automation Started Status Event Payload Example ```json { "automationCustomerKey": "650f2ab4-9d4b-421c-b091-bc11838836a5", "automationInstanceId": "c111a1e2-6f1f-4b27-a62e-d2cfb05ba365", "automationInstanceStatus": "Initialized", "automationName": "My Automation", "automationType": "scheduled", "eid": 123456, "eventCategoryType": "SendEvents", "mid": 123456, "timestampUTC": 1684943402352, "info": { "automationInstanceFileLocation": "", "automationInstanceFilenameFromTrigger": "", "automationInstanceRelativePath": "", "automationInstanceScheduledTimeUTC": 0, "automationInstanceStartTimeUTC": 1684943402305 } } ``` ## Automation Completed Status Event This example shows the payload that your callback receives for a `SendEvents.AutomationInstanceCompleted` event. ### Completed Status Info Attributes | Attribute | Type | Description | | ----------------------------------- | ------ | ----------------------------------------- | | info.automationInstanceStartTimeUTC | number | The start time for the automation in UTC. | | info.automationInstanceEndTimeUTC | number | The end time for the automation in UTC. | ### Automation Completed Status Event Payload Example ```json { "automationCustomerKey": "650f2ab4-9d4b-421c-b091-bc11838836a5", "automationInstanceId": "c111a1e2-6f1f-4b27-a62e-d2cfb05ba365", "automationInstanceStatus": "Complete", "automationName": "My Automation", "automationType": "scheduled", "eid": 123456, "eventCategoryType": "SendEvents", "mid": 123456, "timestampUTC": 1684943406408, "info": { "automationInstanceEndTimeUTC": 1684943406126, "automationInstanceFileLocation": "", "automationInstanceFilenameFromTrigger": "", "automationInstanceRelativePath": "", "automationInstanceScheduledTimeUTC": 0, "automationInstanceStartTimeUTC": 1684943402307 } } ``` ## Automation Stopped Status Event This example shows the payload that your callback receives for a `SendEvents.AutomationInstanceStopped` event. ### Stopped Status Info Attributes | Attribute | Type | Description | | ----------------------------------- | ------ | ----------------------------------------- | | info.automationInstanceStartTimeUTC | number | The start time for the automation in UTC. | | info.automationInstanceEndTimeUTC | number | The end time for the automation in UTC. | ### Automation Stopped Status Event Payload Example ```json { "automationCustomerKey": "4aab2aa4-82d9-0597-7a1c-c0f2b4411945", "automationInstanceId": "023d61c5-fcbd-4786-8b4f-90c6897f2394", "automationInstanceStatus": "Stopped", "automationName": "My Automation", "automationType": "scheduled", "eid": 123456, "eventCategoryType": "SendEvents", "mid": 123456, "timestampUTC": 1684943825351, "info": { "automationInstanceEndTimeUTC": 1684943824491, "automationInstanceFileLocation": "", "automationInstanceFilenameFromTrigger": "", "automationInstanceRelativePath": "", "automationInstanceScheduledTimeUTC": 0, "automationInstanceStartTimeUTC": 1684943822310 } } ``` ## Automation Errored Status Event This example shows the payload that your callback receives for a `SendEvents.AutomationInstanceErrored` event. ### Errored Status Info Attributes | Attribute | Type | Description | | ----------------------------------- | ------ | ------------------------------------------------------------------------------- | | info.automationInstanceStartTimeUTC | number | The start time for the automation in UTC. | | info.automationInstanceEndTimeUTC | number | The end time for the automation in UTC. | | info.activity.name | string | Name of the activity. | | info.activity.type | string | The type of activity. Values could be, query, import, file transfer, and so on. | | info.activity.customerKey | string | The customer key set on the activity. | | info.activity.Id | string | The unique identifier of the activity. | | info.activity.instanceId | string | The unique identifier of the activity instance. | | info.activity.step | number | The activity's step in the automation. | | info.activity.startTimeUTC | number | The activity start time in UTC. | | info.activity.endTimeUTC | number | The activity end time in UTC. | | info.activity.errorDetails | string | The first erroring activity details. | ### Automation Errored Status Event Payload Example ```json { "automationCustomerKey": "4aab2aa4-82d9-0597-7a1c-c0f2b4411945", "automationInstanceId": "9db74119-fc8b-4cd1-847a-9e9829b2419d", "automationInstanceStatus": "Error", "automationName": "My Automation", "automationType": "scheduled", "eid": 123456, "eventCategoryType": "SendEvents", "mid": 123456, "timestampUTC": 1684943972041, "info": { "automationInstanceEndTimeUTC": 1684943971837, "automationInstanceFileLocation": "", "automationInstanceFilenameFromTrigger": "", "automationInstanceRelativePath": "", "automationInstanceScheduledTimeUTC": 0, "automationInstanceStartTimeUTC": 1684943955663, "activity": { "name": "My Script Activity", "type": "0", "instanceId": "a2c2503a-c6f9-401f-af00-9a607fa50327", "step": "0", "startTimeUTC": 1684943955727, "endTimeUTC": 1684943971807, "errorDetails": "A runtime error occurred while the SSJS Activity executed the SSJS script. Please review the SSJS activity to ensure that errors are handled properly." } } } ``` ## Automation Skipped Status Event ### Automation Skipped Status Event Payload Example ```json { "automationCustomerKey": "4aab2aa4-82d9-0597-7a1c-c0f2b4411945", "automationInstanceId": "b2c98cd9-acae-496e-bb4d-2f95a1cd2648", "automationInstanceStatus": "Skipped", "automationName": "My Automation", "automationType": "scheduled", "eid": 123456, "eventCategoryType": "SendEvents", "mid": 123456, "timestampUTC": 1684945203310, "info": { "automationInstanceFileLocation": "", "automationInstanceFilenameFromTrigger": "", "automationInstanceRelativePath": "", "automationInstanceScheduledTimeUTC": 0 } } ``` # AutomationActivity Defines an activity in an automation in Automation Studio. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | `ActivityObject` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | The activity object associated with the automation. | | `Automation` | [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) object | An automation associated with an activity. | | `AutomationTask` | [AutomationTask](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtask.md) object | A task within automation. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines the account that the automation belongs to. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the activity was created. | | `CustomerKey` | String | A user-defined unique identifier for the activity. | | `Definition` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | A definition associated with the automation. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | A read-only identifier for the object. | | `IsActive` | Boolean | Specifies whether the activity is active. | | `ModifiedDate` | DateTime | The date and time when the activity was last modified. | | `Name` | String | The name of the activity. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of the activity. | | `PartnerKey` | String | A unique identifier provided by a partner for an object. This property is accessible only via the API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client. This property is accessible only via the API. | | `Sequence` | Int | The position of the activity in the automation. | ## Related Items - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # AutomationActivityInstance Defines a specific instance of an activity in an automation in Automation Studio. | Name | Data Type | Description | | ------------------------ | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | `ActivityDefinition` | [AutomationActivity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationactivity.md) object | Identifies the activity definition associated with activity. | | `ActivityID` | String | The unique ID of the activity. | | `ActivityObject` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Indicates activity associated with automation instance. | | `Automation` | [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) object | The automation that’s associated with the activity. | | `AutomationID` | String | The ID of the automation that’s associated with the activity. | | `AutomationInstance` | [AutomationInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationinstance.md) object | Identifies the specific instance of an automation associated with activity. | | `AutomationTask` | [AutomationTask](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtask.md) object | Identifies task within automation. | | `AutomationTaskInstance` | [AutomationTaskInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtaskinstance.md) object | Identifies instance of automation task associated with activity. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the automation. | | `CompletedTime` | DateTime | Indicates time instance of activity completed. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Definition` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Indicates definition associated with automation instance. | | `Description` | String | A description of the activity instance. | | `ID` | Int | A read-only identifier for the object. | | `IsActive` | Boolean | Specifies whether the object is active. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via the API. | | `ScheduledTime` | DateTime | Indicates time scheduled for this instance of an activity. | | `Sequence` | Int | Indicates sequence number for instance. | | `SequenceID` | Int | Identifies sequence associated with instance. | | `StartTime` | DateTime | The date and time when the instance of an activity started. | | `Status` | Int | Indicates status for this instance of an activity. | | `StatusLastUpdate` | DateTime | The date and time when the status of the automation activity was last updated. | | `StatusMessage` | String | Indicates message associated with status. | ## Related Items - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # AutomationInstance Represents a specific execution of an automation in Automation Studio. Every time an automation runs, whether on a schedule or executed manually, Marketing Cloud Engagement creates an `AutomationInstance` record to track that execution. | Name | Data Type | Description | | --------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | `AutomationID` | String | Identifies automation associated with this instance. This field is supported for backward compatibility. | | `AutomationSource` | [AutomationSource](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationsource.md) object | Identifies source of automation. | | `AutomationTasks` | Array of AutomationTasks objects | Identifies tasks within automation. | | `AutomationType` | String | Identifies type of automation. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the automation. | | `CompletedTime` | DateTime | Indicates when automation completed. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `IsActive` | Boolean | Specifies whether the object is active. | | `Keyword` | String | Reserved for future use. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `Notifications` | Array of [AutomationNotification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationnotification.md) objects | Indicates notifications to use when automation completes. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via API. | | `Schedule` | [ScheduleDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduledefinition.md) object | Indicates schedule for automation. | | `ScheduledTime` | DateTime | Keeps requests in asynchronous queue until time specified in call. | | `StartTime` | DateTime | The date and time that this instance of an automation started. | | `Status` | Int | Indicates status of automation. | | `StatusLastUpdate` | DateTime | The date and time that the status of this instance of the activity was last updated. | | `StatusMessage` | String | Indicates message associated with status. | | `TaskInstances` | Array of [AutomationTaskInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtaskinstance.md) objects | Indicates instances of tasks associated with this automation instance. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # AutomationInstances Defines a collection of automation instances in Automation Studio. ## Properties | Name | Data Type | Description | | ------------------------------ | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- | | `AutomationInstanceCollection` | Array of [AutomationInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationinstance.md) objects | Identifies collection of automation instances within an account. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the automation. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `InstanceCount` | Int | Indicates number of instances within collection. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via API. | ## Related Items - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # AutomationNotification Contains information about a notification in an automation. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- | | `Address` | Array of [AutomationInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationinstance.md) objects | Identifies collection of automation instances within an account. | | `Body` | String | Includes text associated with the notification. | | `ChannelType` | String | Indicates channel associated with notification. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the automation. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Description` | String | Includes description of notification. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `NotificationType` | String | Indicates notifications to use when automation completes. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via API. | ## Related Items - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # Automations The MCP server for Marketing Cloud Engagement includes several tools for managing Automation Studio. This table includes information about tools related to managing automations. **important:** Destructive tools can change or delete data. Before you use a destructive tool, ask the AI assistant to perform a trial run of the task or show you the code that it plans to execute. | Tool Name | Description | Required Scopes | | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | `sfmc_create_automation` | Create an Automation Studio automation. | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_create_automation_file_transfer` | Create a file transfer activity in Automation Studio. | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_create_ftp_location` | Create a file transfer location. | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_create_sql_query` | Create a SQL query activity. | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_delete_automation_file_transfer` | Delete an Automation Studio file transfer activity.

Special considerations: Destructive | Automation \| Automations \| Write | | `sfmc_delete_ftp_location` | Deactivate a file transfer location.

Special considerations: Destructive | Automation \| Automations \| Write | | `sfmc_execute_script_activity` | Execute an SSJS activity. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_get_automation` | Retrieve an automation.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_categories` | List all automation folders.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_file_transfer` | Retrieve details of an Automation Studio file transfer activity.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_file_transfers` | Retrieve a list of file transfer activities from Automation Studio.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_filters` | Retrieve a list of filter activities from Automation Studio.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_filter_definitions` | Retrieve a list of filter definitions used by filter activities.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_ftp_locations` | Retrieve a list of file transfer locations from Automation Studio.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_imports` | Retrieve a list of all import file activities from Automation Studio.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_instance` | Retrieve a specific instance of an automation execution.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_scripts` | Retrieve a list of SSJS activities.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automation_trigger_status` | Check the status of a trigger API request.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_automations` | List all automations.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_ftp_location` | Retrieve a file transfer location.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_sql_queries` | List all SQL query activities.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_get_sql_query` | Retrieve a SQL query activity.

Special considerations: Read-only, open-world | Automation \| Automations \| Read | | `sfmc_run_automation` | Run an automation immediately. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_run_automation_activities` | Run a set of activities in an automation by ID. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_run_automation_activities_by_key` | Run a set of activities in an automation by external key. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_run_sql_query` | Execute a SQL query activity. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_start_automation_file_transfer` | Run a file transfer activity in Automation Studio immediately. | Automation \| Automations \| Read
Automation \| Automations \| Execute | | `sfmc_update_automation` | Update an automation.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_automation_file_transfer` | Update a file transfer activity in Automation Studio.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_automation_file_trigger` | Activate or deactivate the file trigger for an automation by ID.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_automation_file_trigger_by_key` | Activate or deactivate the file trigger for an automation by external key.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_automation_trigger` | Activate or deactivate the schedule trigger for an automation.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_ftp_location` | Update a file transfer location.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_update_sql_query` | Update a SQL query activity.

Special considerations: Destructive | Automation \| Automations \| Read
Automation \| Automations \| Write | | `sfmc_validate_sql_query` | Validate SQL query text.

Special considerations: Read-only, open-world | Automation \| Automations \| Read
Automation \| Automations \| Write | # AutomationSource Indicates the source for an automation in Automation Studio. ## Properties | Name | Data Type | Description | | ---------------------- | --------- | ---------------------------------- | | `AutomationSourceID` | String | The source of the automation. | | `AutomationSourceType` | String | The type of the automation source. | ## Related Items - [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) # AutomationTask Defines a task in an automation in Automation Studio. ## Properties | Name | Data Type | Description | | -------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- | | `Activities` | Array of [AutomationActivity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationactivity.md) objects | Identifies the activities associated with task. | | `Automation` | [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) object | Identifies automation associated with task. | | `AutomationTaskType` | String | Identifies type of activity associated with task. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the task. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via API. | | `Sequence` | Int | Indicates sequence number associated with task. | ## Related Items - [AutomationTaskInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtaskinstance.md) # AutomationTaskInstance An object that defines a specific instance of a task in an automation in Automation Studio. ## Properties | Name | Data Type | Description | | -------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | `Activities` | Array of [AutomationActivity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationactivity.md) objects | Identifies the activities associated with task. | | `ActivityInstances` | Array of [AutomationActivityInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationactivityinstance.md) objects | Identifies specific instances of activies associated with task. | | `Automation` | [Automation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automation.md) object | Identifies automation associated with task. | | `AutomationInstance` | [AutomationInstance](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationinstance.md) object | Identifies the specific instance of an automation associated with task. | | `AutomationTaskType` | String | Identifies type of activity associated with task. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Defines which account owns the task. | | `CorrelationID` | String | Identifies calls involved in a specific asynchronous process. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Reserved for future use. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by client and stored by system. This property is accessible only via API. | | `Sequence` | Int | Indicates sequence number associated with instance. | | `StepDefinition` | [AutomationTask](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtask.md) object | Indicates step definition within automation task associated with instance. | ## Related Items - [AutomationTask](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/automationtask.md) # BarCodeUrl() Generates a barcode based on an input string. Most of the barcode types that the function can generate are linear (one-dimensional), although it can generate two-dimensional Data Matrix and PDF417 codes. The function can’t be used to create QR codes. You can call this function up to two times per message or landing page. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` BarCodeURL(valueToConvert, barcodeType, width, height, checksumValue, boolShowText, altText, rotation, boolTransparentBG) ``` The `BarCodeURL()` function has nine parameters: - `valueToConvert` (string): Required. The value that you want to convert into a barcode. - `barcodeType` (string): Required. The type of barcode to create. See [Supported Barcode Types](#supported-barcode-types) for a list of possible values. - `width` (number): Required. The width of the barcode in pixels. - `height` (number): Required. The height of the barcode in pixels. - `checksumValue` (string): A checksum value for the barcode. - `boolShowText` (boolean): If `true` or `1`, the function includes the text of `valueToConvert` under the barcode. - `altText` (string): Alternate text to display under the barcode. The function only adds the specified text to the barcode when the value of `boolShowText` is `false`. - `rotation` (number): Orientation of the barcode in degrees. Accepted values: `0`, `90`, `180`, `270`. - `boolTransparentBG` (boolean): If `true` or `1`, the barcode includes a transparent background. Otherwise, the background is white. ## Supported Barcode Types The `BarCodeUrl()` function supports a variety barcode encoding standards. This table describes the features and limitations of each supported barcode type. | Code | Name | Type | Character Limit | Allowed Characters | Notes | | ------------- | ------------------- | --------------- | --------------- | ----------------------------------------------------------------------------------- | ----------------------------------------- | | `codabar` | Codabar | Linear | Variable | Uppercase letters A–D, numbers 0–9, and these characters: `-$:/.+` | Must begin and end with a letter A–D | | `code11` | Code 11 | Linear | Variable | Numbers 0–9 and `-` | | | `code128auto` | Code 128 Auto | Linear | Variable | All ASCII characters | | | `code128a` | Code 128 A | Linear | Variable | Uppercase ASCII characters, numbers 0–9, and ASCII special characters | | | `code128b` | Code 128 B | Linear | Variable | Uppercase and lowercase ASCII characters, numbers 0–9, and ASCII special characters | | | `code128c` | Code 128 C | Linear | Variable | Numbers 0–9 | | | `code39` | Code 39 | Linear | Variable | Uppercase letters (A–Z), numbers (0-9), spaces, and these characters: `-.$/+%` | | | `code39ext` | Code 39 Extended | Linear | Variable | Any character in the extended ASCII character set | | | `code93` | Code 93 | Linear | Variable | Uppercase letters (A–Z), numbers (0-9), spaces, and these characters: `-.$/+%` | | | `code93ext` | Code 93 Extended | Linear | Variable | All ASCII characters | | | `datamatrix` | Data Matrix | Two-dimensional | 1556 bytes | All extended ASCII characters | Binary encodings aren’t supported | | `ean13` | EAN 13 | Linear | 13 digits | Numbers 0–9 | | | `ean8` | EAN 8 | Linear | 8 digits | Numbers 0–9 | | | `industr25` | Code 25 Industrial | Linear | Variable | Numbers 0–9 | | | `interl25` | Code 25 Interleaved | Linear | Variable | Numbers 0–9 | | | `msi` | MSI Plessey | Linear | Variable | Numbers 0–9 | | | `pdf417` | PDF 417 | Two-dimensional | 1108 bytes | All extended ASCII characters | Binary encodings aren’t supported | | `upca` | UPC A | Linear | 12 digits | Numbers 0–9 | | | `upce` | UPC E | Linear | 12 digits | Numbers 0–9 | Identical to UPC A in this implementation | **note:** The function lets you specify some barcode types that aren’t supported. If you specify any of the values in this list, the function doesn’t produce an exception, but it also doesn’t output a barcode. - `mat25` - `onecode` - `plaintext` - `planet` - `postnet` - `telepen` ## Usage To call the function, pass the string that you want to encode, the barcode type to use, and the width and height of the barcode, along with any optional arguments. Some barcode types, such as EAN 8 or UPC A, only accept a certain number of characters. When you use a non-variable-length barcode type, and you include an incorrect number of characters, the function doesn’t render the barcode. If you call the function using optional parameters, you must include all of the parameters that precede it. For example, if you want to include the `altText` parameter, you must also include the `checksumValue` and `boolShowText` parameters. In this situation, you can pass empty strings if it's unnecessary to provide a string value. Continuing the example, if it's unnecessary to provide a value for the `checksumValue` parameter because the barcode type you selected includes a checksum by default, you can pass an empty string. ### Basic Usage To render the barcode, enclose the function code in an HTML `` tag. This example creates a Code 128 Auto barcode that includes the URL of the Salesforce website. ``` ``` The rendered HTML email or landing page includes this barcode. ![A Code 128 Auto barcode, with https://www.salesforce.com printed below it.](https://developer.salesforce.com/docs/media/images/ampscript/mc-ampscript-reference-content-barcode-url-1.png) ### Alternative Text This example creates a Code 128 Auto barcode in which the encoded data is the URL of the Salesforce website. Rather than print the same text below the barcode, this example uses the `altText` parameter to specify a different printed string. ``` ``` **note:** Code 128 Auto barcodes include an internal check digit by default, so you can pass an empty string for the `checksumValue` parameter. The rendered HTML email or landing page includes this barcode. ![A Code 128 Auto barcode, with the text "Salesforce Website" printed below it.](https://developer.salesforce.com/docs/media/images/ampscript/mc-ampscript-reference-content-barcode-url-2.png) ### Rotation This example creates a Code 128 Auto barcode that is rotated 90° clockwise. ``` ``` The rendered HTML email or landing page includes this barcode. ![A Code 128 Auto barcode, with the text "Salesforce Website" printed below it. The barcode and the text below it are rotated clockwise 90 degrees.](https://developer.salesforce.com/docs/media/images/ampscript/mc-ampscript-reference-content-barcode-url-3.png) # Base64 Utility Functions Use these functions to encode and decode strings using the Base64 standard. ## Load In your Server-side JavaScript code, first load the core library using this syntax: ``` Platform.Load("core","1"); ``` Use the associated sample code as models to construct your own Server-side JavaScript code. # Base64Decode ## Overview Decodes any string value encoded using the Base64Encode() function. This function works only with values encoded using the specific server-side JavaScript function and not any other Base64-encoded string values. ### Syntax Base64Decode(1, 2) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------------------- | | **1** | string | **Required** | Base64 encoded string to decode | | **2** | string | | Character set to use when decoding string value, such as ASCII or UTF-8 | ## Example ``` ``` # Base64Decode ## Overview Decodes a Base64 encoded string to a plain text string ### Syntax Base64Decode(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------- | | **1** | string | **Required** | Base64 encoded string to decode | ## Example This sample code takes a Base64 encoded string passed to the function and returns a plain text string. ``` var encoded = 'VGhpcyB3YXMgYSBCYXNlNjQgZW5jb2RlZCBzdHJpbmcu'; var decoded = Base64Decode(encoded); // "This was a Base64 encoded string." ``` # Base64Decode() Converts Base64-encoded binary data to a string of plain text. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` Base64Decode(stringToDecode, characterEncoding) ``` The `Base64Decode()` function has two parameters: - `stringToDecode` (string): Required. The Base64-encoded string to decode. - `characterEncoding` (string): The character encoding type to use when decoding the string. Possible values are `ASCII`, `UTF-7`, `UTF-8`, `UTF-16`, and `UTF-32`. - `abortSendOnFail` (boolean): Specifies how to handle decoding failures when the function is used in an email. If the value of this parameter is `1`, the email send is aborted if the string can’t be decoded. If the value is `0`, the email send continues even if the string can’t be decoded. The default value is `1`. ## Usage To use the function, pass it the string that you want to decode. You can specify the type of character encoding to use. ``` %%[ Var @couponCode, @couponCodeB64 Set @couponCodeB64 = "NmRuMjh1cXhvY3F1" Set @couponCode = Base64Decode(@couponCodeB64) ]%%

%%=v(@couponCode)=%%

``` The example code outputs a string of plain text. ``` 6dn28uqxocqu ``` # Base64Encode ## Overview Encodes any string value. You can only decode any encoded string values using the specific server-side JavaScript function Base64Decode() and not any other Base64-encoded string values. ### Syntax Base64Encode(1, 2) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------------------- | | **1** | string | **Required** | String to encode | | **2** | string | | Character set to use when decoding string value, such as ASCII or UTF-8 | ## Example ``` ``` # Base64Encode ## Overview Encodes plain text to a Base64 encoded string ### Syntax Base64encode(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | -------------- | | **1** | string | **Required** | Text to encode | ## Example This sample code performs a Base64 encoding on a plain text string: ``` var decoded = 'Convert to Base64'; var encoded = Base64Encode(decoded); // "Q29udmVydCB0byBCYXNlNjQ=" ``` # Base64Encode() Converts plain text to Base64-encoded binary data. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` Base64Encode(stringToEncode, characterEncoding) ``` The `Base64Encode()` function has two parameters: - `stringToEncode` (string): Required. The string to encode to Base64. - `characterEncoding` (string): The character encoding type to use when encoding the string. Accepted values are `ASCII`, `UTF-7`, `UTF-8`, `UTF-16`, and `UTF-32`. ## Usage To use the function, pass it the string that you want to encode. Optionally, specify the type of character encoding to use. ``` %%[ Var @couponCode, @couponCodeB64 Set @couponCode = "6dn28uqxocqu" Set @couponCodeB64 = Base64Encode(@couponCode) ]%%

%%=v(@couponCodeB64)=%%

``` The example code outputs a string encoded in Base64. ``` NmRuMjh1cXhvY3F1 ``` # BaseMOKeyword Defines the default opt-in keyword for an SMS messaging program. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsDefaultKeyword` | Boolean | Specifies if account defaults to this SMS keyword action if no other options are available. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [SendEmailMOKeyword](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sendemailmokeyword.md) # Basic AMPscript Syntax To use AMPscript, you insert it into the content body of your messages at the point where you want it to render. When you send a message that contains AMPscript, Marketing Cloud Engagement interprets the code and substitutes it with the output of the AMPscript function. Learn more about using AMPscript in your content. - [Adding AMPscript to Your Content](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-adding-to-content.md) - [Function Parameters](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-parameters.md) - [Variables](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-variables.md) - [Order of Operations](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-order-of-operations.md) - [Case Sensitivity](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-case-sensitivity.md) - [Evaluating Conditions](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-condition-evaluation.md) - [If Statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-if-statements.md) - [For Loops](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-for-loops.md) - [Comments](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-comments.md) - [Dynamic Link Aliases](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-dynamic-link-aliases.md) - [Mobile-Specific Functions](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-mobile-functions.md) # Basic Retrieves via WSProxy The WSProxy() object offers several retrieve options, depending on the level of complexity you need. The simplest option takes the type of object as the first parameter, and an array of object property names to retrieve. ## Example: Retrieve the First Page of DataExtensions This example returns the first page of DataExtensions without any filtering. The number of items per page varies depending on item type being requested and your account configuration. ``` var prox = new Script.Util.WSProxy(); var cols = [ "Name", "CustomerKey", "CategoryID", "IsSendable"]; var data = prox.retrieve("DataExtension", cols); ``` ## Example Response The response is an object with four properties from the APIObjects SOAP items. In addition to the standard response properties, retrieved responses include the HasMoreRows property. If this property is set to true, there are more items to be returned. To retrieve the entire data set, perform one or more requests using [pagination](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_WSProxy_advanced_retrieve.md). ``` { "Status": "OK", "RequestID": "fb768ddc-6670-4183-8b9d-4f0d5518bb2e", "Results": [...], "HasMoreRows": false } ``` ## Example: Filter the List of DataExtensions To filter the list of data extensions returned, add a third parameter to the function that contains a retrieve filter query. This filter specification is identical to the filter used by the SSJS Core library. This example includes a simple filter looking for DataExtension items where the CustomerKey is “ArtistsDE”. ``` var prox = new Script.Util.WSProxy(); var cols = ["Name","CustomerKey","CategoryID","IsSendable"]; var filter = { Property: "CustomerKey", SimpleOperator: "equals", Value: "ArtistsDE" }; var desc = prox.retrieve("DataExtension", cols, filter); ``` This example includes a complex filter looking for DataExtension items where the CustomerKey is “ArtistsDE” or the Name is “LikeCounter”. ``` var prox = new Script.Util.WSProxy(); var cols = ["Name","CustomerKey","CategoryID","IsSendable"]; var filter = { LeftOperand: { Property: "CustomerKey", SimpleOperator: "equals", Value: "ArtistsDE" }, LogicalOperator: "OR", RightOperand: { Property: "Name", SimpleOperator: "equals", Value: "LikeCounter" } }; var desc = prox.retrieve("DataExtension", cols, filter); ``` ## Example: Retrieve from All Accounts This example uses a parameter called queryAllAccounts to retrieve data from all accounts. ``` var prox = new Script.Util.WSProxy(); var queryAllAccounts = true; var cols = ["Name","CustomerKey","CategoryID","IsSendable"]; var filter = { Property: "CustomerKey", SimpleOperator: "equals", Value: "ArtistsDE" }; var desc = prox.retrieve("DataExtension", cols, filter, queryAllAccounts); ``` # Batch Delete Scheduled Async API Conversation and Non-Conversation Messages To delete scheduled conversations and non-conversation messages in batch, use the ScheduledRequest and ScheduledConversation objects together in the same request. Specify more than one Objects element in the body of the SOAP envelope, and format each like a single deletion request. Use the examples below as guides. You can make the request synchronously or asynchronously by specifying `synchronous` or `asynchronous` as the request type. Asynchronous requests are queued and processed in the order they arrive. General delays in Async API processing impact an asynchronous deletion request, just like any other asynchronous request. ## Sample SOAP Envelopes Use these code examples as a guide for creating your own API calls. ### Sample Synchronous Batch Request ```xml Synchronous ExampleConversationID_1 ExampleRequestID_1 ExampleRequestID_2 ExampleRequestID_3 ExampleConversationID_2 ``` ### Sample Synchronous Batch Response Use the OrdinalID values to match individual Results elements in the response with the corresponding Objects elements in the request. An OrdinalID of zero corresponds with the first Objects element in the request. ```xml OK Deleted 0 OK Deleted 1 OK Deleted 2 OK Deleted 3 OK Deleted 4 676FA9D6-74D5-4982-A336-59CD01683FC1 OK ``` ### Sample Asynchronous Batch Request In this example, the SendResponseTo options RespondWhen and IncludeResults are set to notify the caller during every processing step and to include the results of each deletion in the batch. ```xml Asynchronous HTTPPost https://www.examplethecallersdomain.com/example/GDPRDeletionResponse Always true ExampleConversationID_1 ExampleRequestID_1 ExampleRequestID_2 ExampleRequestID_3 ExampleConversationID_2 ``` ## Related Items - [Callback Handling for Asynchronous Calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_callback.md) - [Schedule a User-Initiated Email Send](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_a_user_initiated_email_message_send_via_the_web_service_api.md) - [Schedule an Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_an_email_send_definition.md) # BeginImpressionRegion ## Overview Begin an impression region within the supplied content. You can use the impression region to identify specific areas of content for analytical purposes. ### Syntax BeginImpressionRegion(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------- | | **1** | string | **Required** | Name of impression region | ## Example ``` ``` # ContentArea ## Overview Returns the content stored in the content area specified by its ID ### Syntax ContentArea(1, 2, 3, 4) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------------------------ | | **1** | string | **Required** | ID of specified content area | | **2** | string | **Required** | Name of any impression region contained in content area | | **3** | string | **Required** | Error message to deliver when the function can’t return content | | **4** | string | **Required** | Content area to display when the function can’t find other content | ## Example In this sample code, the variable gets the information from the specified content area. The content is not written to the email or landing page you create. Instead, the content resides in the variable for use as any other string: ``` var myContent = ContentArea(12345); ``` # ContentArea() Returns content from a classic content area. **note:** This function retrieves classic content areas, which are [no longer supported in Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=000381233&type=1). As a result, this function doesn't retrieve any content and shouldn’t be used. This documentation is retained for historical purposes. To retrieve content blocks created in Content Builder, use the [ContentBlockById() function](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-id.md). ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax `ContentArea(contentAreaId, impressionRegionName, boolErrorOnMissingContentArea, errorMessage, statusCode)` The `ContentArea()` function has five parameters: - `contentAreaId` (string or number): Required. The ID of the content area to retrieve. - `impressionRegionName` (string): The name of the impression region to associate with the content area. - `boolErrorOnMissingContentArea` (boolean): Determines whether the function returns an error when the system can’t locate the specified content area or returns an invalid content area. A value of `true` returns an error. Defaults to `true`. - `errorMessage` (string): Default content to return if an error occurs. Defaults to an empty string. - `statusCode` (number): An output variable that contains the exit code of the function. A value of `0` indicates the function found the content area and successfully rendered the content. A value of `-1` indicates either no content or an invalid content area. # ContentAreaByName Retrieve content from a specified content area. ## Syntax ContentAreaByName(1, 2, 3, 4) ## Function Properties | Ordinal | Type | | Description | | ------- | ------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **1** | string | **Required** | Name of content area | | **2** | string | | Impression region for content | | **3** | Boolean | | Indicates whether a call proceeds if it fails to retrieve content. A value of true returns an exception and terminates the call. A value of false allows the call to proceed. | | **4** | string | | Default content to display if the call does not return content from the specified content area | ## Example ``` ``` # ContentAreaByName Returns the content stored in the specified content area. ## Syntax `ContentAreaByName(1, 2, 3, 4)` ## Properties | Ordinal | Type | Description | | ------- | ------ | -------------------------------------------------------------------------------- | | `1` | String | Required. The name of the content area. | | `2` | String | The name of an impression region that’s contained in the specified content area. | | `3` | String | The error message to deliver if the function can’t return content. | | `4` | String | The content area to display if the function can’t find other content. | ## Example In this example, the variable gets the information from the specified content area. The content isn’t written to the email or landing page you create. Instead, the content resides in the variable for use as any other string. ``` var myContent = ContentAreaByName("myContentArea"); ``` Combine this function with the `Write()` function to output the content area in your message or site. ``` ``` ## See Also - [Write()](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_utilitiesWrite.md) # ContentAreaByName() Returns content from a classic content area. **note:** This function retrieves classic content areas, which are [no longer supported in Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=000381233&type=1). As a result, this function doesn't retrieve any content and shouldn’t be used. This documentation is retained for historical purposes. To retrieve content blocks created in Content Builder, use the [ContentBlockByName() function](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.md). ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax `ContentAreaByName(contentAreaName, impressionRegionName, boolErrorOnMissingContentArea, errorMessage, statusCode)` The `ContentAreaByName()` function has five parameters: - `contentAreaName` (string): Required. The name of the content area to retrieve. - `impressionRegionName` (string): The name of the impression region to associate with the content area. - `boolErrorOnMissingContentArea` (boolean): If `true`, the function returns an error if the content area can’t be found. If `false`, the function doesn’t return an error. The default value is `true`. - `errorMessage` (string): The content to return if an error occurs while retrieving the content area. - `statusCode` (number): An output variable that contains the exit code of the function. A value of `0` indicates the function found the content area and successfully rendered the content. A value of `-1` indicates either no content or an invalid content area. # ContentBlockByID ## Overview Retrieve content from a specified content block in Content Builder ### Syntax ContentBlockByID(1, 2, 3, 4) ### Function Properties | Ordinal | Type | | Description | | ------- | ------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **1** | string | **Required** | ID for content block | | **2** | string | | Impression region for content | | **3** | Boolean | | Indicates whether a call proceeds if it fails to retrieve content. A value of true returns an exception and terminates the call. A value of false allows the call to proceed. | | **4** | string | | Default content to display if the call does not return content from the specified content area | ## Example ``` ``` # ContentBlockById() Returns the content contained in a content block. In Marketing Cloud Engagement, the function retrieves a content block from Content Builder by its ID. This function returns content from Content Builder. For Classic Content areas, use the [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) function. In Marketing Cloud Next, the function retrieves a content block from the Marketing Content Management System by its content key. If more than one version of the content block is available, the function retrieves the version that was published most recently. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` ContentBlockbyId(contentBlockId, impressionRegionName, boolErrorOnMissingContentBlock, errorMessage, statusCode) ``` The `ContentBlockbyId()` function has five parameters: - `contentBlockId` (number): Required. The ID of the content block to retrieve. - `impressionRegionName` (string): The name of the impression region to associate with the content block. - `boolErrorOnMissingContentBlock` (boolean): If `true`, the function returns an error if the content block can’t be found. If `false`, the function doesn’t return an error. The default value is `true`. - `errorMessage` (string): The content to return if an error occurs while retrieving the content block. - `statusCode` (number): The exit code of the function. A value of `0` indicates the function found the content block and successfully rendered the content. A value of `-1` indicates either no content or an invalid content block. ## Usage To call the function, provide the ID (Marketing Cloud Engagement) or content key (Marketing Cloud Next) of the content block that you want to return. ``` %%[ Set @ContentBlockId = 52413 ]%%

%%=ContentBlockById(@ContentBlockId)=%%

``` If the function finds the content block, it returns the content in it. Otherwise, it returns an error message. ### Adding an Impression Region In Marketing Cloud Engagement, you can optionally begin an impression region when you insert the content block. This example inserts the content block with the ID 52413 and creates an impression area called "bodytext" at the same time. ``` %%[ Set @ContentBlockId = 52413 ]%%

%%=ContentBlockById(@ContentBlockId, "bodytext")=%%

``` Use the `EndImpressionRegion()` function to denote the end of the impression region. ### Using the Status Code Use the status code parameter to show fallback content if the function couldn’t retrieve the content block. ``` %%[ Var @Content, @ContentBlockId, @StatusCode Set @ContentBlockId = 52413 Set @Content = ContentBlockById(@ContentBlockId, "bodytext", false, "We're sorry, but something went wrong... ", @StatusCode) Output(@Content) If @StatusCode == -1 then Output(Concat('Visit the Example.com Help Pages for more information.')) EndIf ]%% ``` If the specified content block is found, the function outputs the content of the content block. Otherwise, the function outputs the fallback message and the message shown in the `If` statement. ## See Also - [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) - [ContentBlockByKey()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-key.md) - [ContentBlockByName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.md) - [EndImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-end-impression-region.md) # ContentBlockByKey ## Overview Retrieve content from a specified content block in Content Builder ### Syntax ContentBlockByKey(1, 2, 3, 4) ### Function Properties | Ordinal | Type | | Description | | ------- | ------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **1** | string | **Required** | External key for content block | | **2** | string | | Impression region for content | | **3** | Boolean | | Indicates whether a call proceeds if it fails to retrieve content. A value of true returns an exception and terminates the call. A value of false allows the call to proceed. | | **4** | string | | Default content to display if the call does not return content from the specified content area | ## Example ``` ``` # ContentBlockByKey() Returns the content contained in a content block from Content Builder by referencing its key. In Marketing Cloud Engagement, this function returns content from Content Builder. For Classic Content areas, use the [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) function. In Marketing Cloud Next, the function retrieves a content block from the Marketing Content Management System by its content key. If more than one version of the content block is available, the function retrieves the version that was published most recently. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` ContentBlockByKey(contentBlockKey, impressionRegionName, boolErrorOnMissingContentBlock, errorMessage, statusCode) ``` The `ContentBlockByKey()` function has five parameters: - `contentBlockKey` (string): Required. The key of the content block to retrieve. - `impressionRegionName` (string): The name of the impression region to associate with the content block. - `boolErrorOnMissingContentBlock` (boolean): If `true`, the function returns an error if the content block can’t be found. If `false`, the function doesn’t return an error. The default value is `true`. - `errorMessage` (string): The content to return if an error occurs while retrieving the content block. - `statusCode` (number): The exit code of the function. A value of `0` indicates the function found the content block and successfully rendered the content. A value of `-1` indicates either no content or an invalid content block. ## Usage To call the function, provide the unique key of the content block that you want to return. ``` %%[ Set @ContentBlockKey = "4720e904-e9d0-4b0c-8a49-ecef280a3fa4" ]%%

%%=ContentBlockByKey(@ContentBlockKey)=%%

``` If the function finds the content block, it returns the content in it. Otherwise, it returns an error message. ### Adding an Impression Region You can optionally begin an impression region when you insert the content block. This example inserts the content block with the key 4720e904-e9d0-4b0c-8a49-ecef280a3fa4 and creates an impression area called "bodytext" at the same time. ``` %%[ Set @ContentBlockKey = "4720e904-e9d0-4b0c-8a49-ecef280a3fa4" ]%%

%%=ContentBlockByKey(@ContentBlockKey, "bodytext")=%%

``` Use the `EndImpressionRegion()` function to denote the end of the impression region. ### Using the Status Code You can use the status code parameter to show fallback content if the function wasn’t able to retrieve the content block. ``` %%[ Var @Content, @ContentBlockKey, @StatusCode Set @ContentBlockKey = "4720e904-e9d0-4b0c-8a49-ecef280a3fa4" Set @Content = ContentBlockByKey(@ContentBlockKey, "bodytext", false, "We're sorry, but something went wrong... ", @StatusCode) Output(@Content) If @StatusCode == -1 then Output(Concat('Visit the Example.com Help Pages for more information.')) EndIf ]%% ``` If the specified content block is found, the function outputs the content of the content block. Otherwise, the function outputs the fallback message and the message shown in the `If` statement. ## See Also - [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) - [ContentBlockById()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-id.md) - [ContentBlockByName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.md) - [EndImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-end-impression-region.md) # ContentBlockByName ## Overview Retrieve content from a specified content block in Content Builder. This function will only work with shared content in a business unit if it is shared using a shared folder. ### Syntax ContentBlockByName(1, 2, 3, 4, 5) ### Function Properties | Ordinal | Type | | Description | | ------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **1** | string | **Required** | Name of the content block to return, including the path within the my contents folder if necessary | | **2** | string | | Impression region for content | | **3** | Boolean | | Indicates whether the function returns an error when the system can’t locate the specified content area or returns an invalid content area. A value of true returns an error. A value of false does not return an error. | | **4** | string | | Default content to return if an error occurs and no error returns. This value defaults to an empty string. | | **5** | string | | Returns the status of the call. A value of 0 indicates the function found the content area and successfully rendered the content. A value of -1 indicates either no content or an invalid content area, so the function returns the default content value. | ## Example ``` ``` # ContentBlockByName() Returns the content contained in a content block by referencing its name. In Marketing Cloud Engagement, the function retrieves a content block from Content Builder by name. This function returns content from Content Builder. For Classic Content areas, use the [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) function. In Marketing Cloud Next, the function retrieves a content block from the Marketing Content Management System by its API name. If more than one version of the content block is available, the function retrieves the version that was published most recently. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` ContentBlockByName(contentBlockName, impressionRegionName, boolErrorOnMissingContentBlock, errorMessage, statusCode) ``` The `ContentBlockByName()` function has five parameters: - `contentBlockName` (string): Required. The full path of the content block to retrieve. - `impressionRegionName` (string): The name of the impression region to associate with the content block. - `boolErrorOnMissingContentBlock` (boolean): If `true`, the function returns an error if the content block can’t be found. If `false`, the function doesn’t return an error. The default value is `true`. - `errorMessage` (string): The content to return if an error occurs while retrieving the content block. - `statusCode` (number): The exit code of the function. A value of `0` indicates the function found the content block and successfully rendered the content. A value of `-1` indicates either no content or an invalid content block. ## Usage To call the function, provide the name of the content block that you want to return. ``` %%[ Set @ContentBlockName = "Content Builder\Weekly Portfolio" ]%%

%%=ContentBlockByName(@ContentBlockName)=%%

``` If the function finds the content block, it returns the content in it. Otherwise, it returns an error message. ### Adding an Impression Region You can optionally begin an impression region when you insert the content block. This example inserts the content block with the name "Content Builder\Weekly Portfolio" and creates an impression area called "bodytext" at the same time. ``` %%[ Set @ContentBlockName = "Content Builder\Weekly Portfolio" ]%%

%%=ContentBlockByName(@ContentBlockName, "bodytext")=%%

``` Use the `EndImpressionRegion()` function to denote the end of the impression region. ### Using the Status Code You can use the status code parameter to show fallback content if the function wasn’t able to retrieve the content block. ``` %%[ Var @Content, @ContentBlockName, @StatusCode Set @ContentBlockName = "Content Builder\Weekly Portfolio" Set @Content = ContentBlockByName(@ContentBlockName, "bodytext", false, "We're sorry, but something went wrong... ", @StatusCode) Output(@Content) If @StatusCode == -1 then Output(Concat('Visit the Example.com Help Pages for more information.')) EndIf ]%% ``` If the specified content block is found, the function outputs the content of the content block. Otherwise, the function outputs the fallback message and the message shown in the `If` statement. ## See Also - [ContentAreaByName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area-by-name.md) - [ContentArea()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-area.md) - [ContentBlockById()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-id.md) - [ContentBlockByKey()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-key.md) - [EndImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-end-impression-region.md) # ContentImagebyID ## Overview Returns an img tag with the src attribute containing the path to an image from Content Builder. Identify the image to include with the ID value. The img tag includes the title and alt information for the selected image, as well as a border value, measured in pixels, and any identified thid value. If the value of the first parameter does not link to a valid image, you can include another image value for the second parameter as a default option. ### Syntax ContentImagebyID(1, 2) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------------------- | | **1** | string | **Required** | ID of image to return | | **2** | string | **Required** | Value used to return image if function can’t find the original image ID | ## Example ``` ``` # ContentImageById() Returns an `img` tag in which the `src` attribute is the path to an image from Content Builder. The img tag includes the title and alt information for the selected image, a `border` attribute set to `0`, and a `thid` attribute that contains an ID for the image. This function only works with images in Content Builder. It doesn’t work with image blocks. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` ContentImageById(imageExternalId, defaultImageExternalId) ``` The `ContentImageById()` function has two parameters. - `imageExternalId` (string): Required. The ID of an image in Content Builder. - `defaultImageExternalId` (string): Required. The ID of a fallback image in Content Builder. The function uses this image if it can’t find the image that you specified in the `imageExternalKey` parameter. ## Usage To use this function, pass it the ID of an image from Content Builder. You can optionally specify a default image to use if the function is unable to find the first image. ``` %%= ContentImageById(1237458, 1129480) =%% ``` If the function finds the image that you specified in the first parameter, it returns an `` tag that refers to that image. ``` Logo ``` If the function doesn’t find the specified image, it returns an `` tag that refers to the image that you specified in the second parameter. ``` Default ``` If you only want the URL of the image, use the `RegExMatch()` function to obtain the value of the `src` parameter. ``` %%[ Var @regEx, @contentImage, @contentImageSrc Set @regEx = '(?<=\bsrc=")[^"]*' Set @contentImage = ContentImageById(1237458, 1129480) Set @contentImageSrc = RegExMatch(@contentImage, @regEx, 0) ]%% Image URL: %%=v(@contentImageSrc)=%% ``` The function outputs the path to the image file. ``` Image URL: https://image.s1.sfmc-content.com/lib/fef2120002460d/m/1/1bf72acc-dddf-4162-91b2-8d975059e0a5.png ``` # ContentImagebyKey ## Overview Returns an img tag with the src attribute containing the path to an image from Content Builder. Identify the image to include with the ID value. The img tag includes the title and alt information for the selected image, as well as a border value, measured in pixels, and any identified thid value. If the value of the first parameter does not link to a valid image, you can include another image value for the second parameter as a default option. ### Syntax ContentImagebyKey(1, 2) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------------------------------------------------------------------- | | **1** | string | **Required** | External key of image to return | | **2** | string | **Required** | Value used to return image if function can’t find the original image ID | ## Example ``` ``` # ContentImageByKey() Returns an `img` tag in which the `src` attribute is the path to an image from Content Builder. The img tag includes the title and alt information for the selected image, a `border` attribute set to `0`, and a `thid` attribute that contains an ID for the image. This function only works with Image-type content in Content Builder. It doesn’t work with Image Block content. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` ContentImageByKey(imageExternalKey, defaultImageExternalKey) ``` The `ContentImageByKey()` function has two parameters: - `imageExternalKey` (string): Required. The external key of an image in Content Builder. - `defaultImageExternalKey` (string): Required. The external key of a fallback image in Content Builder. The function uses this image if it can’t find the image that you specified in the `imageExternalKey` parameter. ## Usage To use this function, pass it the external key of an image from Content Builder. You can optionally specify a default image to use if the function is unable to find the first image. ``` %%=ContentImageByKey('CorpLogo','DefaultImage')=%% ``` If the function finds the image that you specified in the first parameter, it returns an `` tag that refers to that image. ``` Logo ``` If the function doesn’t find the specified image, it returns an `` tag that refers to the image that you specified in the second parameter. ``` Default ``` # ContentValidation An object that contains information that’s used to validate content in an email. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | An ID that creates a relationship between objects across several requests. | | `CreatedDate` | String | The date and time when the object was created. Read-only. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Email` | [Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/email.md) object | Default email address for object. Indicates if subscriber information can be used for email sends. | | `ID` | Integer | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | String | The date and time when the object was last modified. | | `ObjectState` | String | Not used. | | `ObjectID` | String | A unique identifier for the object. Read-only. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an account that is managed on your behalf. | | `PartnerKey` | String | A unique identifier for an object, provided by a partner. This property can only be accessed by using the API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties can only be accessed by using the API. | | `Subscribers` | Array of [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) objects | Indicates subscribers associated with an object. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Email Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/email.md) - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) # ContentValidationResult An object that contains results of content validation perform call. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | | `Task` | [TaskResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/taskresult.md) object | Identifier of scheduled task as part of results. | ## Related Items - [ContentValidation object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/contentvalidation.md) - [ContentValidationTaskResult object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/contentvalidationtaskresult.md) # ContentValidationTaskResult An object that contains detailed results of content validation task. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | --------------------- | --------- | ------------------------------------------------------------------------------------------------------------ | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `ID` | String | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | ## Related Items - [ContentValidation object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/contentvalidation.md) - [ContentValidationResult object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/contentvalidationresult.md) # Convert Existing SOAP Calls to Asynchronous Processing Use these examples as models to convert your existing API calls to asynchronous processing. ## C# Synchronous Processing ```csharp CreateOptions co = new CreateOptions(); CreateResult[] results = integrationFramework.Create(co, subscribers, out requestID, out status); ``` ## C# Enabling Asynchronous Processing ```csharp CreateOptions co = new CreateOptions(); co.RequestType = RequestType.Asynchronous; co.RequestTypeSpecified = true; CreateResult[] results = integrationFramework.Create(co, subscribers, out requestID, out status); ``` # Copy an Image from a Website into the Portfolio Read an image or document directly from a public website into a Portfolio directory, and then use the image in your emails or landing pages. Items aren’t uploaded to the CDN until the IsUploaded property is True. Be sure to transfer only those images that you have explicit permission to use in your emails or landing pages. **note:** This example adds an image or document to a classic content portfolio. Marketing Cloud Engagement now uses Content Builder to manage content. To interact with Content Builder programmatically, use the [Asset endpoints in the REST API](/docs/marketing/marketing-cloud/references/mc_rest_assets). ## Sample SOAP Envelope Use this code example to construct your own request. ```xml http://email.exacttarget.com/ETWeb/images/exactTargetLogo.jpg exactTargetLogo.jpg ``` ## Related Items - [Asset endpoints in the REST API](/docs/marketing/marketing-cloud/references/mc_rest_assets) # Create Creates an individual object or a batch of objects. ## Parameters | Name | Data Type | Description | | --------------- | ------------------------------------------ | -------------------------------------------- | | `Objects` | Array of [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) objects | A collection of objects. | | `Options` | [UpdateOptions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updateoptions.md) object | Optionally specifies processing options. | | `OverallStatus` | String | Specifies the overall status of the request. | | `RequestID` | String | A unique identifier for the request. | ## Description The Create method allows objects to be created-individually or in batches. Multiple object types can be created with one call. Objects are created when they are added to the APIObject array. ## Input - `CreateOptions` - A CreateOptions instance is required for this parameter, but you don't need to define properties for the instance. - `APIObjects` - An array of objects to be acted upon. The objects are acted on in the order they have been added - first in, first out. This array can hold different object types. Therefore, complex interactions like creating an email, creating a list, and sending the email can be accomplished in one call. - `RequestID` - This parameter contains a string value containing an output variable of the key of the request. By default, this value is a GUID (Globally Unique Identifier). - `OverallStatus` - This parameter returns a string value containing the overall status of the request. Valid status values include: - `OK` - This status code states that all objects were successfully created. - `Has Error` -Valid for Create method calls with multiple APIObject objects, this status code states that some of the operations failed, while some succeeded. - `Error` - This status code states that all create operations failed during validation or processing. ## Output - `CreateResult` - An array of objects holding a list of return values. The objects are returned in the order acted upon: first in, first out. This array contains one CreateResult object per input APIObject. ## RelatedItems - [CreateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult_appex.md) # Create Use the `Create` method to create an individual object or batch of objects. You can create multiple objects with one call. ## Parameters | Name | Data Type | Description | | ----------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Objects` | Array of [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) objects | A collection of one or more objects to create. The objects are created in the order they have been acted upon--first in, first out. This array can hold different object types, which allows you to perform complex interactions like creating an email, creating a list, and sending the email, in one call. | | `Options` | [CreateOptions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createoptions.md) object | Optionally specifies [more processing options](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createoptions.md). A CreateOptions instance is required for this parameter. However, no properties need to be defined for the instance. | | `RequestID` | String | A unique identifier for the request. This parameter contains a string value containing an output variable of the key of the request. By default, this value is a GUID. | ## Output | Name | Data Type | Description | | --------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CreateResult` | Array | An array of objects holding a list of return values. The objects are returned in the order they are created: first in, first out. This array contains one CreateResult object per input APIObject. | | `OverallStatus` | String | A string value containing the overall status of the request. Possible values are `OK` (all objects were successfully created), `Has Error` (some of the operations failed) and `Error` (all create operations failed). | ## Related Items - [Update method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/update.md) # Create a Batch ## Overview This API resource creates a batch of privacy setting changes. The call returns a batch_id you then use to GET the status of the batch changes. ## Method and Endpoint `POST https://app.igodigital.com/api/v2/organization/{customer_mid}/privacy` ## URL Parameters | Name | Type | Description | | ------------ | ------ | ------------------- | | customer_mid | string | ID for the account. | ## JSON Parameters | Name | Type | Required | Description | | ----- | ----- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | batch | array | Yes | Contains key value pairs where the key represents a profile ID and the value is an array of strings representing the intended state of the profile's privacy settings after the record is processed. To remove any existing privacy settings for a profile, pass an empty array, such as []. | ### Privacy Values to Restrict To apply the privacy states to the profile, include one or more of these values in the array. | Value | Description | | -------------- | ------------------------------------------------------------------------------- | | do_not_track | Prevents data received via collect from being saved by Personalization Builder. | | do_not_profile | Prevents using the profile in generating recommendations. | | do_not_process | Prevents processing of the profile's data. | ### Privacy Values for Right to be Forgotten These values represent exclusive actions for a single profile. Don't use them with any other processing strings in that profile's array. | Value | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | rtbf_delete | Immediately deletes the profile and its associated data. | | rtbf_suppress | Deletes the profile and its associated data after a suppression period of up to 30 days. You can change the suppression period privacy setting. Fourteen days is the default. | | remove_rtbf_suppress | Stops a previously scheduled profile deletion. | ## Example Request ``` Host: https://app.igodigital.com POST /api/v2/organization/12345678/privacy Content-Type: application/json Authorization: Bearer YOUR_API_KEY { "batch": { "hashed-id-01": ["do_not_track"], // Adds "do_not_track" privacy setting, removes "do_not_profile" or "do_not_process" if they were previously set "hashed-id-02": ["do_not_profile"], // Adds "do_not_profile" privacy setting, removes "do_not_track" or "do_not_process" if they were previously set "hashed-id-03": ["do_not_process"], // Adds "do_not_process" privacy setting, removes "do_not_profile" or "do_not_track" if they were previously set "hashed-id-04": ["do_not_track", "do_not_profile"], // Adds "do_not_track" and "do_not_profile" privacy settings, removes "do_not_process" if it was previously set "hashed-id-05": ["do_not_track", "do_not_process"], // Adds "do_not_track" and "do_not_process" privacy settings, removes "do_not_profile" if it was previously set "hashed-id-06": ["do_not_profile", "do_not_process"], // Adds "do_not_profile" and "do_not_process" privacy settings, removes "do_not_track" if it was previously set "hashed-id-07": ["do_not_track", "do_not_profile", "do_not_process"], // Adds "do_not_track", "do_not_profile" and "do_not_process" privacy settings "hashed-id-08": [], // Removes any existing privacy settings for profile "hashed-id-09": ["rtbf_delete"], // Deletes profile and associated data "hashed-id-10": ["rtbf_suppress"] // Deletes profile and associated data after suppression period } } ``` ## Example Response ``` { "batch_id": "af417962-c188-4110-adc2-7ea67590e254" } ``` # Create a Custom Profile Center with AMPscript This page contains information about creating a custom Profile Center for Email Studio's Web Collect that takes information entered on a web page and uses it to update information in your account. This Profile Center also triggers a send using information taken from Marketing Cloud Engagement. ## Web Collect Overview Email Studio's Web Collect allows your customers to subscribe, provide attribute information, or unsubscribe using forms on your website. If you allow new subscribers to sign up via your website, you must pass data for all required profile and preference attributes, including those that are defined as hidden, for each new subscriber. ## Profile Center Overview The Email Studio Profile Center displays when a subscriber clicks the Modify Profile link in an email that you sent while using Email Studio. To access your Profile Center, navigate to the Subscribers | Profile Management section of Email Studio and choose Preview Profile Center. The Profile Center displays all attributes that aren't defined as hidden in your account. ## What Is a Custom Profile Center? The custom profile center includes a workflow specifically designed and developed to take information submitted by a new or existing subscriber and update records accordingly. Because it is a custom solution, you can create it to perform specific actions depending on your needs and your workflow. ## Why Create a Custom Profile Center Using AMPscript and SOAP API? Your custom profile center allows you to manage information in your account and use that information to conduct triggered sends as confirmation of more or changed information in a particular profile. The automation allows the user to keep their information up to date without involving more effort from your team. This profile center also allows you to review tracking information inside Marketing Cloud Engagement for analysis and appropriate action. ## Possible Use Case Northern Trail Outfitters uses Marketing Cloud Engagement to manage information about their subscribers and conduct triggered sends regarding information changes to those subscribers. To help customers manage their information, Northern Trail Outfitters builds a custom profile center that takes information from a web form and either creates a new subscriber record or updates an existing record. That change triggers an email that includes the appropriate dynamic form information for that record and sends it to the new or existing subscriber. To set up the triggered sends: 1. Download the files via the link on this page, or copy and paste the examples below. 2. Edit the AMPscript to customize the variables for your server, configuration, and subscribers. 3. Put these edited pages in the correct folder of your local web server (where your Web Collect page is running) that can access the server and also access the SOAP API endpoint. Review the next sections for more details. For more help with your setup, contact Salesforce Customer Support. ## How to Create a Custom Profile Center Using AMPscript and SOAP API The custom profile center includes several components. - A web form used to interact with new and existing subscribers. - The code necessary to make API calls. - An administrative page used to determine the information that shows in the profile center. - The email message used to communicate profile changes to the subscriber. - The triggered send definition used to send the email message. ## How to Create the Web Form Use this code example as a template for building your own web form. ``` %%[ /* Get the Id of the account */ Set @mid = [memberid] /* Get the key from the form */ Set @subKey = [_subscriberkey] if Empty(@subKey) or @subKey == "" then SET @subKey = "subkey@example.com" endif /* Create the subscriber's object */ set @subscriber = CreateObject( "Subscriber" ) SetObjectProperty( @subscriber, "EmailAddress", @subKey ) SetObjectProperty( @subscriber, "SubscriberKey", @subKey ) /* make sure the system is posting */ SET @isUpdate = RequestParameter("personal") SET @save = "FALSE" if Not Empty(@isUpdate) then SET @save = "TRUE" /* get the attributes and checkBoxes */ SET @checkBoxes = RequestParameter("checkBoxList") SET @attributes = RequestParameter("attributes") /* Create arrays from each of the lists */ SET @checkArray = BuildRowSetFromString(@checkBoxes,"||") SET @attArray = BuildRowSetFromString(@attributes,"||") SET @attCount = RowCount(@attArray) SET @checkCount = RowCount(@checkArray) SET @display = "" SET @display2 = "" if @attCount > 0 then /* iterate all of the elements */ FOR @i = 1 TO @attCount DO Set @attribute = Field(Row(@attArray, @i),1) Set @value = RequestParameter(@attribute) /* Create the Attribute */ Set @att = CreateObject( "Attribute" ) SetObjectProperty( @att, "Name", @attribute ) SetObjectProperty( @att, "Value", @value ) /* Set the attribute to the subscriber */ AddObjectArrayItem( @subscriber, "Attributes", @att ) /* Set @display = Concat(@display,@attribute, " = " , @value, " @@@ ") */ NEXT @i endif /* Set @display = Concat(@display," ---CHECK --- ") */ if @checkCount > 0 then /* iterate all of the elements */ FOR @i = 1 TO @checkCount DO set @values = "" Set @attribute = Field(Row(@checkArray, @i),1) Set @internalCheckArray = BuildRowSetFromString(@attribute,":") if RowCount(@internalCheckArray) > 1 then SET @checkName = Field(Row(@internalCheckArray, 1),1) SET @checkNumber = Field(Row(@internalCheckArray, 2),1) FOR @j = @checkNumber DOWNTO 1 DO Set @singleCheckName = Concat(@checkName,@j) Set @value = RequestParameter(@singleCheckName) IF not Empty(@value) then if(Empty(@values))then set @values = @value else set @values = Concat(@values, ",", @value ) endif endif NEXT @j /* Create the Attribute */ Set @apiName = Replace(@checkName,"-"," ") Set @att = CreateObject( "Attribute" ) SetObjectProperty( @att, "Name", @apiName ) SetObjectProperty( @att, "Value", @values ) /* Set the attribute to the subscriber */ AddObjectArrayItem( @subscriber, "Attributes", @att ) /* Set @display = Concat(@display,@apiName, " = " , @values, " @@@ ") */ endif NEXT @i endif endif /* Did the user press the subscriptions submit button */ if RequestParameter("subscription") == 1 then SET @save = "TRUE" /* request paramter from List A */ Set @theListA = RequestParameter("ListsA") Set @array = BuildRowSetFromString(@theListA, '|') for @r = 1 to Rowcount(@array) do Set @configRow = Row(@array,@r) Set @configkey = Field(@configRow,1) Set @value = RequestParameter(@configkey) if Empty(@value) then set @subscription = CreateObject("SubscriberList") SetObjectProperty( @subscription, "ID", @configkey ) SetObjectProperty( @subscription, "IDSpecified", "true" ) SetObjectProperty( @subscription, "Status", "Unsubscribed" ) SetObjectProperty( @subscription, "StatusSpecified", "true" ) AddObjectArrayItem( @subscriber, "Lists", @subscription ) else set @subscription = CreateObject("SubscriberList") SetObjectProperty( @subscription, "ID", @configkey ) SetObjectProperty( @subscription, "IDSpecified", "true" ) SetObjectProperty( @subscription, "Status", "Active" ) SetObjectProperty( @subscription, "StatusSpecified", "true" ) AddObjectArrayItem( @subscriber, "Lists", @subscription ) endif next @r /* request paramter from List U */ Set @theListU = RequestParameter("ListsU") Set @array = BuildRowSetFromString(@theListU, '|') for @r = 1 to Rowcount(@array) do Set @configRow = Row(@array,@r) Set @configkey = Field(@configRow,1) Set @value = RequestParameter(@configkey) if @value == "Active" then set @subscription = CreateObject("SubscriberList") SetObjectProperty( @subscription, "ID", @configkey ) SetObjectProperty( @subscription, "IDSpecified", "true" ) SetObjectProperty( @subscription, "Status", "Active" ) SetObjectProperty( @subscription, "Action", "create" ) AddObjectArrayItem( @subscriber, "Lists", @subscription ) endif next @r endif /* Did the user press the Unsub Allbutton */ if RequestParameter("subscriptionALL") == 1 then SET @save = "TRUE" if RequestParameter("UnsubAll") == "true" then SetObjectProperty( @subscriber, "Status", "Unsubscribed" ) else SET @error = "True" set @message = "Please Select One of the Options" endif endif /* SET @display3 = "" */ /* Did the user change their preferernces */ if RequestParameter("preference") == 1 then SET @save = "TRUE" Set @ppr = RequestParameter("preferences") Set @array = BuildRowSetFromString(@ppr, '|') /* SET @display3 = Concat(@array,"@@@@@@@@@") */ for @r = 1 to Rowcount(@array) do Set @configRow = Row(@array,@r) Set @configkey = Field(@configRow,1) Set @value = RequestParameter(@configkey) if @configKey == "EmailTypePreference" then if @value == "true" then SetObjectProperty( @subscriber, "EmailTypePreference", "HTML" ) else SetObjectProperty( @subscriber, "EmailTypePreference", "TEXT" ) endif else if @value == "true" then Set @value = "True" else Set @value = "False" endif set @pref = CreateObject( "Attribute" ) SetObjectProperty( @pref, "Name", @configkey ) SetObjectProperty( @pref, "Value", @value ) AddObjectArrayItem( @subscriber, "Attributes", @pref ) endIf next @r endif IF @save == "TRUE" then /* change the last modify date */ SET @theTime = Format(Now(), "MM/dd/yyyy") set @LastModify = CreateObject( "Attribute" ) SetObjectProperty( @LastModify, "Name", "Last Modify" ) SetObjectProperty( @LastModify, "Value", @theTime ) AddObjectArrayItem( @subscriber, "Attributes", @LastModify ) /* Update the Subscriber If we have to */ var @createOpts, @saveOpt /* Create the save option */ set @saveOpt = CreateObject("SaveOption") SetObjectProperty( @saveOpt, "SaveAction", "UpdateAdd" ) SetObjectProperty( @saveOpt, "PropertyName", "*" ) /* Specify the Update option */ set @createOpts = CreateObject("CreateOptions") AddObjectArrayItem( @createOpts, "SaveOptions", @saveOpt ) /* Update the subscriber */ set @createStatusCode = InvokeCreate( @subscriber, @createErrDesc, @createErrNo, @createOpts ) /* If we failed to create the subscriber, output the information as the top level error */ if @createStatusCode != "OK" then Redirect("http://%%microsite_base_url[default]3891541[/default]%%") else SET @TheWorks = 'true' endif endif ]%% ``` This section retrieves information from data extensions for display. ``` %%[ /* get the values from the DE */ Set @tableValues = LOOKUPORDEREDROWS("adminPageInfo",0,"Order asc", "SecretField", "1") /* get the count of the elements */ Set @theRowCount = RowCount( @tableValues ) /* Counters for the number of columns and number of elements in a group */ Set @counter = 0 Set @idCounter = 1 /* List that contains the name of all the elements that we need to retrieve when the user tries to save */ Set @AttributeList = "" Set @checkBoxList = "" Set @radioList = "" /* for all the variables */ FOR @Variable = 1 TO @theRowCount DO /* get each of the rows */ Set @table1 = Row( @tableValues, @Variable ) /* get the previous parameters except the first one */ if not @Variable == 1 then Set @table2 = Row( @tableValues, Subtract(@Variable,1) ) endif /* get all the varaibles we need */ Set @order = Field( @table1, "Order" ) Set @name = Field( @table1, "Name" ) Set @at = Field( @table1, "Attribute Value") Set @dt = Field( @table1, "Data Type" ) Set @ev = Field( @table1, "Element Value" ) Set @group = Field( @table1, "Group" ) Set @groupName = Field( @table1, "Group Name" ) Set @limit = Field(@table1, "Limit") Set @column = Field(@table1, "Column") Set @required = Field(@table1,"Required") Set @readOnly = Field(@table1, "Read Only") Set @key = Field( @table1, "key" ) /* make sure that the fields can be used as IDs (i.e. replace the white space with -) */ set @cleanID = Replace(@name," ","-") set @cleanDt = Replace(@dt," ","-") Set @cleanGroup = Replace(@group," ","-") /* get the name of the previous varaible */ if not empty(@table2) then Set @group2 = Field( @table2, "Group" ) Set @dt2 = Field( @table2, "Data Type" ) Set @name2 = Field( @table2, "Name" ) endif /* If the Groups are different and the names are different. There is a similar check later on, but this one makes sure it happens before displaying the group headers */ if @group != @group2 and @name != @name2 then /* If the type of the previous Group was the Drop Down we need to close the select tag */ if @dt2 == "Drop Down" then ]%% %%[ endif endif /* If the groups are different and there is a group name (i.e. NO Text related fields) */ if @group != @group2 and NOT Empty(@groupName) then /* If there is no fields or the limit is not 0, we are going to create a dynamic call to a javascript function to make sure the limits are met. */ if Not Empty(@limit) and @limit !=0 then Set @call = Concat(@cleanGroup,",", @limit) if not Empty(@tocall) then Set @tocall = Concat(@tocall,"|" , @call) else Set @tocall = @call endif endif /* If the type is a drop-down or a Radio we need to save all the names in the list by just concatinating them with a comma */ if @dt == "Radio" OR @dt == "Drop Down" then if @readOnly != true then Set @AttributeList = Concat(@AttributeList,"||",@name) endif /* If the type is a check box we need to concatenate them with a pipe So we can then append all the values and save them in ONE field */ endif /* Set the counter to 0 and then the counter of the columns to the number Of colums that we need to display. When these two numbers are the same we need to diplay the elements in the next page */ Set @counter = 0 Set @columnNum = @column /* ID used to display an error when the user selects too many options, or a required field is not filled. The option is always in the page, but hidden. It is dynamic because we only need the group name and the rest is just appended */ Set @theErrorID = Concat(@cleanGroup,"error") Set @requiredID = Concat(@cleanGroup,"required") /* Div that solved the problems related to the floating Divs */ ]%%
%%[ /* If the previous element was not an input field or a drop-down menu, display a break before the group header */ if @dt2 != "Input Field" and @dt2 != "Drop Down" then ]%%
%%[ endif ]%% %%[ /* If the element is required display the red * */ if @required == true then Set @requiredFields = Concat(@requiredFields,"|",@cleanID) ]%% * %%[ else ]%%    %%[ endif /* Display the group header and the error code for too many selections */ ]%% %%=v(@groupName)=%% Too many selections (MAX %%=v(@limit)=%%) %%[ /* If the element is required then set a hidden message that we can show when there is an error. */ if @required == true then ]%% This Field is required %%[ else ]%% %%[ endif /* If the element is not a drop-down, we need to create a space between the header and the field */ if @dt != "Drop Down" then ]%%
%%[ endif if @dt == "CheckBox" then ]%% %%[ endif else Set @counter = Add(@counter, 1) Set @theTest = Concat(@theTest, " " , @ev) endif /* If the groups are different and the names are also different That means that we have change the element */ if @group != @group2 and @name != @name2 then /* if the data type is a dropDown we need to open the drop Down Tag */ if @dt == "Drop Down" then ]%%
%%=v(@at)=%%
%%[ /* If the input type is input field we display the name and then create the input. Also, we need to display the * before the name if required. */ elseif @dt == "Input Field" then /* add the attribute to the list of elements to enter in the system */ if @readOnly != true then Set @AttributeList = Concat(@AttributeList,"||",@name) endif Set @requiredID = Concat(@cleanID,"required") ]%%
%%[ /* If its required display the red * */ if @required == true then Set @requiredFields = Concat(@requiredFields,"|",@cleanID) ]%% * %%[ else ]%%    %%[ endif ]%% This Field is required
%%[ /* If it is a radio button data type, we just need to display the name and then the option */ elseif @dt == "Radio" then ]%%
%%=v(@at)=%%
%%[ /* If it is a text area just display the name and then the text area */ elseif @dt == "Text Area" then /* add the attribute name to the List */ if @readOnly != true then Set @AttributeList = Concat(@AttributeList,"||",@name) endif Set @requiredID = Concat(@cleanID,"required") ]%%
%%[ /* If its required display the red * */ if @required == true then Set @requiredFields = Concat(@requiredFields,"|",@cleanID) ]%% * %%[ else ]%%    %%[ endif ]%% This Field is required

%%[ /* if it is a drop-down then we display only the option. The open and close tags are done elsewhere. */ elseif @dt == "Drop Down" then ]%% %%[ endif NEXT @Variable /* Clean the name of the group to be used on an id */ Set @thegroup2 = Replace(@group," ","-") IF IndexOf(@checkBoxList, @thegroup2 ) == 0 and @dt == "CheckBox" then /* Get the counter and reduce it by one */ Set @boxCounter = Subtract(@idCounter,1) /* if the Counter was one, then set it back to 1 */ if @boxCounter == 0 then Set @boxCounter = 1 endif /* Set the name and the counter into the list */ Set @checkBoxList = Concat(@checkBoxList,@thegroup2,":",@boxCounter,"||") endif SET @len = Length(@requiredFields) Set @requiredFields = Substring(@requiredFields,1,@len) SET @toCall = Concat(@toCall,"@@",@requiredFields) /* Set up the Call */ Set @toCall = Concat("areLimitsInOrder('",@toCall,"');") ]%% ``` This section retrieves the list to be modified as part of the activity in the profile center. ``` %%[ /* Find Out the status of the subscribers */ SET @rr4 = CreateObject("RetrieveRequest") SetObjectProperty(@rr4,"ObjectType","ListSubscriber") AddObjectArrayItem(@rr4, "Properties", "Status") AddObjectArrayItem(@rr4, "Properties", "ListID") /* Make sure that the list is public */ SET @sfp2 = CreateObject("SimpleFilterPart") SetObjectProperty(@sfp2,"Property","SubscriberKey") SetObjectProperty(@sfp2,"SimpleOperator","equals") AddObjectArrayItem(@sfp2,"Value",@subKey) /* set the filter to the request */ SetObjectProperty(@rr4,"Filter",@sfp2) SET @listStatus = InvokeRetrieve(@rr4, @status) /* Create the Request for the list */ SET @rr3 = CreateObject("RetrieveRequest") SetObjectProperty(@rr3,"ObjectType","List") AddObjectArrayItem(@rr3, "Properties", "ListName") AddObjectArrayItem(@rr3, "Properties", "Type") AddObjectArrayItem(@rr3, "Properties", "Description") AddObjectArrayItem(@rr3, "Properties", "ID") /* Make sure that the list is public */ SET @sfp2 = CreateObject("SimpleFilterPart") SetObjectProperty(@sfp2,"Property","Type") SetObjectProperty(@sfp2,"SimpleOperator","equals") AddObjectArrayItem(@sfp2,"Value","public") /* Make sure that the list is not a publication list */ SET @sfp3 = CreateObject("SimpleFilterPart") SetObjectProperty(@sfp3,"Property","ListClassification") SetObjectProperty(@sfp3,"SimpleOperator","equals") AddObjectArrayItem(@sfp3,"Value","ExactTargetList") /* set the complex filter */ Set @cf1 = CreateObject("ComplexFilterPart") SetObjectProperty(@cf1,"LeftOperand",@sfp2) SetObjectProperty(@cf1,"RightOperand",@sfp3) SetObjectProperty(@cf1,"LogicalOperator","AND") /* set the filter to the request */ SetObjectProperty(@rr3,"Filter",@cf1) SET @atts = InvokeRetrieve(@rr3, @status) /* String to store all the list ids */ SET @ListsA = "" SET @ListsU = "" Set @lA = 1 Set @lU = 1 /* make sure that lists are present */ IF RowCount(@atts) > 0 THEN /* For all of the present lists, take the following actions */ FOR @c = 1 TO RowCount(@atts) DO /* get each of the rows */ SET @lis = Row(@atts,@c) /* get the necesary variables */ SET @lis_name = Field(@lis,'ListName') SET @lis_ID = Field(@lis,'ID') SET @lis_des = Field(@lis,'Description') Set @printed = false /* Find the status of the public list */ IF RowCount(@listStatus) > 0 THEN /* for all the status of the list */ FOR @d = 1 TO RowCount(@listStatus) DO SET @lisStat = Row(@listStatus,@d) SET @lisStat_id = Field(@lisStat,'ListID') SET @lis_status = Field(@lisStat,'Status') if @lisStat_id == @lis_ID and @lis_status == 'Active' then ]%% %%=v(@lis_name)=%%
%%=v(@lis_des)=%%

%%[ /* create the array of Active list ids */ if @lA == 1 then SET @ListsA = @lis_ID SET @lA = 2 else SET @ListsA = Concat(@ListsA, "|" , @lis_ID) endif Set @printed = true elseif @lisStat_id == @lis_ID and @lis_status == 'Unsubscribed' then ]%% %%=v(@lis_name)=%%
%%=v(@lis_des)=%%

%%[ /* create the array of Active list ids */ if @lA == 1 then SET @ListsA = @lis_ID SET @lA = 2 else SET @ListsA = Concat(@ListsA, "|" , @lis_ID) endif Set @printed = true endif NEXT @d ENDIF IF @printed == false then ]%% %%=v(@lis_name)=%%
%%=v(@lis_des)=%%
%%[ /* create the array of Non Active list ids */ if @lD== 1 then SET @ListsU = @lis_ID SET @lD = 2 else SET @ListsU = Concat(@ListsU, "|" , @lis_ID) endif endif NEXT @c endif ]%% ``` ``` %%[ /* List that stores all the preferences */ var @preferences SET @preferences = "EmailTypePreference" /* Get all the subscriber attributes */ SET @rr2 = CreateObject("RetrieveRequest") SetObjectProperty(@rr2,"ObjectType","Subscriber") AddObjectArrayItem(@rr2, "Properties", "ID") AddObjectArrayItem(@rr2, "Properties", "EmailTypePreference") AddObjectArrayItem(@rr2, "Properties", "EmailAddress") AddObjectArrayItem(@rr2, "Properties", "SubscriberKey") AddObjectArrayItem(@rr2, "Properties", "Status") /* Create a filter be the subscriber Id */ SET @sfp2 = CreateObject("SimpleFilterPart") SetObjectProperty(@sfp2,"Property","SubscriberKey") SetObjectProperty(@sfp2,"SimpleOperator","equals") AddObjectArrayItem(@sfp2,"Value",@subKey) /* invoke the Retrieve Call */ SetObjectProperty(@rr2,"Filter",@sfp2) SET @atts = InvokeRetrieve(@rr2,@status) /* Make a list of the Preferences */ IF RowCount(@atts) > 0 THEN SET @subAtts = Field(Row(@atts,1),"Attributes") SET @pereference = Field(Row(@atts,1),"EmailTypePreference") ]%% HTML Emails
When possible, send e-mail newsletters as HTML instead of plain text. %%[ Set @p = 1 /* for all the attributes make sure if the values are true or False */ FOR @c = 1 TO RowCount(@subAtts) DO SET @att = Row(@subAtts,@c) SET @att_name = Field(@att,'Name') SET @att_val = Field(@att,'Value') /* save the corresponding values to an array */ IF @att_val == "true" or @att_val == "false" then SET @preferences = Concat(@att_name, "|" , @preferences) ]%% %%=v(@att_name)=%%
%%[ ENDIF NEXT @c ENDIF ]%% ``` ## How to Create the Administrative Page Use this code example as a model as you build your own administrative page. ``` %%[ /* Initialize variables */ Var @tableValues, @table1, @numberOfValues var @displayOrder, @valueOrder,@name, @attributeValue, @dataType, @elementValue, @defaultSelection, @defaultValue, @secret, @isDelete /* form values */ var @formSubmitted,@changeNumber set @formSubmitted = 0 set @changeNumber = 0 if not Empty(RequestParameter("save")) then set @formSubmitted = 1 endif /* get the isDelete field */ if not Empty(RequestParameter("isDelete")) then Set @isDelete = RequestParameter("isDelete") endif /* get if it is a change number */ if not Empty(RequestParameter("number")) then Set @changeNumber = RequestParameter("number") endif /* get the secret key */ if not Empty(RequestParameter("key")) then Set @secret = RequestParameter("key") endif /* If we came from a delete then */ if @isDelete == 1 and not Empty(RequestParameter("key")) then DeleteData("adminPageInfo","key",@secret) Set @isDelete = 0 set @formSubmitted = 0 endif /* Submit from the edit page */ if @formSubmitted == 1 then /* get the Order */ if not Empty(RequestParameter("Order")) then Set @Order = RequestParameter("Order") endif /* get the valueOrder */ if not Empty(RequestParameter("valueOrder")) then Set @valueOrder = RequestParameter("valueOrder") endif /* get the name */ if not Empty(RequestParameter("name")) then Set @name = RequestParameter("name") endif /* get the group */ if not Empty(RequestParameter("group")) then Set @group = RequestParameter("group") endif /* get the groupName */ if not Empty(RequestParameter("groupName")) then Set @groupName = RequestParameter("groupName") endif /* get the attributeValue*/ if not Empty(RequestParameter("attributeValue")) then Set @attributeValue = RequestParameter("attributeValue"); endif /* get the dataType */ if not Empty(RequestParameter("dataType")) then Set @dataType = RequestParameter("dataType") endif /* get the elementValue */ if not Empty(RequestParameter("elementValue")) then Set @elementValue = RequestParameter("elementValue") endif /* get the required */ if not Empty(RequestParameter("isRequired")) then Set @req = "True" else Set @req = "False" endif /* get the read only */ if not Empty(RequestParameter("isReadOnly")) then Set @rol = "True" else Set @rol = "False" endif /* get the limit */ if not Empty(RequestParameter("limit")) then Set @limit = RequestParameter("limit") endif /* get the Column */ if not Empty(RequestParameter("Column")) then Set @column = RequestParameter("Column") endif if not Empty(@secret) then UpdateData("adminPageInfo", 1 ,"key",@secret, "Order", @Order, "Group",@group,"Group Name",@groupName,"Name",@name, "Attribute Value", @attributeValue ,"Data Type", @dataType, "Element Value",@elementValue,"Required",@req,"Read Only", @rol, "Limit", @limit, "Column", @column ) else /* get the last order */ Set @lastObject = LookupRows("adminPageInfo","SecretField", "1") Set @lastCount = RowCount( @lastObject ) Set @lastCount = add(@lastCount, 1) InsertData("adminPageInfo","Order", @lastCount, "Name",@name, "Group",@group,"Group Name",@groupName,"Attribute Value", @attributeValue ,"Data Type", @dataType, "Element Value",@elementValue,"Required",@req,"Read Only", @rol, "key", GUID(), "Limit", @limit,"Column", @column ) endif Redirect(RequestParameter('PAGEURL')) set @formSubmitted = 0 endif /* Pull all the values for the DE */ Set @tableValues = LOOKUPORDEREDROWS("adminPageInfo",0,"Order asc", "SecretField", "1") Set @theRowCount = RowCount( @tableValues ) if Empty( @tableValues ) or @theRowCount == 0 then Set @numberOfValues =0 else /* Get the count of rows in the data extension */ Set @numberOfValues = @theRowCount endif /* if we need to change the number do it here */ if @changeNumber == 1 then Var @start, @end, @key SET @start = RequestParameter("start") SET @end = RequestParameter("end") SET @key = RequestParameter("thekey") /* make sure that the variables needed to change the page are not null */ if Empty(@start) or Empty(@end) or Empty(@key) then SET @a = 3 else /* first change the new one */ UpdateData("adminPageInfo", 1 ,"key",@key,"Order",@end) SET @condition = Subtract(@start , @end) /* test for start or end case */ if @condition < 0 then Set @minusC = 1 SET @theStart = add(@start,@minusC) SET @message = "" FOR @Variable = @theStart TO @end DO Set @table1 = Row( @tableValues, @Variable ) Set @key = Field( @table1, "key" ) Set @order = Field( @table1, "Order" ) Set @value = Subtract(@order, @minusC) Set @name = Field( @table1, "Name" ) UpdateData("adminPageInfo", 1 ,"key",@key,"Order",@value) NEXT @Variable else Set @plusC = 1 SET @theEnd = Subtract(@start, @plusC) SET @message = "" FOR @Variable = @end TO @theEnd DO Set @table1 = Row( @tableValues, @Variable ) Set @key = Field( @table1, "key" ) Set @order = Field( @table1, "Order" ) Set @value = Add(@order,@plusC) Set @name = Field( @table1, "Name" ) UpdateData("adminPageInfo", 1 ,"key",@key,"Order",@value) NEXT @Variable endif Redirect(RequestParameter('PAGEURL')) endif endif ]%% %%[ Set @thisTable = LookupRows("adminPageInfo","SecretField", "1") Set @theRowCount = RowCount( @tableValues ) if Empty( @tableValues ) or @theRowCount == 0 then Set @numberOfValues =0 else /* Get the count of rows in the data extension */ Set @numberOfValues = @theRowCount endif ]%% ``` The response includes information about the Automation Activity. ```json { "Status": "OK", "RequestID": "eb0dccf7-ce17-4f9b-9427-fffc8c4cf034", "Results": [ { "NewID": 0, "NewObjectID": "9c825220-6f2f-40f2-95c2-e44909afed87", "PartnerKey": null, "Object": { "Schedule": null, "AutomationTasks": [ { "AutomationTaskType": null, "Name": null, "Description": null, "Automation": null, "Sequence": 0, "Activities": [null], "Client": null, "PartnerKey": null, "PartnerProperties": null, "CreatedDate": "0001-01-01T00:00:00.000", "ModifiedDate": null, "ID": 0, "ObjectID": null, "CustomerKey": null, "Owner": null, "CorrelationID": null, "ObjectState": null, "IsPlatformObject": false } ], "IsActive": true, "AutomationSource": null, "Status": 0, "Notifications": null, "ScheduledTime": "0001-01-01T00:00:00.000", "AutomationType": "Scheduled", "UpdateModified": false, "LastRunInstanceID": null, "CreatedBy": 0, "CategoryID": null, "LastRunTime": "0001-01-01T00:00:00.000", "LastSaveDate": "0001-01-01T00:00:00.000", "ModifiedBy": 0, "RecurrenceID": null, "LastSavedBy": 0, "InteractionObjectID": null, "Name": "Example Automation", "Description": "My Automation Example", "Keyword": null, "Client": { "ID": 987654, "ClientID1": 0, "PartnerClientKey": null, "UserID": 998877665, "PartnerUserKey": null, "CreatedBy": 0, "ModifiedBy": 0, "EnterpriseID": 0, "CustomerKey": null, "CustomerID": null }, "PartnerKey": null, "PartnerProperties": [{ "Name": "AutomationType", "Value": "Scheduled" }], "CreatedDate": "0001-01-01T00:00:00.000", "ModifiedDate": null, "ID": 0, "ObjectID": "9c825220-6f2f-40f2-95c2-e44909afed87", "CustomerKey": "ExampleAutomation", "Owner": null, "CorrelationID": null, "ObjectState": null, "IsPlatformObject": false }, "CreateResults": null, "ParentPropertyName": null, "StatusCode": "OK", "StatusMessage": null, "OrdinalID": 0, "ErrorCode": 0, "RequestID": null, "ConversationID": null, "OverallStatusCode": null, "RequestType": "Synchronous", "ResultType": null, "ResultDetailXML": null } ] } ``` # Create, Perform, and Delete Email Send Definitions You can use email send definitions to send emails using SOAP API. Email send definitions are known as email message interactions. This helps you maintain a integration between your external system or development environment and Marketing Cloud Engagement. ## How to Create, Perform, and Delete Email Send Definitions Use the sample code below as a model for creating your own API calls related to email send definitions. When you update a user-initiated send definition via the SOAP API with the Email object, you must set the EmailSubject property on the email send definition. If you don't pass the new subject to the email send definition, it retains the old subject for that definition. ### Sample .NET Code - Create Email Send Definition ```csharp //Create a GUID for ESD string strGUID = System.Guid.NewGuid().ToString(); //Create EmailSendDefinition object to refer to current users ESD [Messages > Email > User-Initiated] EmailSendDefinition esd = new EmailSendDefinition(); esd.Name = "ESD_Name_" + strGUID; esd.CustomerKey = strGUID; esd.Description = "ESD_Desc_" + strGUID; //Create Email object to refer to pre-created email Email em = new Email(); em.ID = 542894;//Found via a Retreive or UI em.IDSpecified = true; esd.Email = em; esd.EmailSubject = "ESD Email Subject"; //Create SendClassification SendClassification sc = new SendClassification(); sc.ObjectID = "51422ad6-6f65-de11-bf42-001e0bbb7678"; //Found via a Retreive esd.SendClassification = sc; //Pass the ID of the Content via this property esd.Additional = "01c59e4f-dac8-4dcb-ab99-a00f565bcc00"; //DataExtension to Send to DataExtension de = new DataExtension(); de.ObjectID = "729860f8-7d66-de11-bf42-001e0bbb7678";//This can be obtained via a Retrieve (Named Send_DE) //Set Send Definition List for the Email Send Definition esd.SendDefinitionList = new SendDefinitionList[1]; esd.SendDefinitionList[0] = new SendDefinitionList(); esd.SendDefinitionList[0].Name = "SDL Name"; esd.SendDefinitionList[0].CustomerKey = "SDL CustomerKey"; esd.SendDefinitionList[0].SendDefinitionListType = SendDefinitionListTypeEnum.SourceList; esd.SendDefinitionList[0].SendDefinitionListTypeSpecified = true; esd.SendDefinitionList[0].CustomObjectID = de.ObjectID; esd.SendDefinitionList[0].DataSourceTypeID = DataSourceTypeEnum.CustomObject;//This specifies a Data Extension esd.SendDefinitionList[0].DataSourceTypeIDSpecified = true; //Create the EmailSendDefinition. It is visible as a user-initiated Email in Marketing Cloud Engagement. string cRequestID = ""; string cStatus = ""; CreateResult[] cResults = client.Create(new CreateOptions(), new APIObject[] { esd }, out cRequestID, out cStatus); ``` ```csharp using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using etAPI; public partial class EmailSendDefinitionCreate : System.Web.UI.Page { //Global Variables private SoapClient client = new SoapClient(); protected void Page_Load(object sender, EventArgs e) { //Authenticate client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"]; if (!IsPostBack) { } } protected void btnSubmit_Click(object sender, EventArgs e) { try { //Create a GUID for ESD to ensure a unique name and customer key string strGUID = System.Guid.NewGuid().ToString(); //Create EmailSendDefinition object [Messages > Email > User-Initiated] EmailSendDefinition esd = new EmailSendDefinition(); esd.Name = "ESD_Name_" + strGUID;//required esd.CustomerKey = strGUID;//required esd.TestEmailAddr = "bjennings@exacttarget.com"; //Create Email object to refer to pre-create Email Email em = new Email(); em.ID = 542894;//required //Available at Content > My Emails > Properties em.IDSpecified = true;//required //Apply Email object to the EmailSendDefiniton object esd.Email = em;//required //Create SendClassification SendClassification sc = new SendClassification(); sc.ObjectID = "51422ad6-6f65-de11-bf42-001e0bbb7678";//required esd.SendClassification = sc;//required //The Additional property is OPTIONAL esd.Additional = "AdditionalInformationVariable";//A Great way to pass values from your API call to the Email, this is available via AMP Script to the Email //DataExtension object to be passed into SendDefinitionList's CustomObjectID property DataExtension de = new DataExtension(); de.ObjectID = "729860f8-7d66-de11-bf42-001e0bbb7678";//required //This can be obtained via a Retrieve filtered by the External Key of the Data Extension //Set Send Definition List for the EmailSendDefinition esd.SendDefinitionList = new SendDefinitionList[1];//You can have many SendDefinitonLists of different SendDefinitionListTypes esd.SendDefinitionList[0] = new SendDefinitionList(); esd.SendDefinitionList[0].SendDefinitionListType = SendDefinitionListTypeEnum.SourceList; esd.SendDefinitionList[0].SendDefinitionListTypeSpecified = true; esd.SendDefinitionList[0].CustomObjectID = de.ObjectID; esd.SendDefinitionList[0].DataSourceTypeID = DataSourceTypeEnum.CustomObject;//This specifies a Data Extension esd.SendDefinitionList[0].DataSourceTypeIDSpecified = true; try { string cRequestID = String.Empty; string cStatus = String.Empty; //Call the Create method on the Subscriber object CreateResult[] cResults = client.Create(new CreateOptions(), new APIObject[] { esd }, out cRequestID, out cStatus); //Display Results lblMessage.Text += "Overall Status: " + cStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + cResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (CreateResult cr in cResults) { lblMessage.Text += "Status Message: " + cr.StatusMessage; lblMessage.Text += "
"; } } catch (Exception exCreate) { //Set Message lblMessage.Text += "

CREATE ERROR:
" + exCreate.Message; } } catch (Exception exc) { //Set Message lblMessage.Text += "

###ERROR
" + exc.Message; } } } ``` ### Sample .NET Code - Perform an Email Send Definition ```csharp using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using etAPI; public partial class EmailSendDefinitionPerform : System.Web.UI.Page { //Global Variables private SoapClient client = new SoapClient(); protected void Page_Load(object sender, EventArgs e) { //Authenticate client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"]; if (!IsPostBack) { } } protected void btnSubmit_Click(object sender, EventArgs e) { try { //Create EmailSendDefinition object [Messages > Email > User-Initiated] EmailSendDefinition esd = new EmailSendDefinition(); esd.CustomerKey = "359866e9-1ec1-4854-ba49-c50a0ca61dd5";//required //Called External Key in the UI try { //Perform the ESD string pStatus = String.Empty; string pMessage = String.Empty; string pRequestID = String.Empty; PerformResult[] pResults = client.Perform(new PerformOptions(), "start", new InteractionBaseObject[] { esd }, out pStatus, out pMessage, out pRequestID); //Display Results lblMessage.Text += "Overall Status: " + pStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + pResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (PerformResult pr in pResults) { lblMessage.Text += "Status Message: " + pr.StatusMessage; lblMessage.Text += "
"; } } catch (Exception exCreate) { //Set Message lblMessage.Text += "

CREATE ERROR:
" + exCreate.Message; } } catch (Exception exc) { //Set Message lblMessage.Text += "

ERROR
" + exc.Message; } } } ``` ### Sample .NET Code - Start an Email Send Definition with API ```csharp /** * Start Email send definiton using perform call. This internally sends email using Data Extensions. * In Response capture Task ID="12345" which is sendID. Use this to * retrieve tracking information. * @throws RemoteException */ public void startEmailSendDefinition() throws RemoteException { EmailSendDefinition definition = new EmailSendDefinition(); definition.setCustomerKey("Market2Lead_Email_Definition_Key"); Soap_PortType stub = init(); PerformRequestMsg performRequestMsg = new PerformRequestMsg(); performRequestMsg.setOptions(new PerformOptions()); performRequestMsg.setAction("start"); performRequestMsg.setDefinitions(new EmailSendDefinition[]{definition}); //This sends email using User-Initiated-Email-definition. PerformResponseMsg responseMsg = stub.perform(performRequestMsg); System.out.println(responseMsg.getOverallStatus()); } ``` ### Sample Ruby Code ```ruby require 'rubygems' gem 'soap4r' require 'soap/wsdlDriver' require 'soap/header/simplehandler' require 'defaultDriver.rb' require 'authStub.rb' require 'WSHelpers.rb' props = { :object => 'DataExtension', :props => ['Name','Description','CustomerKey','ObjectID'] } filter = { :filterType => 'Simple', :filter => ['CustomerKey','equals','APITestSendDe0'] } de = BuildRetrieve.new resp = de.creates(props,filter) objID = String.new resp.results.each do |result| objID = result.objectID end #Async create options #options = CreateOptions.new(nil,nil,nil,nil,nil,nil,nil,nil,'Asynchronous') options = nil customerKey = 'API-Test-1' desc = customerKey + ' created through the API' sendClass = SendClassification.new(nil,nil,nil,nil,nil,nil,nil,189,nil,nil,nil,nil,nil,nil,nil,nil) sendProf = SenderProfile.new(nil,nil,nil,nil,nil,nil,nil,352,nil,nil,nil,nil,'NTO Customer Support','acruz@example.com',nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil) delProf = DeliveryProfile.new(nil,nil,nil,nil,nil,nil,nil,306,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil) email = Email.new(nil,nil,nil,nil,nil,2052608,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil) sendDefList = SendDefinitionList.new(nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,objID,'CustomObject',nil,nil,nil,nil,nil) emailSendDef = EmailSendDefinition.new(nil,nil,nil,nil,nil,nil,nil,customerKey,nil,nil,customerKey,desc,nil,nil,nil,sendClass,sendProf,nil,nil,delProf,nil,nil,nil,nil,nil,nil,nil,nil,0,0,sendDefList,email,nil,nil,nil,'Thank You for Contacting NTO Customer Support',nil,1,1,nil,nil,nil,nil,1,nil,nil,nil,'acruz@example.com') apiObj = emailSendDef resp = $driver.create(CreateRequest.new(options,[*apiObj])) ``` ### Sample Java Code (Axis 1.4) ```java /** * Create User-Intiated-Send-definition using Data Extension */ public void testCreateEmailSendDefinition() throws RemoteException { EmailSendDefinition definition = new EmailSendDefinition(); Soap_PortType stub = init(); definition.setName("Market2Lead_Email_Definition"); //Name //This is Unique identifier for Definition definition.setCustomerKey("Market2Lead_Email_Definition_Key"); //RetrieveEmail Email email = retrieveEmail(stub);//Retrieve email definition.setEmail(email); //Associate what email you are going to send // Retrieve sendClassification and attach to Definition definition.setSendClassification(retrieveSendClassifications(stub)); SendDefinitionList sendDefinitionList = new SendDefinitionList(); //This is objectId of DataExtension, You can retrieve DataExtension and assign value. //1a3e2c14-580e-de11-b30f-001cc494ae9e Captured after creating DataExtension. //Refer this link for Retrieving Data Extension //http://wiki.memberlandingpages.com/API_References/Web_Service_Guide/_Technical_Articles/Retrieving_DataExtension_Object sendDefinitionList.setCustomObjectID("1a3e2c14-580e-de11-b30f-001cc494ae9e"); sendDefinitionList.setDataSourceTypeID(DataSourceTypeEnum.CustomObject); definition.setIsMultipart(true); definition.setSendDefinitionList(new SendDefinitionList[]{sendDefinitionList}); APIObject[] createObjects = {definition}; //Create Request to create EmailDefinition CreateRequest createRequest = new CreateRequest(new CreateOptions(),reateObjects); CreateResponse createResponse = stub.create(createRequest); System.out.println(createResponse.getOverallStatus()); } ``` ### Sample Java Code (Axis 1.4) - Retrieve Send Classifications for Email Send Definition ```java /** * Retrieve SendClassifications Transactional or Commerical type. * @throws RemoteException */ private SendClassification retrieveSendClassifications(Soap_PortType stub) throws RemoteException { String[] props = { "ObjectID", "Name", "Description", "CustomerKey", "SenderProfile.CustomerKey","Client.ID", "Client.PartnerClientKey", "PartnerKey" }; RetrieveRequest request = new RetrieveRequest(); request.setObjectType("SendClassification"); request.setProperties(props); /* ClientID clientID = new ClientID(); clientID.setPartnerClientKey("partnerkey_subaccount_2"); ClientID[] clientIDs = {clientID}; request.setClientIDs(clientIDs); */ //Default Transactional SimpleFilterPart filterPart = new SimpleFilterPart(); String[] filterValues = {"Default Commercial"}; filterPart.setProperty("Name"); filterPart.setSimpleOperator(SimpleOperators.equals); filterPart.setValue(filterValues); request.setFilter(filterPart); RetrieveRequestMsg requestMsg = new RetrieveRequestMsg(); requestMsg.setRetrieveRequest(request); RetrieveResponseMsg responseMsg = stub.retrieve(requestMsg); SendClassification classification = null; if (responseMsg.getResults() != null && responseMsg.getResults().length > 0){ classification = (SendClassification) responseMsg.getResults(0); } return classification; } /** * Reteive email from System * @param stub * @return * @throws RemoteException */ public Email retrieveEmail(Soap_PortType stub) throws RemoteException { Email email = null; RetrieveRequest request = new RetrieveRequest(); request.setObjectType("Email"); String[] props = {"ID", "Name", "Subject", "Status", "PartnerKey"}; request.setProperties(props); SimpleFilterPart part = new SimpleFilterPart(); part.setProperty("Name"); //If Uniquie, or indentify which is unique in your case part.setSimpleOperator(SimpleOperators.equals); String[] values = {"Market2Lead"}; part.setValue(values); request.setFilter(part); RetrieveRequestMsg requestMsg = new RetrieveRequestMsg(); requestMsg.setRetrieveRequest(request); RetrieveResponseMsg responseMsg = stub.retrieve(requestMsg); if (responseMsg.getResults() != null && responseMsg.getResults().length > 0){ email = (Email) responseMsg.getResults(0); } return email; } ``` ### Sample Create SOAP Envelope ```xml Username Password https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx urn:uuid:FAB69169EC56A8F9D51228490514867 Retrieve 7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Name_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Desc_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc 51422ad6-6f65-de11-bf42-001e0bbb7678 SDL CustomerKey SourceList 729860f8-7d66-de11-bf42-001e0bbb7678 CustomObject SDL Name 542894 ESD Email Subject cb99f3b1-67a4-452a-94c0-886e9a930961 ``` ### Sample Perform SOAP Envelope ```xml Username Password https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx urn:uuid:FAB69169EC56A8F9D51228490514867 Retrieve start 7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Name_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Desc_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc 51422ad6-6f65-de11-bf42-001e0bbb7678 SDL CustomerKey SourceList 729860f8-7d66-de11-bf42-001e0bbb7678 CustomObject SDL Name 123 ESD Email Subject cb99f3b1-67a4-452a-94c0-886e9a930961 ``` ### Sample Delete SOAP Envelope ```xml Username Password https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx urn:uuid:FAB69169EC56A8F9D51228490514867 Retrieve 7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Name_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc ESD_Desc_7dc973cc-e0ab-4aec-9ba8-cf0b739e02dc 51422ad6-6f65-de11-bf42-001e0bbb7678 SDL CustomerKey SourceList 729860f8-7d66-de11-bf42-001e0bbb7678 CustomObject SDL Name 542894 ESD Email Subject cb99f3b1-67a4-452a-94c0-886e9a930961 ``` ### SOAP Request to Create an Email Send Definition ```xml username password Market2Lead_Email_Definition_Key Market2Lead_Email_Definition 75741 4819efef-4527-dd11-8126-001a4be9433a 3542 Default Commercial Default Commercial Send Classification 1973 1a3e2c14-580e-de11-b30f-001cc494ae9e CustomObject 794527 Market2Lead Market2Lead-Email New true ``` ### SOAP Response to Request to Create an Email Send Definition ```xml CreateResponse urn:uuid:107dc09d-fdff-408e-af80-373012788c53 urn:uuid:02be8551-f51a-45c2-a298-2cfbd23fe715 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2009-03-11T18:51:24Z 2009-03-11T18:56:24Z OK ImportDefinition created. 0 0 4da7bd99-6d0e-de11-b30f-001cc494ae9e 4da7bd99-6d0e-de11-b30f-001cc494ae9e Import_To_DE_Market2Lead_Key Import_To_DE_Market2Lead Import_To_DE_Market2Lead true UsingAPI_For_Market2Lead_Key InferFromColumnHeadings EmailAddress ChannelUser ChannelUser_EmailAddress Demographic_Address Import2M2L.csv CSV email response@exacttarget.com ExactTarget Enhanced FTP AddAndDoNotUpdate a491e5d7-6388-4e19-afb8-506d4136542a OK ``` ### SOAP Envelope to Create an Email Send Definition Using Profile Attributes and a Data Filter to Create an Audience ```xml 2011-05-20T21:24:16Z 2011-05-20T21:29:16Z XXXXX XXXXX CvdDChr6jtfX++xFZVEoCAm6TXQ= 2011-05-20T21:24:16Z 12345 12345 12345 SourceList FilterDefinition 12345 123456 12345 ``` ### SOAP Request for Starting Email Send Definition ```xml username password start Market2Lead_Email_Definition_Key ``` ### SOAP Response for Starting Email Definition ```xml PerformResponse urn:uuid:9a508056-981a-4290-83ba-50c5471ec5a1 urn:uuid:bab6f37f-ceab-4a5a-a8d3-9c3f3eb708d9 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2009-03-11T21:05:55Z 2009-03-11T21:10:55Z OK EmailSendDefinition performed 66f6728e-7c0e-de11-b30f-001cc494ae9e Market2Lead_Email_Definition_Key Market2Lead_Email_Definition OK OK 7029017 ed9aae62-800e-de11-b30f-001cc494ae9e OK 1b9a83ff-9588-4185-92bc-8a138368f243 ``` ### SOAP Request to Update Email Send Definition ```xml Testing_Pub_List_Key 12345 12345 123456 Test Email with Content Areas 12345 1234567 List ``` ### SOAP Request to Update Email Send Definition with New Subject ```xml Testing_Pub_List_Key 12345 12345 123456 Test Email with Content Areas EmailSendDef subject updated via API 12345 1234567 List ``` ## See Also - _Salesforce Help_: [Email Message Interactions](https://help.salesforce.com/s/articleView?id=mktg.mc_es_email_messages.htm) # Create, Retrieve, Update, and Delete Folders You can use SOAP API to interact with new or existing folders in your account. Use these folders to better organize the portfolio items, programs, or other assets in your account. This process allows you to maintain the tight integration between your development environment and Marketing Cloud Engagement. Use these code examples to create your own API calls. ## Create a Folder The Create call requires the name of the folder, the description of the folder, and the parent folder in which to place the new folder. You can specify whether the folder is active, editable, or can support child folders using Boolean operators outlined in the sample code. **note:** By default, the Create call for a DataFolder object sets the `IsEditable` and `AllowChildren` properties to false. ### .NET Code Example ```csharp private void CreateDataFolder() { SoapClient framework2 = new SoapClient(); framework2.ClientCredentials.UserName.UserName = "xxx"; framework2.ClientCredentials.UserName.Password = "xxx"; String requestID; String status; DataFolder datafolder = new DataFolder(); datafolder.Name = "API Created Folder"; datafolder.Description = "API Created Folder"; datafolder.ParentFolder = new DataFolder(); datafolder.ParentFolder.ID = 12345; // This is the ID of the 'my emails' folder that you can get from doing a retrieve datafolder.ParentFolder.IDSpecified = true; datafolder.ContentType = "email"; CreateResult[] cresults = framework2.Create(new CreateOptions(), new APIObject[] { datafolder }, out requestID, out status); foreach (CreateResult result in cresults) { Console.WriteLine(result.StatusMessage); } Console.WriteLine(requestID + ": " + status); } ``` ### SOAP Envelope Example ```xml 2010-06-02T14:40:19Z 2010-06-02T14:45:19Z XXX XXX XXX 2010-06-02T14:40:19Z email folder1 123 email folder1 email folder1 email true true true email folder2 124 email folder2 email folder2 email true true true email folder3 125 email folder3 email folder3 email true true true ``` The SOAP response contains information about the folder. ```xml CreateResponse urn:uuid:cb885f66-cfca-4022-a179-98eaf7cc85a2 urn:uuid:a78f7bbd-ecda-4faf-ace9-3f9b19b486ad http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2010-06-02T14:40:19Z 2010-06-02T14:45:19Z OK Folder created successfully. 0 705821 72c97bcc-3992-4e69-ac1d-0d21d71209f4 OK Folder created successfully. 1 705822 0dcc63d3-cfbe-4d9e-83d0-13e99cbdbe9c OK Folder created successfully. 2 705823 30c709fa-bbc2-4571-ae00-079c4511a1e0 bd23ba6f-c491-480f-bb47-6b9e5d5b7a22 OK ``` ## Retrieve Folders ### .NET Code Example ```csharp private void RetrieveDataFolder(object sender, EventArgs e) { SoapClient framework = new SoapClient(); framework.ClientCredentials.UserName.UserName = "xxx"; framework.ClientCredentials.UserName.Password = "xxx"; String requestID; String status; APIObject[] results; SimpleFilterPart sfp = new SimpleFilterPart(); sfp.Property = "ContentType"; sfp.SimpleOperator = SimpleOperators.equals; sfp.Value = new string[] { "email" }; RetrieveRequest rr = new RetrieveRequest(); rr.ObjectType = "DataFolder"; rr.Properties = new string[] { "ID", "Name"}; rr.Filter = sfp; status = framework.Retrieve(rr, out requestID, out results); Console.WriteLine(status); foreach (DataFolder df in results) { Console.WriteLine("Folder Name: " + df.Name); Console.WriteLine("Folder ID: " + df.ID); } } ``` ### Sample SOAP Envelope ```xml 2010-06-02T14:40:30Z 2010-06-02T14:45:30Z XXX XXX XXX 2010-06-02T14:40:30Z DataFolder ID Description ParentFolder.Description Client.ID ParentFolder.CustomerKey Name ContentType ParentFolder.Name ObjectID ParentFolder.ObjectID ID IN 705821 705822 705823 false ``` The response contains information about the folder. ```xml RetrieveResponse urn:uuid:829ef1df-4a24-4d3c-825d-de0f18227177 urn:uuid:669d194c-c918-431f-8df9-579888a567ab http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2010-06-02T14:40:29Z 2010-06-02T14:45:29Z OK b985f834-933b-4177-b1e8-c8965a674cf9 41018 705821 72c97bcc-3992-4e69-ac1d-0d21d71209f4 d991eb1a-7b3c-4482-823d-e93fe878592b my emails email folder1 email folder1 email 41018 705822 0dcc63d3-cfbe-4d9e-83d0-13e99cbdbe9c d991eb1a-7b3c-4482-823d-e93fe878592b my emails email folder20100602104019403 email folder20100602104019403 email 41018 705823 30c709fa-bbc2-4571-ae00-079c4511a1e0 d991eb1a-7b3c-4482-823d-e93fe878592b my emails email folder20100602104019419 email folder20100602104019419 email ``` ## Update Folders ### Sample SOAP Request ```xml 2010-06-02T14:40:34Z 2010-06-02T14:45:34Z XXX XXX XXX 2010-06-02T14:40:34Z 705821 changing the foldername email true true ``` The response contains information about the folders. ```xml UpdateResponse urn:uuid:88320e26-abd4-49d2-b7f2-6494ab778856 urn:uuid:92d0f682-2f2b-484a-a5af-a700fb44899a http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2010-06-02T14:40:34Z 2010-06-02T14:45:34Z OK Folder updated successfully. 0 df6468d2-f3bc-4975-a441-c396f2dead24 OK ``` ## Delete Folders ### Example SOAP Envelope ```xml 2010-06-02T14:41:07Z 2010-06-02T14:46:07Z XXX XXX XXX 2010-06-02T14:41:07Z 705821 ``` The response contains information about the folders that were deleted. ```xml DeleteResponse urn:uuid:20a68e8b-8ab2-42ef-9dc4-5d4aead5bddd urn:uuid:d29c9e94-209e-4acb-9ef9-af44886f94ed http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2010-06-02T14:41:06Z 2010-06-02T14:46:06Z OK Folder deleted successfully. 0 a71aa629-64d8-4326-a26e-97a7a928dba5 OK ``` # CreateMscrmRecord() Creates a record in a Microsoft Dynamics CRM entity. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` CreateMscrmRecord(entityName, numFields, attributeName1, attributeValue1, [attributeName2, attributeValue2] ...) ``` The `CreateMscrmRecord()` function has four parameters: - `entityName` (string): Required. The name of the Microsoft Dynamics CRM entity. - `numFields` (number): Required. The number of name and value pairs of fields to create. - `attributeName1` (string): Required. The name of the first attribute to populate in the record. - `attributeValue1` (string): Required. The value of the first attribute to populate in the record. You can pass multiple name-value pairs for attributes by appending them to the end of the function (`attributeName2, attributeValue2 ...`). ## Usage This example creates a contact record that contains the attributes _firstname_, _lastname_, and _emailaddress1_. ``` %%[ Var @contact_guid Set @contact_guid = createmscrmrecord('contact', 3, 'firstname', 'Sun-Hi', 'lastname', 'Kim', 'emailaddress1', 'kim.sun-hi@example.com') ]%%

GUID of new Contact: %%=v(@contact_guid)=%%

``` The function outputs the GUID of the newly created record. # CreateObject ## Overview Create the specified API object ### Syntax CreateObject(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ---------------------------- | | **1** | string | **Required** | Name of API object to create | ## Example ``` ``` # CreateObject() Creates a Marketing Cloud Engagement API Object. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` CreateObject(objectName) ``` The `CreateObject()` function has one parameter: - `objectName` (string): Required. The name of the new API Object. ## Usage This example creates a Subscriber object in the Marketing Cloud Engagement API. ``` SET @subscriber = CreateObject('Subscriber') ``` An object created with `CreateObject()` only persists for one Invoke API call. If you create a Subscriber object and then update it using the `InvokeUpdate()` function, you can’t pass it to a Triggered Send. # CreateOptions Controls the upsert functionality for Send, List, and Subscriber objects using the SaveOptions parameter. | Name | Data Type | Description | | ----------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CallsInConversation` | Integer | The number of calls that must be received before the asynchronous API begins processing the conversation. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `Container` | [ContainerID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/containerid.md) object | Not used. | | `ConversationID` | String | Unique ID of initial async API call. | | `Priority` | String | Deprecated. | | `RequestExpirationTime` | String | The date and time when the asynchronous API request expires. Specify the value in ISO 8601 format with UTC time or with a timezone offset. When you specify both `RequestExpirationTime` and `ScheduledTime` in a request, the `RequestExpirationTime` must occur after the `ScheduledTime`. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | The type of request. Possible values are `synchronous` and `asynchronous`. | | `SaveOptions` | Array of [SaveOption](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/saveoption_appex.md) objects | Specifies how information is overwritten. | | `ScheduledTime` | String | The date and time at which the request must be processed. Specify the value in ISO 8601 format with UTC time or a timezone offset. The specified time can be up to 30 days in the future. | | `SendResponseTo` | Array of [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse_appex.md) objects | Defines conditions for returning responses. | | `SequenceCode` | Integer | Specifies the processing sequence of a multi-step conversation. | # CreateOptions The `CreateOptions` object uses the `SaveOptions` parameter to control the upsert functionality for Send, List, and Subscriber objects. This parameter accepts a null value. ## Properties | Name | Data Type | Description | | ----------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CallsInConversation` | Integer | The number of calls that are part of a conversation. Marketing Cloud Engagement doesn't begin processing the conversation until the specified number of calls have been received. If you specify this property, you must also specify the `ConversationID` property. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | The account ownership and context of an object. | | `Container` | [ContainerID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/containerid.md) object | Not used. | | `ConversationID` | String | A unique ID for grouping multiple calls into a single conversation. All calls with the same ConversationID are processed as a single unit. | | `Priority` | String | This property is deprecated. The API still honors this property. However, we recommend that you use the `QueuePriority` property in new API calls. | | `QueuePriority` | [Priority](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/priority.md) object | Defines the priority for asynchronous sends. Accepted values: `High`, `Medium`, and `Low`. The default value is `Medium`. | | `RequestExpirationTime` | String | The date and time when the asynchronous API request expires. Specify the value in ISO 8601 format with UTC time or with a timezone offset. When you specify both `RequestExpirationTime` and `ScheduledTime` in a request, the `RequestExpirationTime` must occur after the `ScheduledTime`. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | The type of request. Possible values are `synchronous` and `asynchronous`. | | `SaveOptions` | Array of [SaveOption](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/saveoption.md) objects | Specifies how information is overwritten. | | `ScheduledTime` | String | The date and time at which the request must be processed. Specify the value in ISO 8601 format with UTC time or a timezone offset. The specified time can be up to 30 days in the future. | | `SendResponseTo` | Array of [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) objects | Defines how responses are returned and under what conditions. | | `SequenceCode` | Integer | Specifies the processing sequence of a multi-step conversation. If you specify this property, you must also specify a ConversationID. | ## Related Items - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) - [Create a Triggered Send Using the Async API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_triggered_send_using_the_async_api.md) # CreateResult Contains results of each object in a Create request. The API returns objects in the same order it created them in, with `CreateResult` object for each `APIObject` in the request. | Name | Data Type | Description | | -------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. | | `CreateResults` | Array of [CreateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult.md) objects | Not used. | | `ErrorCode` | Int | Identifies the error of an API request. | | `NewID` | Int | System identifier for new object. | | `NewObjectID` | String | System identifier for new object. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `ParentPropertyName` | String | Deprecated. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request.StatusMessage. | | `StatusMessage` | String | Describes the status of an API call. | # CreateResult An object that contains the results of each object in a Create request. The API returns objects in the same order it created them in, with `CreateResult` object for each `APIObject` in the request. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | -------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `CreateResults` | Array of [CreateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult.md) objects | Not used. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `NewID` | Int | System identifier for new object. The API returns this property after creating a new object. | | `NewObjectID` | String | System identifier for new object. The application provides this ID after a new object is created. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `ParentPropertyName` | String | Identifies parent node of property; populated in nested Create results. Deprecated. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | ## Related Items - [Incoming Date Normalization](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/incoming_date_normalization.md) # CreateSalesforceObject() Creates a record in a Sales Cloud or Service Cloud object and returns the ID of the record created. **important:** To use this function, you must use [Marketing Cloud Connect](https://help.salesforce.com/s/articleView?id=mktg.mc_co_marketing_cloud_connect.htm) to integrate with Sales Cloud or Service Cloud. When you call this function, it issues a SOAP request to your Salesforce org. SOAP API requests aren’t subject to the API usage limits that apply to your org. For best performance, we recommend that you minimize the use of this function in sends. Using this function in large sends can result in the sends failing to complete. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` CreateSalesforceObject(objectName, numFields, fieldName1, fieldValue1, [fieldName2, fieldValue2] ... ) ``` The `CreateSalesforceObject()` function has these parameters: - `objectName` (string): Required. The API name of the Salesforce object to insert the record into. - `numFields` (string): Required. The number of fields to insert. This number must match the number of name-value pairs that you specify in the function. - `fieldName1` (string): Required. The name of the field to insert in the object. - `fieldValue1` (string): Required. The value to insert for the field. You can optionally upsert additional keys and values (`[fieldName2, fieldValue2, ...]`) by appending each key-value pair to the list of parameters. You can upsert as many keys and values as necessary in this way. ## Usage To use the function, pass it the name of the object that you want to insert fields into. Next, specify the number of fields to insert. Finally, add the names and values of the records that you want to insert. ### Creating a Record with One Field This example creates a lead in the integrated Salesforce account with a single field, `EmailAddress`. ``` %%[ Var @id Set @id=CreateSalesforceObject("Lead", 1, "EmailAddress", "dangelo.cunningham@example.com") ]%% ``` The function returns the ID of the newly created record. ### Creating a Record with Multiple Fields This example creates a lead with `FirstName`, `LastName`, and `EmailAddress` fields. ``` %%[ Var @id Set @id=CreateSalesforceObject("Lead", 3, "FirstName", "D'Angelo", "LastName", "Cunningham", "EmailAddress", "dangelo.cunningham@example.com") ]%% ``` The function returns the ID of the newly created record. ## See Also - _Marketing Cloud Engagement Help_: [Marketing Cloud Connect](https://help.salesforce.com/s/articleView?id=mktg.mc_co_marketing_cloud_connect.htm) # CreateSmsConversation() Creates an SMS conversation with a contact. **important:** You can only use this AMPscript function in MobileConnect. You can’t use this function with conversation-based templates, including Double Opt-In and Info Capture templates. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` CreateSmsConversation(originationNumber, destinationNumber, nextKeyword, app) ``` The `CreateSmsConversation()` function has four parameters: - `originationNumber` (string): Required. The phone number (such as a short code or long code) used in MobileConnect. - `destinationNumber` (string): Required. The contact’s phone number, including the country code. - `nextKeyword` (string): Required. The string to set as the next conversation keyword. - `app` (string): Required. The application used in the conversation. Specify `MOBILECONNECT` for this parameter. Any other value results in an error. ## Usage Use this function to initiate an SMS conversation with a contact. To use the function, pass it your short or long code, the contact's phone number, the keyword to use for the conversation, and the string `MOBILECONNECT`. ``` %%=CreateSmsConversation("12345",MOBILE_NUMBER,"KEYWORD","MOBILECONNECT")=%% ``` **note:** This function always returns `true` if successful, and an exception if it fails. For this reason, we recommend against using this function for decision making. # Creating a FilterDefinition Object Use the FilterDefinition object to separate out information for a data source, such as a subscriber list or a data extension. Use the sample code below as a model for creating your own API call. All date values for a simple filter part must go into the DateValue collection. The FilterDefinition object contains these properties. - `ObjectID` - : A unique identifier for the property. - `CustomerKey` - : A client-supplied identifier for the filter. This must be unique across all FilterDefinitions owned by the client. - `Name` - : A unique name for the filter. Don’t use the name for lookup purposes. - `Description` - : A description of the filter. - `DataSource` - : Specifies whether the filter is list-based or data-extension-based. If the filter is based on a data extension, supply a DataExtension object. Otherwise, leave this value null and the filter uses profile attributes. - `DataFilter` - : This property specifies the rules associated with the filter. You can include measures here. ## DataFilter Valid Values for Specific Data Types | Data Type | Valid Values | | --------- | ----------------------------- | | Boolean | True or False | | Date | ShortDate (date with no time) | | List | Not supported | | Numeric | Bigint | ## DataFilter Valid SimpleOperator Types | Data Type | Valid Values | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Boolean | Equals | | Date | | | List | | | Numeric | | | Text | | ## Sample .NET Code to Create a FilterDefinition Object ```csharp DataExtension de = new DataExtension(); de.CustomerKey = "DE_UserSubscription"; // External key of data extension FilterDefinition fd = new FilterDefinition(); fd.DataSource = de; fd.Name = "A new Filter Definition"; fd.CustomerKey = "A_new_Filter_Definition"; fd.Description = "A new Filter Definition"; // Set up complex filter parts ComplexFilterPart cfp = new ComplexFilterPart(); // set up simple filter parts SimpleFilterPart sfpA = new SimpleFilterPart(); SimpleFilterPart sfpB = new SimpleFilterPart(); SimpleFilterPart sfpC = new SimpleFilterPart(); SimpleFilterPart sfpD = new SimpleFilterPart(); sfpA.Property = "opt_in"; // boolean sfpA.SimpleOperator = SimpleOperators.equals; sfpA.Value = new string[] { "true" }; sfpB.Property = "pub_id"; // number sfpB.SimpleOperator = SimpleOperators.equals; sfpB.Value = new string[] { "1" }; sfpC.Property = "pub_type"; // text sfpC.SimpleOperator = SimpleOperators.equals; sfpC.Value = new string[] { "A" }; sfpD.Property = "subscribed"; // boolean sfpD.SimpleOperator = SimpleOperators.equals; sfpD.Value = new string[] { "true" }; // Joins the rules together cfp.LeftOperand = sfpA; cfp.LogicalOperator = LogicalOperators.AND; cfp.RightOperand = sfpB; cfp.AdditionalOperands = new FilterPart[2]; cfp.AdditionalOperands[0] = sfpC; cfp.AdditionalOperands[1] = sfpD; // Associate the complex filter with the FilterDefinition fd.DataFilter = cfp; // Execute CreateRequest CreateResult[] results = integrationFramework.Create(null, new APIObject[] { fd }, out requestID, out status); // Output the Values Console.WriteLine(status); Console.WriteLine(requestID); Console.WriteLine(results.Length); foreach (CreateResult result in results) { Console.WriteLine(result.ErrorCode); Console.WriteLine(result.StatusCode); Console.WriteLine(result.StatusMessage); Console.WriteLine(result.NewObjectID); } ``` This code example creates a filter definition with a complex filter. ``` Criteria 1 = 1 - test_cell = "CELL1" AND 2 - division_permalink = "chicago" Criteria 2 = 1 - status = "active" OR 2 - status = "bounced" ``` Using these criteria, the API performs the call on the test_subject_line data extension: ``` // Create Filter DataExtension fde = new DataExtension(); fde.CustomerKey = "test_subject_line"; // External key of data extension FilterDefinition fd = new FilterDefinition(); fd.DataSource = fde; fd.Name = "SUBJECT LINE"; fd.CustomerKey = "SUBJECT_LINE"; fd.Description = "description"; SimpleFilterPart sfpA = new SimpleFilterPart(); sfpA.Property = "test_cell"; // boolean sfpA.SimpleOperator = SimpleOperators.equals; sfpA.Value = new string[] {"CELL1"}; SimpleFilterPart sfpC = new SimpleFilterPart(); sfpC.Property = "division_permalink"; // boolean sfpC.SimpleOperator = SimpleOperators.equals; sfpC.Value = new string[] { "chicago" }; ComplexFilterPart cfp1 = new ComplexFilterPart(); cfp1.LeftOperand = sfpA; cfp1.LogicalOperator = LogicalOperators.AND; cfp1.RightOperand = sfpC; // SFP for status = active or bounced SimpleFilterPart sfpB1 = new SimpleFilterPart(); sfpB1.Property = "status"; // boolean sfpB1.SimpleOperator = SimpleOperators.equals; sfpB1.Value = new string[] { "active" }; SimpleFilterPart sfpB2 = new SimpleFilterPart(); sfpB2.Property = "status"; // boolean sfpB2.SimpleOperator = SimpleOperators.equals; sfpB2.Value = new string[] { "bounced" }; ComplexFilterPart cfp2 = new ComplexFilterPart(); cfp2.LeftOperand = sfpB1; cfp2.LogicalOperator = LogicalOperators.OR; cfp2.RightOperand = sfpB2; ComplexFilterPart cfp3 = new ComplexFilterPart(); cfp3.LeftOperand = cfp1; cfp3.LogicalOperator = LogicalOperators.AND; cfp3.RightOperand = cfp2; fd.DataFilter = cfp3; // Execute CreateRequest CreateResult[] results2 = client.Create(null, new APIObject[] { fd }, out requestID2, out status2); if (status2.Equals("OK")) { lblMessage.Text = "Call is : " + status2; } else { lblMessage.Text = "Error Creating Data Extension: " + results2; } ``` ## Sample .NET Code toUpdate a FilterDefinition Object The update call supports both CustomerKey and ObjectID as identifiers to specify which FilterDefinition to update. The API requires both the DataExtension and DataFilter to update a FilterDefinition object. ```csharp DataExtension de = new DataExtension(); de.CustomerKey = "DE_UserSubscription"; // External key of data extension FilterDefinition fd = new FilterDefinition(); fd.DataSource = de; fd.CustomerKey = "A_new_Filter_Definition"; // Update using customer key // Simple ComplexFilterPart cfp = new ComplexFilterPart(); SimpleFilterPart sfpA = new SimpleFilterPart(); SimpleFilterPart sfpB = new SimpleFilterPart(); SimpleFilterPart sfpC = new SimpleFilterPart(); SimpleFilterPart sfpD = new SimpleFilterPart(); sfpA.Property = "opt_in"; sfpA.SimpleOperator = SimpleOperators.equals; sfpA.Value = new string[] { "true" }; sfpB.Property = "pub_id"; sfpB.SimpleOperator = SimpleOperators.equals; sfpB.Value = new string[] { "1" }; sfpC.Property = "pub_type"; sfpC.SimpleOperator = SimpleOperators.equals; sfpC.Value = new string[] { "A" }; sfpD.Property = "subscribed"; sfpD.SimpleOperator = SimpleOperators.equals; sfpD.Value = new string[] { "true" }; cfp.LeftOperand = sfpA; cfp.LogicalOperator = LogicalOperators.AND; cfp.RightOperand = sfpB; cfp.AdditionalOperands = new FilterPart[2]; cfp.AdditionalOperands[0] = sfpC; cfp.AdditionalOperands[1] = sfpD; fd.DataFilter = cfp; // Execute UpdateRequest UpdateResult[] results = integrationFramework.Update(null, new APIObject[] { fd }, out requestID, out status); // Output the Values Console.WriteLine(status); Console.WriteLine(requestID); Console.WriteLine(results.Length); foreach (UpdateResult result in results) { Console.WriteLine(result.ErrorCode); } ``` ## Sample SOAP Envelope - Create a Filter Definition Using Profile Attributes ```xml XXXXX XXXXX eSTcdVv9GBJGgiTLlEPDuRnpTXk= 2011-05-20T14:57:13Z PAFilterDef20110520105713606 Gender equals Female ``` ## Sample SOAP Envelope - Create a Filter Definition For a Data Extension ```xml XXXXX XXXXX XC5M431QfCJQ+bjcVmj4idjZC/A= 2011-05-20T14:55:36Z FDDE20110520105536886 756e860f-f182-e011-afb3-001cc494c760 Gender equals Female ``` # Creating a Triggered Email Campaign Workflow This page contains conceptual and procedural information about creating a triggered send email campaign using SOAP API. ## Why Create a Triggered Send Email Campaign A triggered send email campaign takes a previously created email message and sends that message out in response to an outside request, such as a subscriber opting in to receive the message. ## How To Create a Triggered Send Email Campaign Use the flow chart and sample code as an example of how to create and order the processes necessary for the triggered email send campaign. ### Triggered Send Email Campaign Workflow Process ![triggeredsendemailcampaign.jpg](https://developer.salesforce.com/docs/media/images/triggeredsendemailcampaign.jpg) ### Sample Code This section contains sample code you can use to conduct your triggered sends. #### Sample .NET Code ``` using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using etAPI; public partial class ETTriggeredSend : System.Web.UI.Page { //Global Variables private SoapClient client = new SoapClient(); protected void Page_Load(object sender, EventArgs e) { //Authenticate client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"]; if (!IsPostBack) { } } protected void btnSubmit_Click(object sender, EventArgs e) { try { //Create a GUID for ESD to ensure a unique name and customer key string strGUID = System.Guid.NewGuid().ToString(); //Create TriggeredSendDefinition object [Messages > Email > Triggered] TriggeredSendDefinition tsd = new TriggeredSendDefinition(); tsd.Name = "TSD_Name_" + strGUID;//required tsd.CustomerKey = strGUID;//recommended or the application assigns a number tsd.Description = "TSD_Description_" + strGUID;//recommended or the Description defaults to the Name //Set to delivery both Text and HTML versions. tsd.IsMultipart = true;//recommended as a best practice tsd.IsMultipartSpecified = true;//required //Set to track the links found in the email tsd.IsWrapped = true; //Enables tracking tsd.IsWrappedSpecified = true;//required //Create Email object to refer to pre-create Email Email em = new Email(); em.ID = 620046; //required -- can be found at Content > My Emails > Properties em.IDSpecified = true;//required //Apply Email object to the TriggeredSendDefinition object tsd.Email = em;//required //Create SendClassification tsd.SendClassification = new SendClassification(); tsd.SendClassification.CustomerKey = "4201";//required -- can be found at Setup > Send Management > Send Classifications > Edit Item > External Key //tsd.TriggeredSendType = TriggeredSendTypeEnum.Continuous; //tsd.TriggeredSendTypeSpecified = true; //tsd.TriggeredSendStatus = TriggeredSendStatusEnum.New; //tsd.TriggeredSendStatusSpecified = true; //tsd.BatchInterval = 1; //tsd.BatchIntervalSpecified = true; //tsd.AutoAddSubscribers = true; //tsd.AutoAddSubscribersSpecified = true; //tsd.AutoUpdateSubscribers = true; //tsd.AutoUpdateSubscribersSpecified = true; //tsd.List = list; string cRequestID = String.Empty; string cStatus = String.Empty; try { //Call the Create method on the TriggeredSendDefinition object CreateResult[] cResults = client.Create(new CreateOptions(), new APIObject[] { tsd }, out cRequestID, out cStatus); //Display Results lblMessage.Text += "Overall Create Status: " + cStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + cResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (CreateResult cr in cResults) { lblMessage.Text += "Status Message: " + cr.StatusMessage; lblMessage.Text += "
"; } } catch (Exception exCreate) { //Set Message lblMessage.Text += "

CREATE TSD ERROR:
" + exCreate.Message; } //Preceed if the above Create call was successful if (cStatus == "OK") { // *** MAKE TRIGGERED SEND DEFINITION ACTIVE tsd = new TriggeredSendDefinition(); tsd.CustomerKey = strGUID;//required tsd.TriggeredSendStatus = TriggeredSendStatusEnum.Active;//necessary to set the TriggeredSendDefinition to "Running" tsd.TriggeredSendStatusSpecified = true;//required string uRequestID = String.Empty; string uStatus = String.Empty; try { //Call the Create method on the EmailSendDefinition object UpdateResult[] uResults = client.Update(new UpdateOptions(), new APIObject[] { tsd }, out uRequestID, out uStatus); //Display Results lblMessage.Text += "Overall Update Status: " + uStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + uResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (UpdateResult ur in uResults) { lblMessage.Text += "Status Message: " + ur.StatusMessage; lblMessage.Text += "
"; } } catch (Exception exCreate) { //Set Message lblMessage.Text += "

UPDATE TSD ERROR:
" + exCreate.Message; } //Preceed if the above Update call was successful if (uStatus == "OK") { // *** SEND THE TRIGGER EMAIL //Create a new Subscriber to send the Trigger to Subscriber newSub = new Subscriber(); newSub.EmailAddress = "acruz@exaple.com"; newSub.SubscriberKey = "acruz@exaple.com"; //Create Subscriber Attributes newSub.Attributes = new etAPI.Attribute[2]; //Can be found at Subscribers > Profile Management //1 newSub.Attributes[0] = new etAPI.Attribute(); newSub.Attributes[0].Name = "FromName";//Account Specific newSub.Attributes[0].Value = "From John Doe";//Subscriber Specific //2 newSub.Attributes[1] = new etAPI.Attribute(); newSub.Attributes[1].Name = "HTML__Content";//Account Specific newSub.Attributes[1].Value = "This is a test link"; //httpgetwrap| must be before the http for tracking to work //Create a new Subscriber to send the Trigger to Subscriber newSub2 = new Subscriber(); newSub2.EmailAddress = "jdoe@example.com"; newSub2.SubscriberKey = "jdoe@example.com"; //Create Subscriber Attributes newSub2.Attributes = new etAPI.Attribute[2];//Can be found at Subscribers > Profile Management //1 newSub2.Attributes[0] = new etAPI.Attribute(); newSub2.Attributes[0].Name = "FromName";//Account Specific newSub2.Attributes[0].Value = "From Angela Cruz";//Subscriber Specific //2 newSub2.Attributes[1] = new etAPI.Attribute(); newSub2.Attributes[1].Name = "HTML__Content";//Account Specific newSub2.Attributes[1].Value = "This is a test link"; //httpgetwrap| must be before the http for tracking to work //Create a TriggeredSend object to referrence the earlier created TriggeredSendDefinition TriggeredSend ts = new TriggeredSend(); ts.TriggeredSendDefinition = new TriggeredSendDefinition(); ts.TriggeredSendDefinition.CustomerKey = strGUID;//This is the External Key from the UI ts.Subscribers = new Subscriber[] { newSub, newSub2 };//Add the Subscriber objects to the TriggeredSend object string tsRequestID = ""; string tsStatus = ""; try { //Call the Create method on the TriggeredSend object CreateResult[] tsResults = client.Create(new CreateOptions(), new APIObject[] { ts }, out tsRequestID, out tsStatus); //Display Results lblMessage.Text += "Overall Update Status: " + tsStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + tsResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (CreateResult tscr in tsResults) { lblMessage.Text += "Status Message: " + tscr.StatusMessage; lblMessage.Text += "
"; } } catch (Exception exCreate) { //Set Message lblMessage.Text += "

CREATE TS ERROR:
" + exCreate.Message; } } } catch (Exception exc) { //Set Message lblMessage.Text += "

###ERROR
" + exc.Message; } } } ``` #### SOAP Envelopes to Interact with Emails and Triggered Send Definitions This section includes sample code you can use to create a triggered email send using the SOAP API. **SOAP Request to Retrieve Email** ``` Email ID CreatedDate Name Folder CategoryID HTMLBody TextBody Subject IsActive IsHTMLPaste Status EmailType CharacterSet HasDynamicSubjectLine ContentCheckStatus Client.PartnerClientKey Name equals Client1_Email_1 ``` **SOAP Response to Retrieve Email** ``` OK af86580f-0c4e-4a0c-91ee-c21928bc198b 123 2009-08-07T10:57:24.943 123 Client1_Email_1 Client1 123 Welcome to Client1 emails. Client1_Email_1_Sub true true New Normal us-ascii false Not Checked ``` **SOAP Request to Retrieve SendClassification** ``` SendClassification ObjectID -- Use ObjectID to Create TE Definition Client.ID Name CustomerKey Name equals -- Use filter if you know Name Default Commercial ``` **SOAP Response to Retrieve SendClassification** ``` OK c462d15d-70eb-47f0-8805-7ad8fb400f26 75741 4819efef-4527-dd11-8126-001a4be9433a 123 Default Commercial 123 4919efef-4527-dd11-8126-001a4be9433a 123 Default Transactional 123 86acfc8f-ad7b-de11-9ca2-00215adeb818 FromAndReply_Key FromAndReply 123 fe9a4e34-63d4-de11-8e63-00215adeb896 FromName _From_List_Key FromName _From_List ``` **SOAP Request to Create Triggered Send Defintion** ``` TriggeredSendDefinition_75741_1 TriggeredSendDefinition_75741_1 - Name of TriggeredSend Definition 4819efef-4527-dd11-8126-001a4be9433a 123 123 true false ``` **SOAP Response to Create Triggered Send Defintion** ``` OK TriggeredSendDefinition created 0 0 a7f8c057-cbdd-de11-8e63-00215adeb896 a7f8c057-cbdd-de11-8e63-00215adeb896 TriggeredSendDefinition_75741_1 TriggeredSendDefinition_75741_1 4819efef-4527-dd11-8126-001a4be9433a 1973 123 false Tracking Check with iso-8859-1 true 3950934f-17a5-4c4a-b45a-6cb72a7410e8 OK ``` **SOAP Request to Start Triggered Send Definition (Update Call)** ``` TriggeredSendDefinition_75741_2 Active - Set status to Active ``` **SOAP Response to Start Triggered Send Definition** ``` OK TriggeredSendDefinition updated 0 TriggeredSendDefinition_75741_2 Active 3ca8d0e2-8909-452c-ab14-75c3c54edb03 OK //If status is not OK, something is wrong ``` **SOAP Request to Send Triggered Email to Subscriber** ``` TriggeredSendDefinition_75741_2 Sample_PHP - Replaceable Attributes in Email
Welcome, You are sending Email using TriggeredSend definition

Testing API]]>
first_name - Replaceable Attributes in Email John johndoe_email_key johndoe@example.com
``` **SOAP Response to Send Triggered Email to Subscriber** ``` OK Created TriggeredSend 0 0 2ea4bfb7-37dd-48d2-848d-cdb11e898097 OK ``` # Custom Activity Configuration In Journey Builder, both custom events and custom activities follow the same structure. For more information about creating custom events, see [Considerations for Building Custom Events](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating-events.md). The config.json file includes the properties shown in this table. To view these properties in context, see the [sample config.json file](#sample-configjson-file). | Property | Data Type | Description | | ------------------------ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `workflowApiVersion` | String | Required. The version of the workflow API to use for the custom activity. Accepted values are `1.1`, `1.0`, and `0.5`. We recommend that you use the latest version unless it’s necessary to use an older version. | | `metaData` | [metaData](#metadata-object-properties) object | Required. An object that contains values that identify and categorize each custom activity. | | `type` | String | Required. The type of activity. There are two standard activity types. | | `lang` | [lang](#lang-object-properties) object | Required. An object that contains translation and localization information for the custom activity. For more information, see [Internationalize Branch Labels](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/internationalize-branch-labels.md). | | `arguments` | [arguments](#arguments-object-properties) object | Required. An object that contains arguments that are passed to the custom activity. | | `configurationArguments` | [configurationArguments](#configurationarguments-object-properties) object | Required. An object that contains information that relates to this instance of the activity. | | `userInterfaces` | [userInterfaces](#userinterfaces-object-properties) object | Required. An object that contains endpoints and UI configurations for the activity’s user interfaces. | | `wizardSteps` | [wizardSteps](#wizardsteps-array-properties) array | An array of objects that define the steps that the user navigates through when configuring the custom activity. | | `schema` | [schema](#schema-object-properties) object | An object that mirrors the activity configuration from the top level of the config.json file. | | `copySettings` | [copySettings](#copysettings-object-properties) object | An object that defines rules for copying the configuration. | ## metaData Object Properties | Property | Data Type | Description | | ------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `icon` | String | The path to an icon that is shown when a user adds the activity to the journey canvas. For more information, see [Custom Activity Icon Details](#custom-activity-icon-details). | | `category` | String | Required. The category type of the custom activity. Accepted values are `message`, `customer`, `flow`, and `custom`. If the request includes an invalid or missing category value, the activity is added to the `custom` category. This value overrides the category selected in the installed package. | | `expressionBuilderPrefix` | String | A string prefix in the expression builder for decision split. The default value is `Custom Activity`. | | `isConfigured` | Boolean | If the value of this property is `true`, the activity is marked as configured when a user adds it to the canvas. | | `configurationDisabled` | Boolean | If this value is `true` and `metaData.isConfigured` is also `true`, the activity configuration button is disabled. | | `configOnDrop` | Boolean | If this value is `true`, the activity configuration opens when a user adds the activity to the canvas. | ### Custom Activity Icon Details The value of the `icon` property must be a path to an icon. The path can be an absolute URL or a path that’s relative to the URL of the custom activity. If you don’t specify a value for the `icon` property, Journey Builder checks to see if a file called `icon.png` exists in the path that you specified for the custom activity. If that file doesn’t exist, it looks for a file called `icon.svg` in the same path. If that file doesn’t exist, Journey Builder uses a default icon. Journey Builder always uses the `icon` value in the version of the config.json file hosted on your web server. If you add a custom activity to your journey, and then modify the configuration of that instance of the custom activity, Journey Builder doesn’t update the icon. If you change the value of the `icon` property in the config.json hosted on your web server, the icon is updated for all instances of that custom activity in the journey. If you change the value of `icon` in the config.json served by your webserver, the icon is updated for all instances of that custom activity in the journey. The icon file must meet these specifications. - Supported file formats: .png, .svg, .jpg, .gif - Maximum width and height: 40 pixels × 40 pixels - File size limit: None ## lang Object Properties The `lang` object contains at least one object. The name of each object must equal the name of a BCP 47 locale code, such as `en-US` for US English or `pt-BR` for Brazilian Portuguese. In each object, you specify the name and description of the custom activity for the specified locale. | Property | Data Type | Description | | -------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `{localeCode}` | Object | An object that contains the name and description of the custom activity in the specified locale. The name of the object must be a BCP 47 locale code such as `en-US`. | | `{localeCode}.name` | String | The name of the custom activity in the language of the specified locale. | | `{localeCode}.description` | String | A description of the custom activity in the language of the specified locale. | | `{localeCode}.{key}` | String | A custom label referenced in the activity. If a label in the activity matches this key, a user whose settings use this language sees this value instead of the default value. | ## arguments Object Properties | Property | Data Type | Description | | ---------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `execute` | Object | An object that contains information that is sent to and returned by the activity each time a contact enters it. | | `execute.inArguments` | Array of objects | An object array that defines the data that Journey Builder passes to your `execute` endpoint when a contact enters the custom journey activity. | | `execute.outArguments` | Array of objects | An object array that defines the fields that your application returns in response to requests from Journey Builder. | | `execute.timeout` | Integer | The amount of time in milliseconds before requests to the custom activity endpoint time out. The minimum value is `1000` and the maximum value is `100000`. The default value is `20000`. | | `execute.retryCount` | Integer | The number of times to retry the call to the custom activity endpoint if it times out. The minimum value is `0` and the maximum value `5`. The default value is `0`. | | `execute.retryDelay` | Integer | The amount of time in milliseconds to wait for a response from the custom activity endpoint before retrying it. The minimum value is `0` and the maximum value is `10000`. The default value is `1000`. | | `execute.concurrentRequests` | Integer | The number of times the activity can run in parallel. The minimum value is `1` and the maximum value is `10`. The default value is `6`. Before you use concurrent requests, test the ability of the target application to handle multiple loads. If you observe gateway errors or timeouts, consider increasing the retry and timeout values. | | `execute.url` | String | The application endpoint for the activity. | ## configurationArguments Object Properties | Property | Data Type | Description | | ------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | `applicationExtensionKey` | String | Required. An object that contains information that relates to this instance of the activity. | | `publish` | [configurationArgumentActivity](#configurationargumentactivity-object-properties) Object | An object that defines the actions taken when a user publishes a journey that contains the custom activity. | | `save` | [configurationArgumentActivity](#configurationargumentactivity-object-properties) Object | An object that defines the actions taken when a user saves a journey that contains the custom activity. | | `unpublish` | [configurationArgumentActivity](#configurationargumentactivity-object-properties) Object | An object that defines the actions taken when a user unpublishes a journey that contains the custom activity. | | `validate` | [configurationArgumentActivity](#configurationargumentactivity-object-properties) Object | An object that defines the actions taken when a user validates a journey that contains the custom activity. | | `stop` | [configurationArgumentActivity](#configurationargumentactivity-object-properties) Object | An object that defines the actions taken when a user stops a journey that contains the custom activity. | ## configurationArgumentActivity Object Properties Each of the actions in the `configurationArguments` object (publish, unpublish, save, validate, and stop) can contain the properties in this table. | Property | Data Type | Description | | ------------------------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `url` | String | The HTTPS endpoint that receives an HTTP POST request when a user performs the action. | | `body` | String | An object that contains additional keys and values to add to the request body. Specify this property as an escaped JSON string. | | `headers` | Object | An object that contains additional keys and values to add to the request headers. | | `useJwt` | Boolean | If `true`, requests to the endpoint are encoded as a JWT. For more information, see [Encode Custom Activities Using a JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encode-custom-activities-using-jwt.md). | | `customerKey` | String | The identifier of an external key to use to encode a JWT. | | `securityOptions` | Object | An object that contains information about OAuth 2.0 bearer tokens. For more information, see [Secure a Custom Activity Using an OAuth 2.0 Bearer Token](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/secure-custom-activity-using-oauth.md). | | `securityOptions.securityType` | String | The type of key to use to obtain the bearer token. Specify `securityContext` for this property. | | `securityOptions.securityContextKey` | String | The name of an external key that is used in the key exchange. | ## userInterfaces Object Properties The `userInterfaces` object contains information about the appearance of the configuration page for the custom activity in the journeys user interface. | Property | Data Type | Description | | ------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `configModal` | Object | Required. An object that is used to configure the journey activity. | | `configModal.url` | String | The URL of the UI that users see when they configure this activity. The default value is `index.html`. | | `configModal.height` | Integer | The height in pixels of the iframe that contains the configuration interface for the custom activity. | | `configModal.width` | Integer | The width in pixels of the iframe that contains the configuration interface for the custom activity. | | `configModal.fullscreen` | Boolean | Specifies whether to show the configuration interface in full screen mode. If `true`, the configuration UI fills the entire screen, even when values are defined for `height` and `width`. The default value is `false`. | ## wizardSteps Array Properties The `wizardSteps` array contains objects that define the steps that the user navigates through as they configure the custom activity. Each object contains the values in this table. | Property | Data Type | Description | | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `label` | String | The name to display for this step in the user interface. | | `key` | String | A unique key to identify the step. | | `active` | Boolean | Determines whether to show the step in the configuration flow. If this value is `true`, the step is shown in the configuration flow. The default value is `true`. | This image shows a configuration page for a custom journey activity in fullscreen mode. The three numbered tabs ("Workflow", "Execute", and "Editor") correspond to the `label` values in the `wizardSteps` object. ![A screenshot of a custom journey activity configuration page. The name of the activity, My Custom Activity, appears at the top of the configuration page. Under the activity name are three tabs, labeled Workflow, Execute, and Editor.](https://developer.salesforce.com/docs/media/images/journey-custom-activity-wizardsteps.png) ## schema Object Properties The schema object specifies schema information about in and out arguments. The schema object has the structure shown in this example. ```js "schema": { "arguments": { "execute": { "inArguments": [ "{inArgumentName}": { "dataType": "{dataType}", "isNullable": {true|false}, "direction": "in", "access": "{visible|hidden}" } ], "outArguments": [ "{outArgumentName}": { "dataType": "{dataType}", "isNullable": {true|false}, "direction": "out", "access": "{visible|hidden}" } ] } } } ``` The `inArguments` and `outArguments` arrays contain objects that specify the characteristics of each argument. The context of the call determines the direction of the arguments in the schema. The values that you provide must match the execution context. The `outArguments` can’t contain null values. If the value of the access property parameter is set to `hidden` or isn’t specified, the argument isn’t shown in subsequent expression builders. ## copySettings Object Properties These are the properties of the `copySettings` object. | Property | Data Type | Description | | ----------------- | --------- | ------------------------------------------------------------------------------------------------------------ | | `allowCopy` | Boolean | Determines whether the configuration can be copied. If the value is `true`, the configuration can be copied. | | `ignoreArguments` | Array | Each item in the array corresponds to a property that isn't copied with the rest of the configuration. | ## Sample config.json File ```json { "workflowApiVersion": "1.1", "name": "Custom Activity Name", "description": "Custom Activity Description", "metaData": { "icon": "images/icon.svg", "category": "Custom" }, "type": "REST", "lang": { "en-US": { "name": "Localized Custom Activity Name", "description": "Localized Custom Activity Description", "label1": "Localized Step 1", "label2": "Localized Step 2", "label3": "Localized Step 3" } }, "arguments": { "execute": { "inArguments": [ { "staticValue": 0, "databoundEmailAddress": "{{Event.EventKey.EmailAddress}}" } ], "outArguments": [ { "returnValue": "default" } ], "timeout": 10000, "retryCount": 1, "retryDelay": 1000, "concurrentRequests": 6, "url": "https://example.com/execute", "securityOptions": { "securityType": "securityContext", "securityContextKey": "EXTERNAL_KEY" } } }, "configurationArguments": { "save": { "url": "https://example.com/save", "securityOptions": { "securityType": "securityContext", "securityContextKey": "EXTERNAL_KEY" } }, "publish": { "url": "https://example.com/publish", "securityOptions": { "securityType": "securityContext", "securityContextKey": "EXTERNAL_KEY" } }, "validate": { "url": "https://example.com/validate", "securityOptions": { "securityType": "securityContext", "securityContextKey": "EXTERNAL_KEY" } }, "stop": { "url": "https://example.com/stop", "securityOptions": { "securityType": "securityContext", "securityContextKey": "EXTERNAL_KEY" } } }, "wizardSteps": [ { "label": "label1", "key": "step1" }, { "label": "label2", "key": "step2" }, { "label": "label3", "key": "step3", "active": false } ], "userInterfaces": { "configModal": { "fullscreen": true, "url": "configModal.html" }, "runningModal": { "url": "runningModal.html" }, "runningHover": { "url": "runningHover.html" } }, "schema": { "arguments": { "execute": { "inArguments": [ { "staticValue": { "dataType": "Number", "isNullable": false, "direction": "in" }, "databoundEmailAddress": { "dataType": "Email", "isNullable": false, "direction": "in" } } ], "outArguments": [ { "returnValue": { "dataType": "Text", "isNullable": false, "direction": "out" } } ] } } }, "copySettings": { "allowCopy": true, "ignoreArguments": ["eventDefinitionKey"] } } ``` # Custom Activity UI For simplicity, the documentation mostly refers to custom activities. In Journey Builder, custom events and custom activities use the same framework, so building either object follows the same structure. For event-specific instructions, see Considerations for Building Custom Activities. A custom activity is web applications that you build according to specifications that Journey Builder recognizes. Using these recommendations, you can implement your app's file structure according to your preferences and business needs. ## Recommended File Structure - {endpoint-URL}/ This file is the endpoint URL of the activity as defined in the Journey Builder component of your installed package. - index.html (required) - This file does not have to be a sublevel of the endpoint. This file is the default assumption when not including an overridden path. - [config.json](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/custom-activity-config.md) (required) - customActivity.js (required) - This file does not have to be a sublevel of the endpoint. This file is the default assumption when not including an overridden path. You can use any name for this value, and you can embed this value in script within the index.html file. - {endpoint-URL}/js/ (required) Provide the jQuery separately when not using the FuelUX 2 Loader. - require.js - May load from CDN - jquery.min.js - May load from CDN - postmonger.js (required) - Available on GitHub - {endpoint-URL}/images/ Refer to the icon specifications for your icon image. - icon.png # Custom Block Widget Best Practices When developing custom blocks, adhere to these best practices. ## Use the Lightning Design System [](https://www.lightningdesignsystem.com/) ## Remember User Choices When the user makes choices in the block widget and saves the block, they expect those choices to be remembered when they open that same block again. To save configuration separately from the block content itself, you can use `getData`. ## Update the Canvas in Real Time Most of the editor’s system blocks update the canvas in real time, so your custom block widget should create the same experience for your users. If the user types or selects an option in the block, update those activities in real time rather than waiting for the user to exit or manually save. Use `setContent` or `setSuperContent` on changes. # Custom Block Widget Example This example is a custom Quilljs block in a single HTML page that is served by a node app and hosted on Heroku. https://quill-block.herokuapp.com/ ```js var BlockSDK = require("blocksdk"); if (window.self === window.top) { document.body.innerText = "This application is for use in the Marketing Cloud Engagement Content Builder editor only."; } else { var sdk = new BlockSDK(); sdk.getContent(function (content) { var quill = new Quill("#editor-container", { theme: "snow", }); quill.root.innerHTML = content; function saveText() { var html = quill.root.innerHTML; sdk.setContent(html); sdk.setSuperContent("This is super content: " + html); sdk.getData(function (data) { var numberOfEdits = data.numberOfEdits || 0; sdk.setData({ numberOfEdits: numberOfEdits + 1, }); }); } quill.on("text-change", saveText); }); } ``` # Customer Key A customer key is a user-defined identifier for an asset. Each customer key is a unique value across your enterprise. The customer key isn’t a required field, and if you don’t provide a value, Marketing Cloud Engagement generates a unique GUID value for the customer key. Add a customer key to the asset as a string with a 36-character limit, using the `customerKey` attribute. ## Sample Asset with Customer Key ```json { "name": "NTO Welcome Series Email", "assetType": { "id": 207, "name": "templatebasedemail" }, "customerKey": "090c69e7-59ac-4286-8733-f8f76example" } ``` ## Related Items - [Asset Model](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset-model.md) - [Asset Model Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) # DailyRecurrence Defines a daily recurrence pattern for a process. | Name | Data Type | Description | | ---------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- | | `DailyRecurrencePatternType` | [DailyRecurrencePatternTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dailyrecurrencepatterntypeenum.md) | Specifies the number of days on which to execute a daily recurrence. | # DailyRecurrencePatternTypeEnum The pattern types for a daily recurrence. ## Values | Name | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `EveryWeekDay` | Specifies a recurrence on every weekday. | | `Interval` | Specifies a recurrence pattern that occurs after a given number of days. For example, an interval of 2 indicates that the process recurs every 2 days. | ## Related Items - [DailyRecurrence](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dailyrecurrence.md) # Data Data lets you store additional information for a channel in the asset, to be used by the channel's parser, or some UI that manipulates the asset for the channel. If using data, store properly namespaced custom fields under the channel name. If data is returned, be sure to pass it through the API. Add data to the asset as an object, under the `data` attribute. Store channel-specific attributes under their channel name inside of `data`. For example, the `email` channel needs additional information. ## Sample Asset with Data ```json { "name": "NTO Welcome Series Email", "channels": { "email": true, "web": false }, "assetType": { "name": "templatebasedemail", "id": 207 }, "data": { "email": { "attributes": [ { "DisplayName": "sample_attribute", "Name": "__AdditionalEmailAttribute1", "Value": "your_tracking", "Order": 1, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" }, { "DisplayName": "utm_medium", "Name": "__AdditionalEmailAttribute2", "Value": "salesforce", "Order": 2, "Channel": "email", "AttributeType": "AdditionalEmailAttribute" } ] } } } ``` ## Related Items - [Asset Model](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset-model.md) - [Asset Model Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) Data Extension Data # Data Extension Data Use the data extension data endpoints to retrieve paginated data from a data extension in your Marketing Cloud Engagement account. Filtering, sorting, and paging are supported only with sendable data extensions. Requests to retrieve data from non-sendable data extensions can return a maximum of 200 rows. > **NOTE** > > There are several APIs related to data extensions: > > * Use this API to query data in a data extension. > * Use the [Data Extensions](/docs/marketing/marketing-cloud/references/mc-custom_objects) API to create, modify, and manage data extension objects. > * Use the [Data Extension Rows (Asynchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async) and [Data Extension Rows (Synchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync) APIs to add or update rows of data in a data extension. > * Use the [Data Extension Imports](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-import_job_api) API to manage data import jobs. This table lists the use cases that this API supports. | Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Get data extension data](/docs/marketing/marketing-cloud/references/mc-custom_object_data?meta=getData) | GET | /data/v1/customobjectdata/{id}/rowset | | [Get data extension data by key](/docs/marketing/marketing-cloud/references/mc-custom_object_data?meta=getDataByKey) | GET | /data/v1/customobjectdata/key/{key}/rowset | | [Get data by request token](/docs/marketing/marketing-cloud/references/mc-custom_object_data?meta=getDataByRequestToken) | GET | /data/v1/customobjectdata/token/{token}/rowset | > **NOTE** These APIs don't support retrieving data from a synchronized data extension. Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant: **Version:** 1.0 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET Retrieve data from a data extension by providing its ID. `GET /data/v1/customobjectdata/{id}/rowset` Operation ID: `getData`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string (uuid), required) The unique identifier of the data extension to retrieve data from. * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Don’t specify this parameter if the `$offset` parameter is specified. Default: `1`. * `$pagesize` (query, integer) The number of records to return on each page of results. Default: `2500`. * `$fields` (query, string) A comma-separated list of the data extension fields to include in the response. If this parameter isn’t present in the request, the response includes all fields. * `$filter` (query, string) A string that describes the filter to apply to the response. You can only filter on primary keys. The filter must be URL encoded. Use single quotes for field values. Filters can include these operators: `eq`, `like`, `not`, and `and`. For example, to return only individuals in a data extension where the value of the LastName field is Cunningham, specify `$filter=LastName eq 'Cunningham'`. * `$orderBy` (query, string) The field and sort method to use to sort the results, such as `$orderBy=memberID ASC` to sort the results in ascending order by the value of the memberID field. If you don’t provide this value, the results are sorted in ascending order by the date and time when they were added to the data extension. * `$top` (query, integer) A fixed number of results to return in the response. For example, a value of `$top=3` returns the first three results that match the query parameters. * `$offset` (query, integer) The number of rows to skip before creating response items. When `$offset` is requested, the response contains the `$offset` property and the links contain `$offset` references. You can't specify this value if the `$page` parameter is also specified. #### Responses * **200** Indicates that the API accepted the request to retrieve data from the data extension. Media type: `application/json`. Schema: `getDataExtensionDataResponseBody`. _Example_ ``` { "links": { "previous": "/v1/customobjectdata/token/1392c2bf-c925-4207-ac52-4291c553e534/rowset?$page=1", "self": "/v1/customobjectdata/token/1392c2bf-c925-4207-ac52-4291c553e534/rowset?$page=2", "next": "/v1/customobjectdata/token/1392c2bf-c925-4207-ac52-4291c553e534/rowset?$page=3" }, "requestToken": "1392c2bf-c925-4207-ac52-4291c553e534", "tokenExpireDateUtc": "2023-09-22T17:34:36", "customObjectId": "7df6723b-76a1-e611-b68a-38eaa731a765", "customObjectKey": "data_extension0211233259337172", "pageSize": 2, "page": 2, "count": 54, "top": 0, "items": [ { "keys": { "CustID": "PU20" }, "values": { "Name": "Maria Jimenez", "AnniversaryDate": "3/20/2026 10:13:04 AM", "City": "Sacramento", "Country": "US", "Email": "mjimenez@example.com" } }, { "keys": { "CustID": "PU21" }, "values": { "Name": "Lincoln Ulrich", "AnniversaryDate": "3/20/2026 10:13:04 AM", "City": "Vancouver", "Country": "CA", "Email": "lulrich@example.com" } } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct data extension ID, key, or token. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "custom object data cannot be retrieved for key: 685D0AF4-DBCF-4B42-A6BD-9E942DBA905A", "errorcode": 30003, "documentation": "" } ``` ### GET Retrieve data from a data extension by providing its external key. `GET /data/v1/customobjectdata/key/{key}/rowset` Operation ID: `getDataByKey`. #### Parameters * `key` (path, string, required) The external key of the data extension to retrieve data from. * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Don’t specify this parameter if the `$offset` parameter is specified. Default: `1`. * `$pagesize` (query, integer) The number of records to return on each page of results. Default: `2500`. * `$fields` (query, string) A comma-separated list of the data extension fields to include in the response. If this parameter isn’t present in the request, the response includes all fields. * `$filter` (query, string) A string that describes the filter to apply to the response. You can only filter on primary keys. The filter must be URL encoded. Use single quotes for field values. Filters can include these operators: `eq`, `like`, `not`, and `and`. For example, to return only individuals in a data extension where the value of the LastName field is Cunningham, specify `$filter=LastName eq 'Cunningham'`. * `$orderBy` (query, string) The field and sort method to use to sort the results, such as `$orderBy=memberID ASC` to sort the results in ascending order by the value of the memberID field. If you don’t provide this value, the results are sorted in ascending order by the date and time when they were added to the data extension. When you use this parameter, the API automatically sets the value of the `$top` parameter to `100000`, even if you didn’t specify it in the request. * `$top` (query, integer) A fixed number of results to return in the response. For example, a value of `$top=3` returns the first three results that match the query parameters. * `$offset` (query, integer) The number of rows to skip before creating response items. When `$offset` is requested, the response contains the `$offset` property and the links contain `$offset` references. You can't specify this value if the `$page` parameter is also specified. #### Responses * **200** Indicates that the API accepted the request to retrieve data from the data extension. Media type: `application/json`. Schema: `getDataExtensionDataResponseBody`. _Example: same as GET /data/v1/customobjectdata/{id}/rowset 200 response._ * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct data extension ID, key, or token. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "custom object data cannot be retrieved for key: 685D0AF4-DBCF-4B42-A6BD-9E942DBA905A", "errorcode": 30003, "documentation": "" } ``` ### GET Retrieve data from a data extension by providing the request token. The \`$filter\`, \`$pagesize\`, \`$top\`, \`$fields\`, and \`$orderby\` parameters persist from the original query and can’t be specified. To limit the results that are returned, include the \`$page\` or \`$offset\` properties. `GET /data/v1/customobjectdata/token/{token}/rowset` Operation ID: `getDataByRequestToken`. #### Parameters * `token` (path, string, required) The request token from a previous data extension data GET request. * `$page` (query, integer) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. Don’t specify this parameter if the `$offset` parameter is specified. Default: `1`. * `$offset` (query, integer) The number of rows to skip before creating response items. When `$offset` is requested, the response contains the `$offset` property and the links contain `$offset` references. You can't specify this value if the `$page` parameter is also specified. #### Responses * **200** Indicates that the API accepted the request to retrieve data from the data extension. Media type: `application/json`. Schema: `getDataExtensionDataResponseBody`. _Example: same as GET /data/v1/customobjectdata/{id}/rowset 200 response._ * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request refers to the correct data extension ID, key, or token. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "custom object data cannot be retrieved for key: 685D0AF4-DBCF-4B42-A6BD-9E942DBA905A", "errorcode": 30003, "documentation": "" } ``` ## Schemas ### getDataExtensionDataResponseBody * `requestToken` (_string (guid)_) A unique token for the request. * `tokenExpireDateUtc` (_string (date-time)_) The date and time when the request token expires. * `customObjectId` (_string (guid)_) The unique, system-generated ID for the data extension that the data is retrieved from. * `customObjectKey` (_string_) The user-specified key for the data extension that the data is retrieved from. * `pageSize` (_number (integer)_) The number of results returned in a page of results. * `page` (_number (integer)_) The current page of results. * `count` (_number (integer)_) The total number of results returned for the request. * `top` (_number (integer)_) If the `$top` parameter was specified in the request, this property indicates the number of results returned in the request. If the `$top` parameter wasn’t specified, this value is 0. * `links` (_object_) * `self` (_string_) The request token for the current page of results. * `previous` (_string_) The request token for the previous page of results. * `next` (_string_) The request token for the next page of results. * `items` (_array of object_) * `keys` (_object_) An object that contains information about the primary key for the data extension. This object contains a key-value pair that corresponds to the primary key and the key value for the result item. * `values` (_object_) An object that contains the keys and values for the data columns retrieved from the data extension. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. # Data Extension Functions These functions allow access to the fields and rows contained within a data extension via server-side JavaScript. ## Load In your server-side JavaScript code, load the core library using this syntax: ``` Platform.Load("core","1"); ``` Use this sample code as a model to construct your own server-side JavaScript code. ## Enterprise and Enterprise 2.0 Account These functions do not support the use of enterprise-level data extensions. ## Initialization To interact with a data extension via server-side JavaScript, you must first initialize the object. This code initializes a data extension with the external key of birthdayDE. ``` var birthdayDE = DataExtension.Init("birthdayDE"); ``` Once you initialize a data extension, you can use the Fields and Rows sub-objects in your server-side JavaScript code. # Data Extension Functions The Function object allows you to use the associated methods to work with data extensions inside your Marketing Cloud Engagement account. You can use this object to add, edit, or delete information from these data extensions. For example, you can search for a ZIP code and pull back corresponding information, such as city name or closest store location, to include in a message or landing page. Data Extension Imports # Data Extension Imports Import data from a file transfer location into a data extension without creating an import definition. You can import data from a pre-signed file location such as Amazon Web Services (AWS) or Microsoft Azure without configuring a file transfer location. This table lists the use cases that the API supports. | Supported Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Queue and start a one-time data import](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Queue%2Band%2Bstart%2Ba%2Bone-time%2Bdata%2Bimport) | POST | /data/v1/async/import | | [Get status of a one-time data import](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Get%2Bstatus%2Bof%2Ba%2Bone-time%2Bdata%2Bimport) | GET | /data/v1/async/import/{id}/summary | | [Get validation summary of a one-time data import](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Get%2Bvalidation%2Bsummary%2Bfor%2Ba%2Bdata%2Bimport) | GET | /data/v1/async/import/{id}/validationsummary | | [Get validation details of a one-time data import](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Get%2Bvalidation%2Bdetails%2Bof%2Ba%2Bone-time%2Bdata%2Bimport) | GET | /data/v1/async/import/{id}/validationresult | ### Prerequisites If you receive `errorcode 20002 - Insufficient privileges to complete this action`, verify each of these requirements. After verifying all of them, if the error persists, contact Salesforce Customer Support. This error code can also indicate a transient platform issue. **Installed package scopes.** Your installed package must grant all of the following scopes. Every scope is required for every call to `POST /data/v1/async/import`, regardless of whether the source is a file-transfer location or a pre-signed URL. | Category | Scope label in the UI | OAuth scope string | | --- | --- | --- | | Automation > Automations | Read | `automations_read` | | Automation > Automations | Write | `automations_write` | | Automation > Automations | Execute | `automations_execute` | | Data > Data Extensions | Read | `data_extensions_read` | | Data > Data Extensions | Write | `data_extensions_write` | | Data > File Locations | Read | `file_locations_read` | | Data > File Locations | Write | `file_locations_write` | Configure scopes at **Setup > Apps > Installed Packages**, open the package, and update the API Integration component. If you pass a `scope` parameter when you request an access token, make sure it doesn't narrow the granted scopes. To verify which scopes a given access token carries, inspect the `scope` field in the token response. **Role-level data extension permissions.** The run-as user for the installed package must have a role that grants **Email Studio > Subscribers > Data Extensions**: View, Update, and Manage Data. The standard Marketing Cloud Channel Manager role bundles these permissions. To compare a custom role against the standard role, see [Marketing Cloud Roles](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_marketing_cloud_roles.htm&type=5). **Role-level Import activity permission.** The same role must include the Import activity permission. To turn on this permission, click **Email > Interactions > Activities > Import**. **Shared data extension access.** If the target data extension is shared from another business unit, the business unit running the import must have Read, Update, Insert, Delete, and Export permissions on the shared data extension. To configure sharing across business units, click **Email Studio > Subscribers > Shared Data Extensions**, select the data extension, and open the **Permissions** tab. For details, see [Shared Data Extension Permissions](https://help.salesforce.com/s/articleView?id=sf.mc_es_permissions_shared_data_extensions.htm&type=5). **Run-as user.** The run-as user for the installed package must be active and assigned to the business unit that the import targets. Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant: **Version:** 1 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. Find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### POST Queue and start a one-time import into a data extension without creating an import definition. `POST /data/v1/async/import` Operation ID: `Queue and start a one-time data import`. Perform a file-based import without creating an import definition. Store the source file in an active file transfer location, or provide a pre-signed URL. The source file can be on Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, or an external SFTP server. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token used to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Queue and start a one-time import of data into a data extension without creating an import definition. Media type: `application/json`. Schema: `importJobRequestBody`. _Example: Perform an import from a file transfer location_ ``` { "source": { "fileInfo": { "specifier": "sample.csv", "contentType": "CSV", "standardQuotedStrings": true } }, "target": { "type": "DataExtension", "key": "S3_Test_1000_Rows", "updateType": "Overwrite" }, "mapping": { "allowErrors": true, "fieldMappingType": "InferFromColumnHeadings" }, "transport": { "key": "FILE_LOCATION_KEY" } } ``` _Example: Perform an import with a pre-signed URL_ ``` { "source": { "fileInfo": { "specifier": "https://mcde-dev.s3.amazonaws.com/siva.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=REDACTED_AWS_ACCESS_KEY_ID/20231016/us-east-1/s3/aws4_request&X-Amz-Date=20231016T161159Z&X-Amz-Expires=3597&X-Amz-SignedHeaders=host&X-Amz-Signature=REDACTED_AWS_SIGNATURE", "contentType": "CSV", "standardQuotedStrings": true } }, "target": { "type": "DataExtension", "key": "S3_Test_1000_Rows", "updateType": "Overwrite" }, "mapping": { "allowErrors": true, "fieldMappingType": "InferFromColumnHeadings" }, "transport": { "key": "FILE_LOCATION_KEY" } } ``` _Example: Perform a multi-file import from a file transfer location_ ``` { "source": { "fileInfo": { "specifier" : "Imports_Tests/DATA", "contentType" : "OTHER", "hasMultipleFiles" : true, "standardQuotedStrings": true, "fieldDelimiter":"¶" }}, "target": { "type": "DataExtension", "key": "0C695893-C7CF-4265-B953-FCE41FDAD5F9", "updateType": "Overwrite" }, "mapping": { "allowErrors": true, "fieldMappingType": "InferFromColumnHeadings" }, "transport": { "key": "FILE_LOCATION_KEY" } } ``` _Example: Perform an import with Column-based update type_ ``` { "source": { "fileInfo": { "specifier": "Activation/2005418/CDPTestData.csv", "contentType": "Other", "hasMultipleFiles": false, "standardQuotedStrings": true, "fieldDelimiter": " " } }, "target": { "type": "DataExtension", "key": "Async_API_DE", "updateType": "ColumnBased", "controlColumn": "ControlColumn", "controlColumnDefaultAction": "Delete", "controlColumnActions": null }, "transport": { "key": "FILE_LOCATION_KEY" }, "mapping": { "allowErrors": true, "fieldMappingType": "InferFromColumnHeadings" } } ``` #### Responses * **200** The request to create an import job was successful. Media type: `application/json`. Schema: `createImportJobResponseBody`. _Example_ ``` { "id": 51593, "requestId": "cb42eea2-f986-4d2f-bed6-87f3dfcc9058", "resultMessages": [] } ``` * **400** The request failed because the request body is invalid. Media type: `application/json`. Schema: `createImportJobFailureResponseBody`. _Example_ ``` { "requestId": "60cca1da-f4d1-494f-886e-dc7fe742f663", "resultMessages": [ { "resultType": "Validation", "resultClass": "Error", "resultCode": "MissingRequiredImportObjectProperty", "message": "Missing required property for object: Import, ImportSource cannot be null or empty." }, { "resultType": "Validation", "resultClass": "Error", "resultCode": "MissingRequiredImportObjectProperty", "message": "Missing required property for object: Import, ImportTarget cannot be null or empty." }, { "resultType": "Validation", "resultClass": "Error", "resultCode": "MissingRequiredImportObjectProperty", "message": "Missing required property for object: Import, Transport cannot be null or empty." }, { "resultType": "Validation", "resultClass": "Error", "resultCode": "MissingRequiredImportObjectProperty", "message": "Missing required property for object: Import, Mapping cannot be null or empty." } ] } ``` * **401** Indicates that the API couldn’t authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. A 403 with `errorcode 20002` means that the caller is missing one of the required permissions. To resolve this error, see [Prerequisites in Data Extension Imports](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Summary#prerequisites). Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "MCMS_UTM_Authorization_InsufficientPrivileges: Insufficient privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Returns the status of a queued data import, including the final number of imported rows and the import status (\`Success\` or \`Error\`). `GET /data/v1/async/import/{id}/summary` Operation ID: `Get status of a one-time data import`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token used to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The unique identifier of the one-time data import. #### Responses * **200** The request to get the status of a queued data import was successful. If the import ID is found, the response includes the import summary. If the import ID isn't found, the response omits the `summary` object and includes details in the `resultMessages` array. Media type: `application/json`. Schema: `importSummaryResponseBody`. _Example: Success Response_ ``` { "summary": { "duplicateRows": 0, "restrictedRows": 0, "endDate": "10/16/2023 10:22:26 AM", "errors": 0, "id": 15445111, "importStatus": "Success", "importId": "ac247ef5-b6c8-4ab1-b1d0-69f6a63ce33a", "startDate": "10/16/2023 10:22:24 AM", "successfulRows": 0, "targetId": "48D72A0D-B436-EE11-813D-1402EC6B95BC", "targetKey": "", "targetUpdateType": "Data Extension", "totalRows": 1 }, "requestId": "a7d17c4d-ab9e-400e-929b-bb4c7a362992", "resultMessages": [] } ``` _Example: Error Response_ ``` { "requestId": "8b3b9b15-f461-4c90-9ded-390880650746", "resultMessages": [ { "resultType": "Operational", "resultClass": "Error", "resultCode": "ImportSummaryNotFound", "message": "ImportSummary cannot be found for Id: 91918282." } ] } ``` * **401** Indicates that the API couldn’t authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. A 403 with `errorcode 20002` means that the caller is missing one of the required permissions. To resolve this error, see [Prerequisites in Data Extension Imports](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Summary#prerequisites). Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "MCMS_UTM_Authorization_InsufficientPrivileges: Insufficient privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve a list of row-level validation errors that occurred during an import. Use this method after an import finishes to see the total number of failed rows. `GET /data/v1/async/import/{id}/validationsummary` Operation ID: `Get validation summary for a data import`. Tags: Get import row-level validation summary by taskId. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token used to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The unique identifier of the one-time data import. #### Responses * **200** The request to get the validation summary of a data import was successful. Media type: `application/json`. Schema: `importValidationSummarySuccessResponseBody`. _Example_ ``` { "id": 7033005, "importValidationSummary": [ { "validationErrorType": "RequiredField", "validationErrorCodeId": 6, "errorsCount": 115173 }, { "validationErrorType": "InvalidFieldCount", "validationErrorCodeId": 68, "errorsCount": 1 }, { "validationErrorType": "InvalidEmailAddress", "validationErrorCodeId": 18, "errorsCount": 9 } ], "requestId": "cbeb58d0-64d5-4db7-a9d8-77a8f4bc0905", "resultMessages": [] } ``` * **400** The request failed because the ID is invalid. Media type: `application/json`. Schema: `importValidationSummaryFailureResponseBody`. _Example_ ``` { "taskId": 0, "requestId": "24406701-1603-4b92-b437-852de514c786", "resultMessages": [ { "resultType": "Validation", "resultClass": "Error", "resultCode": "ImportValidationSummaryInvalidId", "message": "Invalid id for Import Validation Summary." } ] } ``` * **401** Indicates that the API couldn’t authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. A 403 with `errorcode 20002` means that the caller is missing one of the required permissions. To resolve this error, see [Prerequisites in Data Extension Imports](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Summary#prerequisites). Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "MCMS_UTM_Authorization_InsufficientPrivileges: Insufficient privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Get import row-level validation details by ID. `GET /data/v1/async/import/{id}/validationresult` Operation ID: `Get validation details of a one-time data import`. Returns details of row-level validation errors that occurred during an import. Use this method after the import job finishes to see how many rows failed to import. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token used to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, integer, required) The unique identifier of the one-time data import. #### Responses * **200** The request to get the validation details of a data import was successful. Media type: `application/json`. Schema: `importValidationDetailsResponseBody`. _Example_ ``` { "id": 7033005, "page": 1, "pageSize": 50, "count": 115183, "items": [ { "rowId": 0, "validationErrorType": "RequiredField", "validationErrorCodeId": 6, "validationErrorDetails": "first_connection_at" }, { "rowId": 1, "validationErrorType": "RequiredField", "validationErrorCodeId": 6, "validationErrorDetails": "first_connection_at" }, { "rowId": 5, "validationErrorType": "RequiredField", "validationErrorCodeId": 6, "validationErrorDetails": "first_connection_at" }, { "rowId": 6, "validationErrorType": "RequiredField", "validationErrorCodeId": 6, "validationErrorDetails": "first_connection_at" } ] } ``` * **401** Indicates that the API couldn’t authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. A 403 with `errorcode 20002` means that the caller is missing one of the required permissions. To resolve this error, see [Prerequisites in Data Extension Imports](/docs/marketing/marketing-cloud/references/mc-import_job_api?meta=Summary#prerequisites). Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "MCMS_UTM_Authorization_InsufficientPrivileges: Insufficient privileges to complete this action.", "errorcode": 20002, "documentation": "" } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ## Schemas ### importJobRequestBody Request body. * `importJobRequestBody` (_object_) Includes all fields of `fileInfo`, `target`, `mapping`, `transport`. ### createImportJobResponseBody * `id` (_integer_) The unique identifier of the import job. Use this value to retrieve the status of the import job. * `requestId` (_string_) A unique identifier for the request. * `resultMessages` (_array of resultMessages_) A list of messages related to the request. This list is typically empty in a successful response. ### createImportJobFailureResponseBody * `requestId` (_string_) A unique identifier for the request. * `resultMessages` (_array of resultMessages_) A list of messages related to the request. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### importSummaryResponseBody * `summary` (_object_) An object that contains information about the import job. * `duplicateRows` (_integer_) Number of duplicate rows. * `restrictedRows` (_integer_) Number of restricted rows. * `endDate` (_string_) The date and time the import job finished. * `errors` (_integer_) Number of errors. * `id` (_integer_) The unique identifier of the import job. * `importStatus` (_string_) The status of the import job. * `importId` (_string_) The unique identifier of the import job. * `startDate` (_string_) The date and time the import job started. * `successfulRows` (_integer_) Number of successful rows. * `targetId` (_string_) The unique identifier of the target data extension. * `targetKey` (_string_) The external key of the target data extension. * `targetUpdateType` (_string_) The type of import operation that was performed on the target data extension. * `totalRows` (_integer_) Total number of rows. * `requestId` (_string_) A unique identifier for the request. * `resultMessages` (_array of resultMessages_) A list of messages related to the request. This list is typically empty in a successful response. ### importValidationSummarySuccessResponseBody * `id` (_integer_) The unique identifier of the import job that the validation summary was generated for. * `importValidationSummary` (_array of object_) A list of validation errors. * `validationErrorType` (_string_) The type of validation error. * `validationErrorCodeId` (_integer_) The ID of the validation error. * `errorsCount` (_integer_) The number of errors that occurred. * `requestId` (_string_) A unique identifier for the request to retrieve the validation summary. * `resultMessages` (_array of resultMessages_) A list of messages related to the request. ### importValidationSummaryFailureResponseBody * `taskId` (_integer_) The unique identifier of the import job. * `requestId` (_string_) A unique identifier for the request. * `resultMessages` (_array of resultMessages_) A list of messages related to the request. ### importValidationDetailsResponseBody * `id` (_integer_) The unique identifier of the import job. * `page` (_integer_) The page number of the results. * `pageSize` (_integer_) The number of items per page of results. * `count` (_integer_) The total number of results. * `items` (_array of object_) A list of validation details. * `rowId` (_integer_) The row number where the validation error occurred. * `validationErrorType` (_string_) The type of validation error. * `validationErrorCodeId` (_integer_) An error code that corresponds to the validation error type. * `validationErrorDetails` (_string_) The field that caused the validation error. For example, if a required field is missing, this field contains the name of the missing field. ### fileInfo Defines the source file details for an import. * `specifier` (_string_, required) Name of the source file (compressed or uncompressed). For multiple files, specify the folder name instead. Example: `sample.csv`. * `contentType` (_string_, required) Indicates how the content is delimited. Example: `[CSV,TAB,OTHER]`. * `hasMultipleFiles` (_string_, required) Indicates whether the specifier has more than one file to import. Defaults to `false`. Example: `[true,false]`. * `standardQuotedStrings` (_string_) Indicates if the import respects double quotes (") as a text delimiter. Example: `[true,false]`. ### target Specifies the destination details for an import. * `type` (_string_, required) The type of the object being imported into. The only supported value is DataExtension. Example: `DataExtension`. * `key` (_string_, required) The unique (customerKey) reference of the data extension. Example: `DE_Customer_Key`. * `updateType` (_string_, required) The type of import operation to perform on the destination data extension. Example: `[Overwrite, AddAndUpdate, AddAndDoNotUpdate, UpdateButDoNotAdd, ColumnBased]`. * `controlColumn` (_string_) Column name in the source file that controls the row-level action—for example, `add`, `delete`, or `update`. Example: `[Action_Column]`. * `controlColumnDefaultAction` (_string_) Default action on a row when you don't specify an explicit action code. Example: `[Delete, AddAndUpdate]`. ### mapping Defines the field mapping for an import. * `allowErrors` (_boolean_, required) Indicates whether the import continues past row-level errors. Defaults to `true`. Example: `[true, false]`. * `fieldMappingType` (_string_, required) Indicates the type of field mapping. Example: `[InferFromColumnHeadings, MapByOrdinal, ManualMap]`. ### transport Defines the file transfer location details. * `key` (_string_, required) The external key of an active file transfer location. Create a file location on the **Data Management** | **File Locations** page in Setup. Example: `FILE_LOCATION_KEY`. ### resultMessages * `resultType` (_string_) The type of error. * `resultClass` (_string_) The class of the result. * `resultCode` (_string_) A code that indicates the specific type of error. * `message` (_string_) A message that describes the error. Data Extension Rows (Asynchronous) # Data Extension Rows (Asynchronous) Manage rows in a data extension asynchronously. > **NOTE** > > There are several APIs related to data extensions: > > * Use this API or the [Data Extension Rows (Synchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync) API to add or update rows of data in a data extension. > * Use the [Data Extensions](/docs/marketing/marketing-cloud/references/mc-custom_objects) API to create, modify, and manage data extension objects. > * Use the [Data Extension Data](/docs/marketing/marketing-cloud/references/mc-custom_object_data) API to query data in a data extension. > * Use the [Data Extension Imports](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-import_job_api) API to manage data import jobs. This table lists the use cases that the Data Extension Rows Asynchronous API supports. | Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Get the results of an asynchronous insert or upsert request](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async?meta=getRequestResults) | GET | /data/v1/async/{requestId}/results | | [Get the status of an asynchronous insert or upsert request](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async?meta=getRequestStatus) | GET | /data/v1/async/{requestId}/status | | [Insert data extension rows asynchronously](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async?meta=insertRows) | POST | /data/v1/async/dataextensions/key:{externalKey}/rows | | [Upsert data extension rows asynchronously](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async?meta=upsertRows) | PUT | /data/v1/async/dataextensions/key:{externalKey}/rows | For information about the limits that apply to this API, see _Salesforce Help_: [Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits.htm). Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant: **Version:** 1 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default None) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET Retrieve the results of a request to asynchronously insert rows into a data extension. `GET /data/v1/async/{requestId}/results` Operation ID: `getRequestResults`. For information about the limits that apply to this API, see _Salesforce Help_: [Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits.htm). #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `requestId` (path, string (uuid), required) A unique ID for an asynchronous request. Use this ID to retrieve the status and results of the request. #### Responses * **200** This response includes the results of a request to asynchronously insert or update data in a data extension. The API also returns this response if it's unable to find the specified `requestId`. If the API fails to retrieve the specified `requestId`, the `status` object is omitted in the response, and the `resultMessages` array contains details of the issue. This example shows a successful request. Media type: `application/json`. Schema: `insertUpdateResultsGetResponseBody`. _Example_ ``` { "page": 1, "pageSize": 2, "count": 2, "items": [ { "message": "Created DataExtensionObject", "status": "OK" }, { "errorCode": 71003, "message": "Cannot insert the value NULL into column 'RewardsPoints', table 'ExactTarget.C67709.MembershipRewardsProgramme2'; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated.", "status": "Error" } ], "requestId": "5a67f73d-801d-4b5f-bee7-8b6acf34743a", "resultMessages": [] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### GET Retrieve the status of a request to asynchronously insert rows into a data extension. `GET /data/v1/async/{requestId}/status` Operation ID: `getRequestStatus`. For information about the limits that apply to this API, see _Salesforce Help_: [Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits.htm). #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `requestId` (path, string (uuid), required) A unique ID for an asynchronous request. Use this ID to retrieve the status and results of the request. #### Responses * **200** This response describes the status of a request to asynchronously insert or update data in a data extension. In some cases, it can take several seconds for results to be available after you submit a request. The API also returns this response if it's unable to find the specified `requestId`. If the API fails to retrieve the specified `requestId`, the `status` object is omitted in the response, and the `resultMessages` array contains details of the issue. This example shows a successful request. Media type: `application/json`. Schema: `insertUpdateStatusGetResponseBody`. _Example_ ``` { "status": { "callDateTime": "2024-07-11T22:19:02.04", "completionDateTime": "2024-07-11T22:19:03.97", "hasErrors": false, "pickupDateTime": "2024-07-11T22:19:03.567", "requestStatus": "Complete", "resultStatus": "OK", "requestId": "12260e92-b8cb-41ec-8c5a-116fb9d23eb4" }, "requestId": "615f178b-d380-440c-a650-defd99b1efde", "resultMessages": [] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### PUT Asynchronously update rows in a data extension if the primary key exists, or create rows if the primary key doesn't exist. `PUT /data/v1/async/dataextensions/key:{externalKey}/rows` Operation ID: `upsertRows`. For information about the limits that apply to this API, see _Salesforce Help_: [Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits.htm). #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `externalKey` (path, string (uuid), required) The external ID, also known as the customer key, for the data extension to insert or upsert data into. #### Request body (required) Media type: `application/json`. Schema: `dataExtensionInsertUpdateRequestBody`. #### Responses * **202** This response indicates that the API accepted the request to add data to a data extension asynchronously. Media type: `application/json`. Schema: `dataExtensionInsertUpdateResponseBody`. _Example_ ``` { "requestId": "399d1e33-9beb-4192-b915-3925b0e1a00c", "resultMessages": [] } ``` * **400** This response indicates that the API couldn't process the request. This response typically indicates that the request body is invalid. Media type: `application/json`. Schema: `dataExtensionInsertUpdateResponseBody`. _Example_ ``` { "requestId": "a35d08b3-9b56-4d79-8347-3dee55f76a77", "resultMessages": [ { "resultType": "Validation", "resultClass": "Error", "resultCode": "NullOrEmptyRows", "message": "Invalid request, Items cannot be null or empty." } ] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Add rows to a data extension asynchronously. `POST /data/v1/async/dataextensions/key:{externalKey}/rows` Operation ID: `insertRows`. For information about the limits that apply to this API, see _Salesforce Help_: [Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits.htm). #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `externalKey` (path, string (uuid), required) The external ID, also known as the customer key, for the data extension to insert or upsert data into. #### Request body (required) Media type: `application/json`. Schema: `dataExtensionInsertUpdateRequestBody`. #### Responses * **202** This response indicates that the API accepted the request to add data to a data extension asynchronously. Media type: `application/json`. Schema: `dataExtensionInsertUpdateResponseBody`. _Example_ ``` { "requestId": "399d1e33-9beb-4192-b915-3925b0e1a00c", "resultMessages": [] } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ## Schemas ### insertUpdateResultsGetResponseBody * `page` (_number (integer)_) The current page of results. * `pageSize` (_number (integer)_) The number of results per page. By default, there are 50 results per page. * `count` (_number (integer)_) The total number of results. * `items` (_array of object_) * `message` (_string_) A description of the result. Possible values for items that were created or updated successfully: * `Created DataExtensionObject`—The record was created. * `Upserted DataExtensionObject`—The record was updated if the primary key was found or created if the primary key wasn't found. If the item wasn't inserted or updated, this property contains a description of the issue that caused the operation to fail. * `status` (_string_) The status of the request. Possible values: * `OK` * `Error` * `errorCode` (_number (integer)_) This property isn't included in records that were successfully created or upserted. * `requestId` (_string_) The request ID for the original request. * `resultMessages` (_array of object_) An array that contains information about issues that caused the request to fail. If the API successfully retrieved the status, this array is included in the result but contains no items. * `message` (_string_) A description of the error that prevented the API from retrieving the status. Example: `Unable to locate an Async Request Status Record for the provided RequestId: efd98722-5826-418f-849e-c13a06ad3622.`. * `resultType` (_string_) Example: `Operational`. * `resultClass` (_string_) Example: `Error`. * `resultCode` (_string_) Example: `AsyncRequestStatusNotFound`. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the Marketing Cloud Engagement developer documentation page about [handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### insertUpdateStatusGetResponseBody * `status` (_object_) An object that provides metadata related to the request. If the API wasn't able to retrieve the status for the specified `requestId`, this object isn't included in the response. * `callDateTime` (_string (date-time)_) The date and time when the insert or upsert request was received. * `completionDateTime` (_string (date-time)_) The date and time when the insert or upsert operation finished. * `hasErrors` (_boolean_) Indicates whether there were errors in the request. If the value is `true`, there was at least one error in the request. However, a value of `true` doesn't indicate that the entire request failed. * `pickupDateTime` (_string (date-time)_) The date and time when the request was retrieved from the asynchronous queue for processing. * `requestStatus` (_string_) The status of the request. Possible values: * `Complete`—The request completed successfully. This value is returned even if individual records in the request failed to process. * `Error`—The request failed. * `Executing`–The request is being executed. * `Pending`—The request hasn’t been processed yet or is in progress. * `resultStatus` (_string_) The status of the individual records in the request. If the status is `OK`, all records in the request were processed without errors. If the status is `Has Errors`, there was at least one record with an error. * `requestId` (_string_) The request ID for the original request. * `requestId` (_string_) A unique ID for the status retrieval request. * `resultMessages` (_array of object_) An array that contains information about issues that caused the request to fail. If the API successfully retrieved the status, this array is included in the result but contains no items. * `message` (_string_) A description of the error that prevented the API from retrieving the status. Example: `Unable to locate an Async Request Status Record for the provided RequestId: efd98722-5826-418f-849e-c13a06ad3622.`. * `resultType` (_string_) Example: `Operational`. * `resultClass` (_string_) Example: `Error`. * `resultCode` (_string_) Example: `AsyncRequestStatusNotFound`. ### dataExtensionInsertUpdateRequestBody * `items` (_array of object_) An array that contains the data to insert into the data extension. Each object in the array contains the data to insert into a single row in the data extension. * `{fieldName}` (_string_) The data to insert or update in the data extension. Replace `{fieldName}` with the name of the column. The data type must match the data type in the corresponding column of the data extension. In some cases, the API converts data to the correct data type. For example, if a request passes a string value of "123", but the data extension expects an integer for that column, the data is converted to an integer automatically. _Example_ ``` { "items": [ { "MemberId": "f284db27-e840-4e17-bcb6-537f7f1b54ad", "FirstName": "Raul", "Surname": "Nieto", "RewardsPoints": 23456, "RewardsTier": 3, "Area": "Enfield" }, { "MemberId": "cc6298da-159a-4a3e-b841-3f1048b3fd3c", "FirstName": "Foua", "Surname": "Khang", "RewardsPoints": 666777, "RewardsTier": 4, "Area": "West Ham" }, { "MemberId": "9dfc9341-d9d3-44f3-8624-f4c2dc87b4b3", "FirstName": "Mary", "Surname": "Evans", "RewardsPoints": 7849, "RewardsTier": 1, "Area": "Islington" }, { "MemberId": "9dfc9341-d9d3-44f3-8624-f4c2dc87b4b3", "FirstName": "Vijay", "Surname": "Lahiri", "RewardsPoints": 7742, "RewardsTier": 1, "Area": "Haringey" } ] } ``` ### dataExtensionInsertUpdateResponseBody * `requestId` (_string_) The request ID for the request. Use this ID to retrieve the status and results of the request. * `resultMessages` (_array of object_) An array of objects that contain information about the results of the request. In a successful response, this array is typically empty. * `resultType` (_string_) The step that failed while processing the request, such as `Validation`. * `resultClass` (_string_) The type of issue that occurred, such as `Error`. * `resultCode` (_string_) An error code that indicates the type of error that occurred. * `message` (_string_) A message that describes the issue indicated by the `resultCode` property. Data Extension Rows (Synchronous) # Data Extension Rows (Synchronous) To modify individual rows or groups of rows (rowsets) in a data extension, use the `/hub/v1/dataevents/` endpoints. Requests that you send to these endpoints are executed synchronously. > **NOTE** > > There are several APIs related to data extensions: > > * Use this API or the [Data Extension Rows (Asynchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async) API to add or update rows of data in a data extension. > * Use the [Data Extensions](/docs/marketing/marketing-cloud/references/mc-custom_objects) API to create, modify, and manage data extension objects. > * Use the [Data Extension Data](/docs/marketing/marketing-cloud/references/mc-custom_object_data) API to query data in a data extension. > * Use the [Data Extension Imports](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-import_job_api) API to manage data import jobs. This table lists the use cases that the Data Extension Rows Synchronous API supports. | Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Upsert a row](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=upsertRow) | PUT | /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{PrimaryKeyValue} | | [Upsert a row by data extension external key](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=upsertRowByKey) | PUT | /hub/v1/dataevents/key:{externalKey}/rows/{primaryKey}:{PrimaryKeyValue} | | [Increment column value](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=incrementColumnValue) | PUT | /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{primaryKeyValue}/column/{column}/increment | | [Increment column value by data extension external key](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=incrementColumnValueByKey) | PUT | /hub/v1/dataevents/key:{externalKey}/rows/{primaryKey}:{primaryKeyValue}/column/{column}/increment | | [Upsert a rowset by using a data extension ID](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=upsertRowset) | POST | /hub/v1/dataevents/{dataExtensionId}/rowset | | [Upsert a rowset by using a data extension external key](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=upsertRowsetByKey) | POST | /hub/v1/dataevents/key:{externalKey}/rowset | Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant: **Version:** 1 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default None) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### PUT Upsert one row in a data extension synchronously by specifying the ID of the target data extension. `PUT /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{primaryKeyValue}` Operation ID: `upsertRow`. Specify the primary key and value in the URL path. If the target data extension has more than one primary key, specify all the primary keys and values in this format: `{primaryKey1}:{primaryKeyValue1},{primaryKey2}:{primaryKeyValue2}...`. The API doesn’t accept URLs that contain more than 260 characters. Because character-encoding changes can make URLs longer than expected, we recommend that you limit the length of URLs to 200 characters. If your URL exceeds this recommended limit, use [Upsert a Rowset by Using a Data Extension External Key](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=Upsert%2Ba%2BRowset%2Bby%2BUsing%2Ba%2BData%2BExtension%2BExternal%2BKey) or [Upsert a Rowset by Using a Data Extension ID](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=Upsert%2Ba%2BRowset%2Bby%2BData%2BExtension%2BID) instead. These operations include the primary key in the request body rather than the URL path, making the URL shorter so it stays within the limit. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `dataExtensionId` (path, string (uuid), required) The unique, system-generated ID for the data extension. * `primaryKey` (path, string, required) The name of a primary key column in the specified data extension. * `primaryKeyValue` (path, string, required) The value of the primary key field in the row to update. #### Request body (required) Media type: `application/json`. Schema: `upsertDataExtensionRowRequestBody`. #### Responses * **200** This response indicates that the request to upsert a row into the data extension succeeded. Media type: `application/json`. Schema: `upsertDataExtensionRowResponseBody`. _Example_ ``` { "keys": { "memberId": "54ce45e4-bd37-4284-bffe-593256ea5bd4" }, "values": { "FirstName": "Mary", "Surname": "Evans-Smythe", "RewardsPoints": 7849, "RewardsTier": 1, "Area": "Islington" } } ``` * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### PUT Upsert one row in a data extension synchronously by specifying the external key of the target data extension. `PUT /hub/v1/dataevents/key:{externalKey}/rows/{primaryKey}:{primaryKeyValue}` Operation ID: `upsertRowByKey`. The API doesn’t accept URLs that contain more than 260 characters. Because character-encoding changes can make URLs longer than expected, we recommend that you limit the length of URLs to 200 characters. If your URL exceeds this recommended limit, use [Upsert a Rowset by Using a Data Extension External Key](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=Upsert%2Ba%2BRowset%2Bby%2BData%2BExtension%2BExternal%2BKey) or [Upsert a Rowset by Using a Data Extension ID](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync?meta=Upsert%2Ba%2BRowset%2Bby%2BData%2BExtension%2BID) instead. These operations include the primary key in the request body rather than the URL path, making the URL shorter so it stays within the limit. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `externalKey` (path, string, required) The external ID, also known as the customer key, for the data extension. * `primaryKey` (path, string, required) The name of a primary key column in the specified data extension. * `primaryKeyValue` (path, string, required) The value of the primary key field in the row to update. #### Request body (required) Media type: `application/json`. Schema: `upsertDataExtensionRowRequestBody`. #### Responses * **200** This response indicates that the request to upsert a row into the data extension succeeded. Media type: `application/json`. Schema: `upsertDataExtensionRowResponseBody`. _Example: same as PUT /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{primaryKeyValue} 200 response._ * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### PUT Increase or decrease the value of a data extension column synchronously. For example, you can use this operation to update a customer’s loyalty reward point value after they make a purchase. `PUT /hub/v1/dataevents/{dataExtensionId}/rows/{primaryKey}:{primaryKeyValue}/column/{column}/increment` Operation ID: `incrementColumnValue`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `dataExtensionId` (path, string (uuid), required) The unique, system-generated ID for the data extension. * `primaryKey` (path, string, required) The name of a primary key column in the specified data extension. * `primaryKeyValue` (path, string, required) The value of the primary key field in the row to update. * `column` (path, string, required) The name of the column to increment the value of. * `step` (query, number, required) The amount to increase the value of the specified column by. The default value is `1`. #### Responses * **200** This response indicates that the request to increment the specified column succeeded. Media type: `text/plain`. Schema: `integer`. The response body contains the updated value of the specified field. Type: `integer`. _Example_ ``` 12345 ``` * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### PUT Increase or decrease the value of a data extension column synchronously. For example, you can use this operation to update a customer’s loyalty reward point value after they make a purchase. `PUT /hub/v1/dataevents/key:{externalKey}/rows/{primaryKey}:{primaryKeyValue}/column/{column}/increment` Operation ID: `incrementColumnValueByKey`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `externalKey` (path, string, required) The external ID, also known as the customer key, for the data extension. * `primaryKey` (path, string, required) The name of a primary key column in the specified data extension. * `primaryKeyValue` (path, string, required) The value of the primary key field in the row to update. * `column` (path, string, required) The name of the column to increment the value of. * `step` (query, number, required) The amount to increase the value of the specified column by. The default value is `1`. #### Responses * **200** This response indicates that the request to increment the specified column succeeded. Media type: `text/plain`. Schema: `integer`. The response body contains the updated value of the specified field. Type: `integer`. _Example_ ``` 12345 ``` * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### POST Upsert one or more rows in a data extension synchronously by specifying the ID of the target data extension. `POST /hub/v1/dataevents/{dataExtensionId}/rowset` Operation ID: `upsertRowset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `dataExtensionId` (path, string (uuid), required) The unique, system-generated ID for the data extension. #### Request body (required) Media type: `application/json`. Schema: `upsertDataExtensionRowsRequestBody`. #### Responses * **200** This response indicates that the request to upsert one or more rows into the data extension succeeded. Media type: `application/json`. Schema: `upsertDataExtensionRowsResponseBody`. _Example_ ``` [ { "keys": { "MemberId": "38bed58c-9b97-4e95-90bf-8f39e8f539e1" }, "values": { "FirstName": "Raul", "Surname": "Nieto", "RewardsPoints": 23456, "RewardsTier": 3, "Area": "Enfield" } }, { "keys": { "MemberId": "54ce45e4-bd37-4284-bffe-593256ea5bd4" }, "values": { "FirstName": "Mary", "Surname": "Evans", "RewardsPoints": 7849, "RewardsTier": 1, "Area": "Islington" } } ] ``` * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### POST Upsert one or more rows in a data extension synchronously by specifying the external key of the target data extension. `POST /hub/v1/dataevents/key:{externalKey}/rowset` Operation ID: `upsertRowsetByKey`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `externalKey` (path, string, required) The external ID, also known as the customer key, for the data extension. #### Request body (required) Media type: `application/json`. Schema: `upsertDataExtensionRowsRequestBody`. #### Responses * **200** This response indicates that the request to upsert one or more rows into the data extension succeeded. Media type: `application/json`. Schema: `upsertDataExtensionRowsResponseBody`. _Example: same as POST /hub/v1/dataevents/{dataExtensionId}/rowset 200 response._ * **400** This response indicates that there was a problem with the request. Verify that the ID or external key of the data extension is correct, the name and value of the primary key are valid, and the data types of all fields in the request are correct. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 400, "message": "Primary key 'MemberId' does not exist." } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ## Schemas ### upsertDataExtensionRowRequestBody * `values` (_object_) * `{fieldName}` (_string_) The data to update in the data extension. Replace `{fieldName}` with the name of the column. The request can include multiple fields. The data type of each value must match the data type in the corresponding column of the data extension. In some cases, the API converts data to the correct data type. For example, if a request passes a string value of "123", but the data extension expects an integer for that column, the data is converted to an integer automatically. _Example_ ``` { "values": { "FirstName": "Mary", "Surname": "Evans-Smythe", "RewardsPoints": 7849, "RewardsTier": 1, "Area": "Islington" } } ``` ### upsertDataExtensionRowResponseBody * `keys` (_object_) * `{keyName}` (_string_) The primary key field name and value to upsert in the data extension. Replace `{keyName}` with the name of the primary key field. * `values` (_object_) * `{fieldName}` (_string_) The data to update in the data extension. Replace `{fieldName}` with the name of the column. The request can include multiple fields. The data type of each value must match the data type in the corresponding column of the data extension. In some cases, the API converts data to the correct data type. For example, if a request passes a string value of "123", but the data extension expects an integer for that column, the data is converted to an integer automatically. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. * `message` (_string_) The error message. ### upsertDataExtensionRowsRequestBody Array of `object`. * `keys` (_object_) * `{keyName}` (_string_) The primary key field name and value to upsert in the data extension. Replace `{keyName}` with the name of the primary key field. * `values` (_object_) * `{fieldName}` (_string_) The data to update in the data extension. Replace `{fieldName}` with the name of the column. The request can include multiple fields. The data type of each value must match the data type in the corresponding column of the data extension. In some cases, the API converts data to the correct data type. For example, if a request passes a string value of "123", but the data extension expects an integer for that column, the data is converted to an integer automatically. _Example_ ``` [ { "keys": { "MemberId": "38bed58c-9b97-4e95-90bf-8f39e8f539e1" }, "values": { "FirstName": "Raul", "Surname": "Nieto", "RewardsPoints": 23456, "RewardsTier": 3, "Area": "Enfield" } }, { "keys": { "MemberId": "54ce45e4-bd37-4284-bffe-593256ea5bd4" }, "values": { "FirstName": "Mary", "Surname": "Evans", "RewardsPoints": 7849, "RewardsTier": 1, "Area": "Islington" } } ] ``` ### upsertDataExtensionRowsResponseBody Array of `object`. * `keys` (_object_) * `{keyName}` (_string_) The primary key field name and value to upsert in the data extension. Replace `{keyName}` with the name of the primary key field. * `values` (_object_) * `{fieldName}` (_string_) The data to update in the data extension. Replace `{fieldName}` with the name of the column. The request can include multiple fields. The data type of each value must match the data type in the corresponding column of the data extension. In some cases, the API converts data to the correct data type. For example, if a request passes a string value of "123", but the data extension expects an integer for that column, the data is converted to an integer automatically. # Data Extension Update Activity Format The data extension update activity is used to modify the contact model attribute and data extension values at runtime. This activity type can’t be used in a custom activity. ## [](#journey-specification-format)Journey Specification Format The activity must be formatted as specified below. The following JSON object is included in the `activities` array of a journey, as defined in the Journey Specification. ## Sample Request ```js { "key": "data-extension-update-1", "name": "My Data Extension Update 1", "type": "DataExtensionUpdate", "outcomes": [ { "key": "dataUpdate-outcome-1", "next": "" } ], "arguments": { "value": "some value" }, "configurationArguments": { "dataExtensionId": "", "field": "" } } ``` ## Sample Response ```js { "id": "4281880b-2eae-4819-99e8-a40bb1c864c8", "key": "data-extension-update-1", "name": "My Data Extension Update 1", "type": "DataExtensionUpdate", "outcomes": [ { "key": "dataUpdate-outcome-1", "next": "" } ], "arguments": { "value": "some value" }, "configurationArguments": { "dataExtensionId": "", "field": "" } } ``` ## Related Items [Journey Specification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.md) # Data Extensions You can use SOAP API to manage most aspects of a data extension. For example, you can create data extensions, add columns to or remove columns from them, and insert or update the data they contain. These technical articles contain information and examples that describe how to use SOAP API to manage data extensions. - [Add Data to a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_data_to_data_extension_object.md) - [Add Column to a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_new_column_to_an_existing_data_extension.md) - [Change the Retention Period for a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/changing_the_retention_period_for_a_data_extension.md) - [Clear Data from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clearing_data_from_a_data_extension.md) - [Create a Data Extension Using an Existing Template](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extension_using_an_existing_template.md) - [Create a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extension_using_web_service_api.md) - [Create a Row in a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_row_in_a_data_extension_using_the_web_service_api.md) - [Create a Sendable Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_sendable_data_extension.md) - [Delete a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_data_extension_object.md) - [Delete a Row from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_row_from_a_data_extension_via_the_web_service_api.md) - [Manage Data in Data Extensions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/managing_data_in_data_extensions.md) - [Retrieve Data Extension Object Using Customer Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_dataextension_object.md) - [Retrieve Data from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_data_from_a_data_extension.md) - [Update a Data Extension with a Null Field Value](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updating_a_data_extension_object_with_a_null_field_value.md) - [Update Column Properties for a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updating_column_properties_for_an_existing_data_extension.md) You can use these operations to work with standard data extensions and shared data extensions. When you use SOAP API with shared data extensions, authenticate your request against the parent Enterprise account, and include a `Client.ID` value that equals the ID of the parent account, also known as the Enterprise ID or EID. See [Use ClientID in Your Code](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/using_clientid_in_your_soap_api_code.md). # Data Extensions The MCP server for Marketing Cloud Engagement includes several tools for managing data extensions. This table includes information about tools related to managing data extensions. **important:** Destructive tools can change or delete data. Before you use a destructive tool, ask the AI assistant to perform a trial run of the task or show you the code that it plans to execute. | Tool Name | Description | Required Scopes | | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | | `sfmc_bulk_upsert_data_extension_rows` | Async bulk upsert rows into a Data Extension.

Special considerations: Asynchronous | Data \| Data Extensions \| Write | | `sfmc_bulk_upsert_data_event_rows` | Batch upsert multiple rows into a Data Extension by external key. | Data \| Data Extensions \| Write | | `sfmc_clear_data_extension_data` | Clear all data from a data extension.

Special considerations: Destructive | Data \| Data Extensions \| Write | | `sfmc_create_data_extension` | Create a data extension. | Data \| Data Extensions \| Write | | `sfmc_create_data_extension_field_async` | Add fields to a data extension.

Special considerations: Asynchronous | Data \| Data Extensions \| Write | | `sfmc_delete_data_extension` | Delete a data extension.

Special considerations: Destructive | Data \| Data Extensions \| Write | | `sfmc_get_bulk_job_status` | Get the status of an async bulk data job.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_bulk_job_results` | Get the results of a completed async bulk data job.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_data_extension` | Retrieve a data extension.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_data_extension_fields` | Retrieve the field definitions for a data extension.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_data_extension_folders` | List all data extension folders.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_data_extension_link` | Create and output a direct link to a data extension in the Marketing Cloud Engagement UI.

Special considerations: Read-only, open-world | (No permissions required) | | `sfmc_get_data_extensions` | Search and list data extensions.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_get_data_extensions_by_category` | Retrieve all data extensions in a folder.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_query_data_extension_rows` | Query rows from a Data Extension by its external key, with filtering and pagination.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_retrieve_data_extension_record` | Retrieve a single row from a data extension.

Special considerations: Read-only, open-world | Data \| Data Extensions \| Read | | `sfmc_update_data_extension` | Update the properties of a data extension.

Special considerations: Destructive | Data \| Data Extensions \| Write | | `sfmc_update_data_extension_field_async` | Update the fields in a data extension asynchronously.

Special considerations: Destructive, asynchronous | Data \| Data Extensions \| Write | | `sfmc_upsert_data_extension_record` | Update a row into a data extension, or insert a row if it doesn’t exist. | Data \| Data Extensions \| Write | Data Extensions # Data Extensions Create, modify, and manage data extensions (also called custom objects). > **NOTE** > > There are several APIs related to data extensions: > > * Use this API to create, modify, and manage data extension objects. > * Use the [Data Extension Rows (Asynchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_async) and [Data Extension Rows (Synchronous)](/docs/marketing/marketing-cloud/references/mc-data_extension_rows_sync) APIs to add or update rows of data in a data extension. > * Use the [Data Extension Data](/docs/marketing/marketing-cloud/references/mc-custom_object_data) API to query data in a data extension. > * Use the [Data Extension Imports](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-import_job_api) API to manage data import jobs. This table lists the use cases that this API supports. | Use Case | HTTP Verb | Endpoint | | --- | --- | --- | | [Get data extensions](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=getDataExtensions) | GET | /data/v1/customobjects | | [Create data extension](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=createDataExtension) | POST | /data/v1/customobjects | | [Delete data extension](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=deleteDataExtension) | DELETE | /data/v1/customobjects/{id} | | [Get data extension](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=getDataExtension) | GET | /data/v1/customobjects/{id} | | [Update data extension](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=updateDataExtension) | PATCH | /data/v1/customobjects/{id} | | [Clear data extension data](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=clearDataExtensionData) | POST | /data/v1/customobjects/{id}/cleardata | | [Get data extension fields](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=getDataExtensionFields) | GET | /data/v1/customobjects/{id}/fields | | [Get data extensions by category ID](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=getDataExtensionsByCategoryId) | GET | /data/v1/customobjects/category/{categoryId} | | [Update data extension field](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=updateDataExtensionField) | PATCH | /data/v1/customobjectsasync/{id}/fields | | [Create data extension field](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=createDataExtensionField) | POST | /data/v1/customobjectsasync/{id}/fields | Append the operation endpoint addresses to this base URL, replacing `{subdomain}` with the unique subdomain for your Marketing Cloud Engagement tenant. **Version:** 1.0 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET Retrieves a list of data extensions that match a search string. `GET /data/v1/customobjects` Operation ID: `getDataExtensions`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Read (`data_extensions_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$search` (query, string, required) A string to search for in the name of the custom object. * `$page` (query, number) The page of results to retrieve. Each page includes the number of records specified by the $pagesize parameter. You can retrieve additional pages by incrementing this number in subsequent calls. The default value is `1`. * `$pagesize` (query, number) The number of records to return on each page of results. The default value is `2500`. #### Responses * **200** This response indicates that the API accepted the request to retrieve a list of custom objects. Media type: `application/json`. Schema: `getCustomObjectsResponseBody`. _Example_ ``` { "count": 1, "page": 1, "pageSize": 25, "links": {}, "items": [ { "id": "36e73253-16a9-ee11-ac6c-0abc489251b9", "name": "facb9d48d7c44486a7b0715ef0b2f7a2", "key": "facb9d48d7c44486a7b0715ef0b2f7a2", "description": "", "isActive": true, "isSendable": true, "sendableCustomObjectField": "SubscriberKey", "sendableSubscriberField": "_SubscriberKey", "isTestable": true, "categoryId": 152631, "ownerId": 712000003, "isObjectDeletable": true, "isFieldAdditionAllowed": true, "isFieldModificationAllowed": true, "createdDate": "2024-01-01T20:26:31.07", "createdById": 712000003, "createdByName": "TestUser", "modifiedDate": "2024-01-01T20:26:31.07", "modifiedById": 712000003, "modifiedByName": "TestUser", "ownerName": "TestUser", "partnerApiObjectTypeId": 310, "partnerApiObjectTypeName": "DataExtension", "rowCount": 100000, "dataRetentionProperties": { "isDeleteAtEndOfRetentionPeriod": false, "isRowBasedRetention": false, "isResetRetentionPeriodOnImport": false }, "fieldCount": 5 } ] } ``` * **400** This response indicates that the API couldn’t retrieve a list of custom objects because there was a problem with the request. For example, the API returns this response when your request doesn’t include a `$search` query parameter. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "$search is a required parameter", "errorcode": 10005, "documentation": "" } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### POST Creates a data extension. `POST /data/v1/customobjects` Operation ID: `createDataExtension`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Write (`data_extensions_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `createCustomObjectRequestBody`. #### Responses * **201** Indicates that the API accepted the request to create a data extension. Media type: `application/json`. Schema: `getCustomObjectResponseBody`. _Example_ ``` { "id": "36e73253-16a9-ee11-ac6c-0abc489251b9", "name": "facb9d48d7c44486a7b0715ef0b2f7a2", "key": "facb9d48d7c44486a7b0715ef0b2f7a2", "description": "", "isActive": true, "isSendable": true, "sendableCustomObjectField": "SubscriberKey", "sendableSubscriberField": "_SubscriberKey", "isTestable": true, "categoryId": 152631, "ownerId": 712000003, "isObjectDeletable": true, "isFieldAdditionAllowed": true, "isFieldModificationAllowed": true, "createdDate": "2024-01-01T20:26:31.07", "createdById": 712000003, "createdByName": "TestUser", "modifiedDate": "2024-01-01T20:26:31.07", "modifiedById": 712000003, "modifiedByName": "TestUser", "ownerName": "TestUser", "partnerApiObjectTypeId": 310, "partnerApiObjectTypeName": "DataExtension", "rowCount": 100000, "dataRetentionProperties": { "isDeleteAtEndOfRetentionPeriod": false, "isRowBasedRetention": false, "isResetRetentionPeriodOnImport": false }, "fieldCount": 5 } ``` * **400** This response indicates that the API couldn’t create the custom object because there was a problem with the request. For example, the API returns this response when your request references an invalid category ID. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "A valid categoryId must be provided", "errorcode": 10005, "documentation": "" } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### GET Retrieves information about the specified data extension by providing its ID. `GET /data/v1/customobjects/{id}` Operation ID: `getDataExtension`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Read (`data_extensions_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Responses * **200** This response indicates that the API accepted the request to retrieve a list of custom objects. Media type: `application/json`. Schema: `getCustomObjectResponseBody`. _Example: same as POST /data/v1/customobjects 201 response._ * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### DELETE Deletes a data extension. `DELETE /data/v1/customobjects/{id}` Operation ID: `deleteDataExtension`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Write (`data_extensions_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Responses * **200** Indicates that the API accepted the request to delete the data extension. The response doesn’t contain any additional information. * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### PATCH Update the fields in a data extension. `PATCH /data/v1/customobjects/{id}` Operation ID: `updateDataExtension`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Write (`data_extensions_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Request body (required) Media type: `application/json`. Schema: `createCustomObjectRequestBody`. #### Responses * **200** Indicates that the API accepted the request to update a data extension. Media type: `application/json`. Schema: `getCustomObjectResponseBody`. _Example: same as POST /data/v1/customobjects 201 response._ * **400** This response indicates that the API couldn’t create the custom object because there was a problem with the request. For example, the API returns this response when your request references an invalid category ID. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "A valid categoryId must be provided", "errorcode": 10005, "documentation": "" } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` ### POST Deletes all of the data in a data extension. `POST /data/v1/customobjects/{id}/cleardata` Operation ID: `clearDataExtensionData`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Write (`data_extensions_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Responses * **200** Indicates that the API accepted the request to remove all of the data in the data extension. The response doesn’t contain any additional information. * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "There was no Custom Object found", "errorcode": 30003, "documentation": "" } ``` ### GET Retrieves a list of fields in a data extension. `GET /data/v1/customobjects/{id}/fields` Operation ID: `getDataExtensionFields`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Read (`data_extensions_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Responses * **200** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `getCustomObjectFieldsResponseBody`. _Example_ ``` { "id": "f9e59b85-f353-ee11-ba4e-d4f5ef3d54c9", "fields": [ { "name": "MemberId", "id": "fd526c4d-d5c5-4601-9849-53839857960c", "type": "Number", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 0, "isNullable": false, "isPrimaryKey": true, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "FirstName", "id": "67180103-7235-41c9-ad59-8b18a76a02d5", "type": "Text", "maskType": "None", "storageType": "Plain", "length": 50, "description": "", "ordinal": 1, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "Surname", "id": "54d4fd6a-2a00-4439-9162-e08569d6feb6", "type": "Text", "maskType": "None", "storageType": "Plain", "length": 50, "description": "", "ordinal": 2, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "RewardsPoints", "id": "98023ae7-e04f-4d19-9a5c-a0bace805f87", "type": "Number", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 3, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "RewardsTier", "id": "39126457-a060-4eef-a37c-cd23fc5a8c9d", "type": "Number", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 4, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "Area", "id": "b0de5f86-6602-4937-904e-07c63d7fb0e8", "type": "Text", "maskType": "None", "storageType": "Plain", "length": 50, "description": "", "ordinal": 5, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": false, "isOverridable": false, "isHidden": false, "isReadOnly": false, "mustOverride": false } ], "fieldCount": 6 } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### GET Retrieves a list of data extensions based on the ID of the parent category. `GET /data/v1/customobjects/category/{categoryId}` Operation ID: `getDataExtensionsByCategoryId`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Read (`data_extensions_read`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `categoryId` (path, string, required) The ID of the data extension folder. #### Responses * **200** This response indicates that the API accepted the request to retrieve a list of custom objects. Media type: `application/json`. Schema: `getCustomObjectsResponseBody`. _Example: same as GET /data/v1/customobjects 200 response._ * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 404, "message": "Not Found" } ``` ### POST Inserts a new field into a data extension. `POST /data/v1/customobjectsasync/{id}/fields` Operation ID: `createDataExtensionField`. ### Required Scopes To retrieve data extensions in your account, your API user must have this permission: * Data | Data Extensions | Write (`data_extensions_write`) #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Request body (required) Media type: `application/json`. Schema: `customObjectsFieldObject`. #### Responses * **202** Indicates that the API accepted the request to insert a field into a data extension. The response includes the request ID. Media type: `text/plain`. Schema: `string`. Type: `string`. _Example_ ``` c90b71a2-660e-4f70-b017-40d22c3d5f3b ``` * **400** This response indicates that the API couldn’t create the custom object because there was a problem with the request. For example, the API returns this response when your request references an invalid category ID. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "A valid categoryId must be provided", "errorcode": 10005, "documentation": "" } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "There was no Custom Object found", "errorcode": 30003, "documentation": "" } ``` ### PATCH Updates a field in a data extension. `PATCH /data/v1/customobjectsasync/{id}/fields` Operation ID: `updateDataExtensionField`. Required Permission Scope To execute this operation, you must have the `Data Extensions | Write` permission. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to the Marketing Cloud Engagement API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `id` (path, string, required) The unique ID of the data extension. #### Request body (required) Media type: `application/json`. Schema: `updateCustomObjectFieldRequestBody`. #### Responses * **202** Indicates that the API accepted the request to insert a field into a data extension. The response includes the request ID. Media type: `text/plain`. Schema: `string`. Type: `string`. _Example_ ``` c90b71a2-660e-4f70-b017-40d22c3d5f3b ``` * **400** This response indicates that the API couldn’t create the custom object because there was a problem with the request. For example, the API returns this response when your request references an invalid category ID. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "A valid categoryId must be provided", "errorcode": 10005, "documentation": "" } ``` * **401** Indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn’t authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "There was no Custom Object found", "errorcode": 30003, "documentation": "" } ``` ## Schemas ### getCustomObjectsResponseBody * `count` (_number (integer)_) The total number of custom objects that match the search string. * `page` (_number (integer)_) The current page of results. Each page includes the number of records specified by the `$pagesize` parameter in the request. You can retrieve additional pages by incrementing this number in subsequent calls. * `pageSize` (_number (integer)_) The maximum number of results returned in a page of results. * `links` (_object_) * `items` (_array of customObjectDetailsObject_) An array that contains details of the custom objects that matched the search string. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### createCustomObjectRequestBody * `name` (_string_) The name of the custom object. * `key` (_string_) A unique key for the custom object. * `description` (_string_) A description of the custom object. * `isActive` (_boolean_) Indicates whether the custom object is active. If the value of this property is `true`, then the custom object is active. * `isSendable` (_boolean_) Indicates whether the custom object can be used to send messages. If the value of this property is `true`, then the custom object is sendable. * `sendableCustomObjectField` (_string_) * `sendableSubscriberField` (_string_) * `isTestable` (_boolean_) Indicates whether the custom object can be used to send test messages. If the value of this property is `true`, then the custom object can be used for testing. * `categoryId` (_number (integer)_) The ID of the category that the custom object belongs to. * `isObjectDeletable` (_boolean_) Indicates whether the object can be deleted. If the value of this property is `true`, then the object is deletable. * `isFieldAdditionAllowed` (_boolean_) * `isFieldModificationAllowed` (_boolean_) * `dataRetentionProperties` (_object_) An object that describes the data retention policy that applies to the object. * `isDeleteAtEndOfRetentionPeriod` (_boolean_) Indicates whether data in the object is deleted when the end of the retention period is reached. If the value of this property is `true`, data is deleted at the end of the retention period. * `isRowBasedRetention` (_boolean_) Indicates whether the custom object includes row-based data retention policies. If the value of this property is `true`, the object includes row-based retention policies. * `isResetRetentionPeriodOnImport` (_boolean_) Indicates whether the retention period is reset when data is imported into the custom object. If the value of this property is `true`, then the retention period is reset during an import. * `fields` (_array of customObjectsFieldObject_) An array that contains details of each field in the data extension. _Example_ ``` { "name": "mynewde", "key": "mynewde", "description": "", "isActive": true, "isSendable": true, "sendableCustomObjectField": "SubscriberKey", "sendableSubscriberField": "_SubscriberKey", "isTestable": true, "categoryId": 1760804, "isObjectDeletable": true, "isFieldAdditionAllowed": true, "isFieldModificationAllowed": true, "dataRetentionProperties": { "isDeleteAtEndOfRetentionPeriod": false, "isRowBasedRetention": false, "isResetRetentionPeriodOnImport": false, "rowBasedThreshold": 500000000 }, "fields": [ { "name": "SubscriberKey", "type": "Text", "maskType": "None", "storageType": "Plain", "length": 50, "description": "", "ordinal": 0, "isNullable": false, "isPrimaryKey": true, "isTemplateField": false, "isInheritable": true, "isOverridable": true, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "Name", "type": "Text", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 1, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": true, "isOverridable": true, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "EmailAddress", "type": "EmailAddress", "maskType": "None", "storageType": "Plain", "length": 254, "description": "", "ordinal": 2, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": true, "isOverridable": true, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "ContactID", "type": "Number", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 3, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": true, "isOverridable": true, "isHidden": false, "isReadOnly": false, "mustOverride": false }, { "name": "ContactKey", "type": "Text", "maskType": "None", "storageType": "Plain", "description": "", "ordinal": 4, "isNullable": true, "isPrimaryKey": false, "isTemplateField": false, "isInheritable": true, "isOverridable": true, "isHidden": false, "isReadOnly": false, "mustOverride": false } ] } ``` ### getCustomObjectResponseBody ### getCustomObjectFieldsResponseBody * `id` (_string_) The unique ID of the data extension field. * `fields` (_array of customObjectsFieldObject_) An array that contains details of each field in the data extension. ### customObjectsFieldObject * `name` (_string_) The name of the data extension field. * `id` (_string_) The unique ID of the data extension field. * `type` (_string_) The data type of the field. * `maskType` (_string_) * `storageType` (_string_) * `length` (_number (integer)_) For text fields, the maximum number of characters that the field can contain. * `description` (_string_) A description of the field. * `isNullable` (_boolean_) Indicates whether the field can contain a null value. If the value of this property is `true`, the field can contain null values. * `isPrimaryKey` (_boolean_) Indicates whether the field is a primary key. If the value of this property is `true`, the field is a primary key. * `isTemplateField` (_boolean_) Indicates whether the field is used in a template. If the value of this property is `true`, the field is a template field. * `isInheritable` (_boolean_) * `isOverridable` (_boolean_) Indicates whether the field can be overridden. If the value of this property is `true`, the field can be overridden. * `isHidden` (_boolean_) Indicates whether the field is hidden. If the value of this property is `true`, the field is hidden. * `isReadOnly` (_boolean_) Indicates whether the field is read-only. If the value of this property is `true`, the field is read-only. * `mustOverride` (_boolean_) _Example_ ``` { "fields": [ { "description": "The mobile phone number of the contact.", "isActive": true, "isHidden": false, "isInheritable": false, "isNullable": true, "isOverridable": false, "isPrimaryKey": false, "isReadOnly": false, "isTemplateField": false, "length": 50, "maskType": "None", "mustOverride": false, "name": "PhoneNumber", "storageType": "Plain", "type": "Text" } ] } ``` ### updateCustomObjectFieldRequestBody * `name` (_string_) The name of the data extension field. * `id` (_string_) The ID of the data extension field to update. * `type` (_string_) The data type of the field. * `maskType` (_string_) * `storageType` (_string_) * `length` (_number (integer)_) For text fields, the maximum number of characters that the field can contain. * `description` (_string_) A description of the field. * `isNullable` (_boolean_) Indicates whether the field can contain a null value. If the value of this property is `true`, the field can contain null values. * `isPrimaryKey` (_boolean_) Indicates whether the field is a primary key. If the value of this property is `true`, the field is a primary key. * `isTemplateField` (_boolean_) Indicates whether the field is used in a template. If the value of this property is `true`, the field is a template field. * `isInheritable` (_boolean_) * `isOverridable` (_boolean_) Indicates whether the field can be overridden. If the value of this property is `true`, the field can be overridden. * `isHidden` (_boolean_) Indicates whether the field is hidden. If the value of this property is `true`, the field is hidden. * `isReadOnly` (_boolean_) Indicates whether the field is read-only. If the value of this property is `true`, the field is read-only. * `mustOverride` (_boolean_) _Example_ ``` { "fields": [ { "id": "b849a568-f729-49f5-9d21-65a4d98311f1", "description": "The mobile phone number of the contact.", "isActive": true, "isHidden": false, "isInheritable": false, "isNullable": true, "isOverridable": false, "isPrimaryKey": false, "isReadOnly": false, "isTemplateField": false, "length": 50, "maskType": "None", "mustOverride": false, "name": "MobileNumber", "storageType": "Plain", "type": "Text" } ] } ``` ### customObjectDetailsObject * `id` (_string_) The unique ID of the custom object. * `name` (_string_) The name of the custom object. * `key` (_string_) A unique key for the custom object. * `description` (_string_) A description of the custom object. * `isActive` (_boolean_) Indicates whether the custom object is active. If the value of this property is `true`, then the custom object is active. * `isSendable` (_boolean_) Indicates whether the custom object can be used to send messages. If the value of this property is `true`, then the custom object is sendable. * `sendableCustomObjectField` (_string_) * `sendableSubscriberField` (_string_) * `isTestable` (_boolean_) Indicates whether the custom object can be used to send test messages. If the value of this property is `true`, then the custom object can be used for testing. * `categoryId` (_number (integer)_) The ID of the category that the custom object belongs to. * `isObjectDeletable` (_boolean_) Indicates whether the object can be deleted. If the value of this property is `true`, then the object is deletable. * `isFieldAdditionAllowed` (_boolean_) * `isFieldModificationAllowed` (_boolean_) * `createdDate` (_string (date-time)_) The date and time when the custom object was created. This property is shown in ISO 8601 format. * `createdById` (_number (integer)_) The unique ID of the user who created the custom object. * `createdByName` (_string_) The name of the user who created the custom object. * `modifiedDate` (_string (date-time)_) The date and time when the custom object was last modified. This property is shown in ISO 8601 format. * `modifiedById` (_number (integer)_) The unique ID of the user who last modified the custom object. * `modifiedByName` (_string_) The name of the user who last modified the custom object. * `ownerId` (_number (integer)_) The unique ID of the user who owns the custom object. * `ownerName` (_string_) The name of the user who owns the custom object. * `partnerApiObjectTypeId` (_number (integer)_) * `partnerApiObjectTypeName` (_string_) * `rowCount` (_number (integer)_) The number of rows in the custom object. * `dataRetentionProperties` (_object_) An object that describes the data retention policy that applies to the object. * `isDeleteAtEndOfRetentionPeriod` (_boolean_) Indicates whether data in the object is deleted when the end of the retention period is reached. If the value of this property is `true`, data is deleted at the end of the retention period. * `isRowBasedRetention` (_boolean_) Indicates whether the custom object includes row-based data retention policies. If the value of this property is `true`, the object includes row-based retention policies. * `isResetRetentionPeriodOnImport` (_boolean_) Indicates whether the retention period is reset when data is imported into the custom object. If the value of this property is `true`, then the retention period is reset during an import. * `fieldCount` (_number (integer)_) The number of fields in the custom object. # Data Sources in Marketing Cloud Next In Marketing Cloud Next, you can use several sources of data to create your messages. Each of these sources operates differently. ## Custom Data Sources Custom data sources are data sources that you create yourself. For more information about creating a data source, see _Salesforce Help_: [Data Source Configuration in Data 360](https://help.salesforce.com/s/articleView?id=data.c360_a_connection_tasks.htm). | Data Source Type | Description | Limitations | | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | | Profile Data Graph | Data provided from a data graph based on the Unified Individual object. This type of data source is helpful for storing personalization data. | Your account can use only one data graph at a time. | | Activation | Data provided from an Activation set up in Data 360. This type of data source provides an Activation payload, which can be used for personalization. | A message can use only one event or activation data source at a time. | | Event | Data provided from an event definition in Marketing Cloud Next. A flow passes event data to the content. Each event has its own schema. | A message can use only one event or activation data source at a time. | | Apex Class | Data provided from an Apex-defined resource and its schema. | A message can use only one Apex Class data source at a time. | ### Profile Data Graph One of the primary data sources in Marketing Cloud Next is the data graph. For more information, see [Understanding Data Graphs in Marketing Cloud Next](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/guide/mcn-handlebars-guide-data-graph-understanding.md). ### Activation An alternative to building a message by using data from a data graph is to use activation data. Activations occur when a segmentation action occurs in Data 360, which creates an enriched list of recipients for a campaign with nested attributes for each recipient. This example shows an activation payload for a recipient. ```json { "TitleName": "", "PersonName": "Erica Douglass", "FirstName": "Erica", "Id": "7471ce0c3b44998ffb8342eabdf2c02b", "LastName": "Douglass", "EmailAddress": "erica.douglass@example.com", "BookStoreProfile": [ { "LoyaltyTier": "Bronze", "RewardPoints": 80.0, "Locale": "de-DE", "MemberId": "003Ws00000QxpYzIAJ", "FavoriteGenre": "Fantasy", "LastVisitedStoreId": "2121", "BookStore": [ { "StoreHoursDays": "Mon - Sun", "StoreHoursTime": "8am - 8pm", "StoreId": "2121", "StoreAddress": "331 Town Square Drive, Decatur GA, 30012", "StoreName": "RL at Town Square", "BookStoreEvent": [ { "EventDate": "2026-07-15T20:00:00.000Z", "EventDescription": "Monthly book club for young adults", "EventName": "Young Adult Book Club" }, { "EventDate": "2026-07-20T19:00:00.000Z", "EventDescription": "Lively storytelling for the little ones!", "EventName": "Weekly Storytime" }, { "EventDate": "2026-07-22T20:00:00.000Z", "EventDescription": "Guest visit from an author", "EventName": "Monthly Author Visit" } ] } ] } ] } ``` You give the activation a name when you create it. This example uses the name `NewsletterRecipient`. Access the data by using the name that you gave the activation, followed by the path to the data you want to access. For example, to output the recipient's first name, use this code: ```handlebars {{NewsletterRecipient.FirstName}} ``` **important:** The same message can’t have both an activation data source and an event data source. ### Event Events are a type of data source that binds data to an automation event-triggered flow. When you create a data source from the event list, you can select from several built-in and custom event options. Each event has a schema that ties back to the underlying engagement data model object (DMO) that drives the event itself. Similar to an activation, use the name you give the event to reference it in your message template. **important:** The same message can’t have both an activation data source and an event data source. ### Apex Class Apex-defined data sources use an Apex class that represents an incoming JSON payload. This data source defines an incoming JSON structure. See _Salesforce Help_: [Create Apex-Defined Type](https://help.salesforce.com/s/articleView?language=en_US&id=platform.flow_concepts_apex_type.htm). In transactional emails, it’s helpful for the incoming data to be simple and easy to use. You can use an Apex class to define the structure of the JSON payload, as shown in this example. ```java public class BookingConfirmationPayload { @AuraEnabled public String IndividualId; @AuraEnabled public String ReservationID; @AuraEnabled public String FirstName; @AuraEnabled public String LastName; @AuraEnabled public String HotelName; @AuraEnabled public String HotelAddress; @AuraEnabled public String HotelPhone; @AuraEnabled public Date CheckInDate; @AuraEnabled public Date CheckOutDate; @AuraEnabled public String RoomType; @AuraEnabled public Number GuestCount; } ``` This class definition produces a JSON payload with a structure that resembles this example. ```json { "Booking": { "IndividualId": "003Ws00000QxiFnIAJ", "ReservationID": "0023AB", "FirstName": "Erica", "LastName": "Douglass", "HotelName": "The Hornet of Chicago", "HotelAddress": "320 N Dearborn St, Chicago, IL 60660", "HotelPhone": "(312) 555-7200", "CheckInDate": "2026-02-06", "CheckOutDate": "2026-02-09", "RoomType": "Traditional Guest Room", "GuestCount": "1" } } ``` When you load this data source into a content item, you give it a name, such as `Booking`. Reference the fields in the payload by using the name that you gave the data source, followed by the path to the data you want to access. For example, to output the recipient’s first name, use this code: ```handlebars {{Booking.FirstName}} ``` ## Built-in Data Sources Marketing Cloud Next includes a few built-in data sources, which have specific reserved names. | Data Source | Description | | -------------------------------- | ------------------------------------------------------------------- | | `{!$organization.Address}` | The physical address of the organization that is sending the email. | | `{!$link.EmailAddressOptOutUrl}` | The URL for the recipient to unsubscribe from the email. | | `{!$link.PreferenceCenterUrl}` | The URL for the recipient to manage their email preferences. | ## Other Data Sources You can connect several other data sources to your content. For more information about other data sources, see _Salesforce Help_: [Data Sources in Marketing Cloud Next](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_personalization_data_sources.htm). # Data Structures in AMPscript There are two types of data structures that you interact with when using AMPscript: data extensions and rowsets. These structures are closely related. ## Data Extensions At the most basic level, a data extension is a table that contains data. A data extension can stand alone or can be related to other data extensions. You can manually import data extensions into Marketing Cloud Engagement, or you can automate the import through Automation Studio or the Marketing Cloud Engagement API. ## Rowsets A rowset contains one or more collections of data as rows. You can obtain rowsets by querying data extensions using AMPscript functions, such as `LookupRows()`. You can also create rowsets as needed (for example, by using the `BuildRowSetFromJSON()` function). You can refer to an individual row in a rowset by using the `Row()` function. You can refer to an individual piece of data within a row by using the `Field()` function. AMPscript doesn’t allow you to output the contents of a rowset or row using functions such as `v()`. To prevent errors and unexpected issues, we recommend that you check to see if a rowset contains data before processing it in a `For` loop. The most common way to perform this check is by using the `RowCount()` function to determine how many rows the rowset contains. You can use the row count in the condition statement in the `For` loop. Alternatively, you can use the `Empty()` and `IsNull()` functions to determine if the rowset is empty. Both of these functions return `true` if the rowset doesn't contain any data. # DataExtension An object that represents a data extension. ## Required Permission Scopes To clear data from a `DataExtension` object using the [perform](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/perform.md) method, you must have the `Email | Subscribers | Data Extension | Clear Data` permission. Also, your account type must be Enterprise 2.0 (E2.0) or Business Unit (BU), or you must have the role-based access control business rule. If you don't own the data extension, you can't clear its data. If your account uses data extension retention policies, you must have the `Data Extension | Manage Data Extension Retention` permission to create or update a `DataExtension` object that has data retention properties. The data retention properties are `DataRetentionPeriod`, `DataRetentionPeriodLength`, `DataRetentionPeriodUnitOfMeasure`, `RowBasedRetention`, `ResetRetentionPeriodOnImport`, `DeleteAtEndOfRetentionPeriod`, and `RetainUntil`. ## Properties | Name | Data Type | Description | | ---------------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CategoryID` | Int64 | The ID of the folder that contains the data extension. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DataRetentionPeriod` | [DateTimeUnitOfMeasure](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/datetimeunitofmeasure.md) object | The units for the data extension retention period. Accepted values are `Days`, `Weeks`, `Months`, and `Years`. | | `DataRetentionPeriodLength` | Int32 | The number of time units data is retained for. Use this property together with `DataRetentionPeriodUnitOfMeasure` to specify the data retention period. | | `DataRetentionPeriodUnitOfMeasure` | Int32 | Deprecated. Use `DataRetentionPeriodLength` and `DataRetentionPeriod` instead. | | `DeleteAtEndOfRetentionPeriod` | Boolean | Indicates whether data is deleted at the end of the retention period. If the value is `true` the application deletes the entire data extension. If the value is `false`, the application deletes the data within the data extension but retains the data extension itself. | | `Description` | String | Describes and provides information regarding the object. | | `Fields` | Array of [DataExtensionField](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionfield.md) objects | An object that specifies the fields contained in the data extension. | | `ID` | Int32 | Read-only identifier for an object. Some objects use the `ObjectID` property as a unique ID. | | `IsSendable` | Boolean | Indicates whether you can use a data extension as part of an audience for a message send. | | `IsTestable` | Boolean | Indicates whether a sendable data extension can be used in test sends. | | `ModifiedDate` | DateTime | The date and time when the data extension was last modified. | | `Name` | String | The name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `ResetRetentionPeriodOnImport` | Boolean | Indicates whether a data retention period is reset after a successful import of new data. A value of true indicates that the data retention period resets to the beginning upon completion of a successful data import. A value of false indicates that the data retention period continues from the original starting point. | | `RetainUntil` | String | The end date for the retention period of the data extension. Verify that the value passed to this property is correctly formatted based on the Date Format setting of the API user. | | `RowBasedRetention` | Boolean | Indicates whether the data retention policy removes data by row or deletes all data in an entire data extension. If the value is `true`, individual rows are removed from the data extension when the retention period expires. If the value is `false`, the entire data extension is deleted when the retention period expires. | | `SendableDataExtensionField` | [DataExtensionField](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionfield.md) object | The field in a sendable data extension to use as an address in a send. Accepted values are `SubscriberID`, `CustomerKey`, or `EmailAddress`. Marketing Cloud Engagement uses this field to create a relationship between the value specified by the `SendableSubscriberField` property and a value in a sendable data extension. | | `SendableSubscriberField` | [Attribute](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/attribute.md) object | The field to use as the sending address. Marketing Cloud Engagement uses this field to establish a relationship between a subscriber field and a value specified by the `SendableDataExtensionField` property. Accepted values are `SubscriberID`, `CustomerKey`, and `EmailAddress`. | | `Status` | String | The status of the data extension object. | | `Template` | [DataExtensionTemplate](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensiontemplate.md) object | The template used to create the data extension. | **note:** The `DataExtensionObject` object doesn’t support `LIKE` operators in filters for the retrieve method. ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Add Column to a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_new_column_to_an_existing_data_extension.md) - [Create a Data Extension Using an Existing Template](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extension_using_an_existing_template.md) - [Create a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extension_using_web_service_api.md) # DataExtensionCreateResult The DataExtensionCreateResult object provides error messages related to an attempt to create a data extension. The object provides one error message for every error in the process, as opposed to just the first error encountered. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | -------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `CreateResults` | Array of [CreateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult.md) objects | Not used. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `ErrorMessage` | String | Contains a human-readable detailed message that provides more information about an error. For example, this string can contain an error message when the specified row wasn’t be found in a data extension. | | `KeyErrors` | Array of [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) objects | Specifies errors associated with primary keys during operations involving data extensions. For example, this array can contain errors related to using the wrong characters in a field. | | `NewID` | Int | System identifier for new object. The API returns this property after creating a new object. | | `NewObjectID` | String | System identifier for new object. The application provides this ID after a new object is created. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `ParentPropertyName` | String | Identifies parent node of property; populated in nested Create results. Deprecated. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | | `ValueErrors` | Array of [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) objects | Specifies errors associated with field values during operations involving data extensions. This property includes errors involving field values, such as using the wrong characters in the field. | ## Related Items - [Create method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create.md) - [DataExtension object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextension.md) # DataExtensionDeleteResult An object that provides error messages related to an attempt to delete information in a data extension. Only primary key errors use this object to return information. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `ErrorMessage` | String | Contains a human-readable detailed message that provides more information about the error. For example, this string can contain an error message when the specified row wasn’t be found in a data extension. | | `KeyErrors` | Array of [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) objects | Specifies errors associated with primary keys during operations involving data extensions. For example, this array can contain errors related to using the wrong characters in a field. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | ## Related Items - [Delete method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md) - [DataExtension object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextension.md) # DataExtensionError An object that specifies error messages related to creating or updating data extensions or their fields. ## Properties | Name | Data Type | Description | | -------------- | --------- | -------------------------------------------------------------- | | `ErrorCode` | String | A numeric code that indicates the type of error that occurred. | | `ErrorMessage` | String | A message that provides information about the error. | | `Name` | String | The name of the object or property. | # DataExtensionField An object that represents a field in a data extension. ## Properties | Name | Data Type | Description | | ---------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AttributeMaps` | Array of [AttributeMap](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/attributemap.md) objects | Not used. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type, which corresponds to the external key assigned to an object. | | `DataExtension` | [DataExtension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextension.md) object | Specifies the data extension. | | `DataType` | String | This has been deprecated. Use ValueType. (PropertyDefinition) The data type of the parameter that is passed to the Data Extract, which can be used to dynamically build a user interface with some basic data validation. (ExtractParameterDescription). | | `DefaultValue` | String | The default value for a data extension field if no value is supplied (Include Now() as the default value if you wish to have a field default to today's date). Used by ExtractParameterDescription as the default value for the parameter if not suppliedwhen a data extract is executed. Used by PropertyDefinition if the default value for the attribute if not suppliedfor a data profile attribute. | | `Description` | String | Describes and provides information regarding the object. | | `DisplayOrder` | Int | Specifies the position in which the attribute appears on the Subscriber Profile Center page. | | `FieldType` | [DataExtensionFieldType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionfieldtype.md) object | Designates data type for a data extension field. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsAccountProperty` | Boolean | Indicates whether the property is specific to the account. | | `IsContextSpecific` | Boolean | Not used. | | `IsCreatable` | Boolean | Indicates if the PropertyDefinition, ObjectDefinition, or DataExtensionField can be set on a Create call. A value of true indicates it is creatable. | | `IsEditable` | Boolean | Indicates if the property is editable by the end-user in the profile center. | | `IsFilterable` | Boolean | Indicates if you can filter on this property. Set to true to specify the property in a SimpleFilterPart in a Retrieve call. | | `IsNillable` | Boolean | Indicates whether the property can contain a NULL value. | | `IsPartnerProperty` | Boolean | Indicates if the property is specific to a partner. | | `IsPrimaryKey` | Boolean | Designates whether a data extension field is used as a primary key for that data extension. | | `IsQueryable` | Boolean | Indicates whether the property is queryable. | | `IsRequired` | Boolean | Indicates whether the property must have a value specified. Create calls must include a supplied value, while Update and Delete calls don't require a value. | | `IsRestrictedPicklist` | Boolean | Indicates whetherthe property has a restricted list of valid values. | | `IsRetrievable` | Boolean | Indicates if object data is retrievable. | | `IsSendTime` | Boolean | Indicates whether the property is a send time attribute. | | `IsUpdatable` | Boolean | Indicates whether object is updatable. | | `IsViewable` | Boolean | Indicates whether the property is viewable by the end-user in the profile center. | | `Label` | String | Name or text that is displayed next to the field. | | `Markups` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Deprecated. | | `MaxLength` | Int | Maximum length of the data. | | `MaxValue` | String | Specifies the maximum value to set this property to. | | `MinLength` | Int | Specifies the minimum length of the data. | | `MinValue` | String | Specifies the minimum value to set this property to. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Ordinal` | Int | Indicates position of object within an array. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerMap` | String | Deprecated. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `PicklistItems` | Array of [PicklistItem](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/picklistitem.md) objects | Represents a list of the valid values for the property. | | `Precision` | Int | Defines numeric precision for decimal properties. | | `PropertyType` | [PropertyType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/propertytype.md) object | Indicates the data type of the property. | | `References` | Array of [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) objects | Indicates the object types of the referenced objects. Not used. | | `RelationshipName` | String | Indicates the name of the relationship, such as One-to-One, One-to-Many. | | `Scale` | Int | Indicates numeric precision for decimal properties. | | `Status` | String | Defines status of object. Status of an address. | | `StorageType` | DataExtensionFieldStorageType | Indicates special storage properties for the field. Valid values are: Unspecified, Plain, Encrypted, or Obfuscated. | | `ValueType` | [SoapType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soaptype.md) object | ValueType indicates the actual data type of the value that is stored in this property. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # DataExtensionFieldType The data types that are assignable to columns in a data extension. ## Values | Name | Description | | -------------- | ------------------------------------------------------------------ | | `Boolean` | Indicates that the data extension field contains a boolean value. | | `Date` | Indicates that the data extension field contains a date. | | `Decimal` | Indicates that the data extension field contains a decimal number. | | `EmailAddress` | Indicates that the data extension field contains an email address. | | `Locale` | Indicates that the data extension field contains a locale code. | | `Number` | Indicates that the data extension field contains an integer value. | | `Phone` | Indicates that the data extension field contains a phone number. | | `Text` | Indicates that the data extension field contains a string of text. | ## Related Items - [DataExtensionField](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionfield.md) # DataExtensionObject An object that represents a row in a data extension. To modify a `DataExtensionObject` object, you need the **Email | Subscribers | Data Extension | Manage Data** permission. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `Keys` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Indicates keys used in a data extension. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. If your call doesn't include an ObjectID or CustomerKey, you can use Name to look up the target data extension. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Properties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Specifies an array of property definitions available for an object type. You can retrieve allowed properties using the Describe method. | | `Type` | String | Indicates type of specific list. Valid values include Public, Private, Salesforce, GlobalUnsubscribe, and Master. Indicates the type of email to send to the address. Valid values include Text and HTML. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Add Data to a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/adding_data_to_data_extension_object.md) - [Delete a Row from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_row_from_a_data_extension_via_the_web_service_api.md) - [Retrieve Data from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_data_from_a_data_extension.md) - [Retrieve a Data Extension Using Customer Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_dataextension_object.md) # DataExtensionRowCount() Returns the number of rows in a data extension. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DataExtensionRowCount(dataExtensionName) ``` The `DataExtensionRowCount()` has one parameter: - `dataExtensionName` (string): Required. The name of the data extension to find the row count of. ## Usage This example uses a data extension called "MembershipRewardsProgramme," which contains the data in this table. | MemberId | FirstName | Surname | RewardsPoints | RewardsTier | Area | | -------- | --------- | ---------- | ------------- | ----------- | ----------- | | 1 | Dennis | Smithers | 92374 | 2 | Chelsea | | 2 | Pooja | Chatterjee | 201042 | 1 | Hammersmith | | 3 | Tomás | Santos | 69311 | 3 | Kensington | | 4 | Sun-Hi | Kim | 23999 | 4 | Twickenham | | 5 | Jian | Yeh | 15123 | 4 | Chelsea | To use the function, pass it the name of the data extension. ``` %%[ Var @deRows Set @deRows = DataExtensionRowCount("MembershipRewardsProgramme") Output(v(@deRows)) ]%% ``` The function returns the number of rows in the specified data extension, `5`. # DataExtensionTemplate An object that represents a data extension template. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # DataExtensionUpdateResult An object that provides error messages related to a request to update a data extension. The object provides one error message for every error in the process. This object is a response structure and isn’t queryable. ## Properties | Name | Data Type | Description | | -------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `ErrorMessage` | String | Contains a human-readable detailed message that provides more information about the error. For example, this string can contain an error message when the specified row wasn’t be found in a data extension. | | `KeyErrors` | Array of [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) objects | Specifies errors associated with primary keys during operations involving data extensions. For example, this array can contain errors related to using the wrong characters in a field. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `ParentPropertyName` | String | Identifies parent node of property; populated in nested Create results. Deprecated. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | | `UpdateResults` | Array of [UpdateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updateresult.md) objects | Indicates error information associated with an update to a data extension. | | `ValueErrors` | Array of [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) objects | Specifies errors associated with field values during operations involving data extensions. This property includes errors involving field values, such as using the wrong characters in the field. | ## Related Items - [DataExtensionError](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextensionerror.md) - [UpdateResult](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updateresult.md) # DataExtractActivity Defines the configuration of a data extract activity in Automation Studio. To start a DataExtractActivity using the perform method, you need the **Email | Interactions | Activities | Data Extract | Start** permission. ## Properties | Name | Data Type | Description | | --------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `Keyword` | String | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # DataFolder An object that represents a folder. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `AllowChildren` | Boolean | Specifies whether a data folder can have child data folders. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ContentType` | String | Defines the type of content contained within a folder. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsActive` | Boolean | Specifies whether the object is active. | | `IsEditable` | Boolean | Indicates if the property can be edited by the end-user in the profile center. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `ParentFolder` | [DataFolder](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/datafolder.md) object | Specifies the parent folder for a data folder. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Content Types for Child Folders Use these content types when creating child folders for existing entities within your account. The Type column corresponds to the ContentType property for the DataFolder object. | Entity | Type | | ---------------------------------- | ------------------------------------ | | AB test | `ABTest` | | Asset | `asset` | | simple automated emails | `automated_email` | | Automations | `automations` | | Build audience activity | `BuildAudienceActivity` | | Campaign | `campaign` | | Condensed preview | `condensedlpview` | | my contents | `content` | | Contextual suppression list | `contextual_suppression_list` | | Data extensions | `dataextension` | | my documents | `document` | | ELT activity | `ELTactivity` | | my emails | `email` | | Email hidden message model | `email_hidden_messagemodel` | | Filter activities | `filteractivity` | | Data Filters | `filterdefinition` | | Global email | `global_email` | | Global email subscribers | `global_email_sub` | | my groups | `group` | | Hidden | Hidden | | my images | `image` | | my tracking | `job` | | my lists | `list` | | Live content | `livecontent` | | Measures | `measure` | | Portfolio | `media` | | Message | `message` | | Microsites | `microsite` | | Microsite layouts | `micrositelayout` | | my subscribers | `mysubs` | | Organizations | `organization` | | Playbooks | `playbooks` | | Programs | `programs2` | | Publication lists | `publication` | | Query Activity | `queryactivity` | | Salesforce data extension | `salesforcedataextension` | | Salesforce sends | `salesforcesends` | | Salesforce sends v5 | `salesforcesendsv5` | | Shared content | `shared_content` | | Shared contextual suppression list | `shared_contextual_suppression_list` | | Shared data | `shared_data` | | Shared data extensions | `shared_dataextension` | | Shared email messages | `shared_email` | | Shared items | `shared_item` | | Shared portfolios | `shared_portfolio` | | Shared publication lists | `shared_publication` | | Shared Salesforce data extension | `shared_salesforcedataextension` | | Shared suppression lists | `shared_suppression_list` | | Shared surveys | `shared_survey` | | Shared templates | `shared_template` | | SSJS Activity | `ssjsactivity` | | Suppression Lists | `suppression_list` | | my surveys | `survey` | | Synchronized Data Extension | `synchronizeddataextension` | | my templates | `template` | | Triggered sends | `triggered_send` | | Triggered sends Journey Builder | `triggered_send_journeybuilder` | | User-initiated sends | `userinitiatedsends` | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Creating, Retrieving, Updating, and Deleting Folders](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_retrieving_updating_and_deleting_folders.md) # DataSourceTypeEnum The origins of a data source used with send definition lists and audience items. ## Values | Name | Description | | -------------------- | ----------------------------------------------------------------------- | | `CustomObject` | Indicates that the data source originated from a data extension. | | `DomainExclusion` | Indicates that the data source originated from a domain exclusion list. | | `FilterDefinition` | Indicates that the data source originated from a list filter. | | `List` | Indicates that the data source originated from a subscriber list. | | `OptOutList` | Indicates that the data source originated from an unsubscribe list. | | `SalesForceCampaign` | Indicates that the data source originated from a Salesforce campaign. | | `SalesForceReport` | Indicates that the data source originated from a Salesforce report. | ## Related Items - [AudienceItem](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/audienceitem.md) - [SendDefinitionList](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senddefinitionlist.md) - [TriggeredSendExclusionList](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggeredsendexclusionlist.md) # Date and Time Functions Use date- and time-based information in your activities to insert relevant dates or times into messages or pages. You can also insert this information into data extensions for usage later in date- or time-based sends or activities. Use these functions whenever you need to capture or refer to specific dates and times. # Date Time Functions These functions allow access to data and time data information via server-side JavaScript for use in content and send contexts. ## Load Load the core library using this sample code: ``` Platform.Load("core","1"); ``` Use the associated sample code examples as models to construct your own server-side JavaScript code. # DateAdd() Adds a specified time value to a date. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` DateAdd(date, amountToAdd, unitToAdd) ``` The `DateAdd()` function has three parameters: - `date` (date): Required. The date to add a time value to. - `amountToAdd` (number): Required. The time value to add to the date. - `unitToAdd` (string): Required. The unit of the time value being added to the date. Accepted values: `Y` (years), `M` (months), `D` (days), `H` (hours), and `MI` (minutes). ## Usage This example adds one day to the current timestamp. For the purpose of illustration, the example assumes that the current timestamp is 2023-08-05T13:41:23Z. ``` %%[ Var @now, @later Set @now = Now() Set @later = DateAdd(@now, '1','D') ]%%

The date and time one day from now will be %%=v(@later)=%%.

``` The example outputs the timestamp for the specified date. ``` The date and time one day from now will be 8/6/2023 1:41:23 PM. ``` # DateDiff() Returns the difference between two dates or times. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` DateDiff(startDate, endDate, unitOfDifference) ``` The `DateDiff()` function has three parameters. - `startDate` (date): Required. The starting date for the comparison. - `endDate` (date): Required. The end date for the comparison. The function subtracts the `startDate` from the `endDate`. - `unitOfDifference` (string): Required. The unit of time difference to return. Accepted values: `Y` (years), `M` (months), `D` (days), `H` (hours), and `MI` (minutes). ## Usage This example adds one day to the current timestamp, and then uses the `DateDiff()` function to calculate the number of minutes until the new date. The example assumes that the current timestamp is 2024-08-04T13:41:23Z. ``` %%[ Var @now, @later, @diff Set @now = Now() Set @later = DateAdd(@now, '1','D') Set @diff = DateDiff(@now, @later, "MI") ]%%

There are %%=v(@diff)=%% minutes until %%=v(@later)=%%.

``` The function outputs the number of minutes until 1 day from the current date. ``` There are 1440 minutes until 8/5/2024 1:41:23 PM. ``` # DateParse() Returns a formatted date from a date string. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes, with some differences
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Differences Between Marketing Cloud Engagement and Marketing Cloud Next In Marketing Cloud Engagement, this function returns a dateTime object that other functions can reformat. In Marketing Cloud Next, this function returns a string formatted with the `G` standard format. This format uses a combination of a short date value and a long time value. For example, in the `en_US` locale, this function outputs a timestamp that’s similar to this example: `5/15/2026 1:23:45 PM`. Because the output is a string and is formatted based on locale rules, you can’t reliably pass it through other functions that expect a date-time string, such as `FormatDate()`. If your use case requires you to parse and then format a date, use `FormatDate()` instead. ## Syntax ``` DateParse(dateString, boolUseUtc) ``` The `DateParse()` function has two parameters: - `dateString` (string): Required. A string that contains a date or timestamp. - `boolUseUtc` (boolean): If `true`, the function returns the date and time in UTC time. If `false`, the function uses the local time defined by your Business Unit. The default value is `false`. ## Supported Date Formats You can specify a date string in several formats, including: - ISO 8601 timestamp: `2023-08-05T13:41:23-06:00` - ISO 8601 date: `2023-08-05` - US date and time notation: `8/5/2023 1:41 PM` - Long-form notation: `5 August 2023` or `August 5, 2023` - Date and time: `2023-08-05 1:41:23 PM` - Time only: `1:41 PM` - Chinese and Japanese notation: `2023 年 8 月 5 日` - Korean notation: `2023년 8월 5일` The function doesn’t support these formats: - Dates in which the day includes an ordinal suffix, such as `August 5th, 2023` or `5th August 2023`. - Little-endian numeral notation, such as `5/8/2023` to represent the 5th of August, 2023. - Month names in languages other than English, such as `5 août 2023`. - Dates that include any numerals other than Western Arabic numerals, such as `٢٠٢٣/٨/٥`. - Dates based on any calendar system other than the Gregorian calendar, such as `18 Av, 5783` or `18 Muharram, 1445`. ## Usage This example prints the current time in UTC. ``` %%[ Var @now, @nowUtc Set @now = Now() Set @nowUtc = DateParse(@now, true) ]%%

The current UTC time is: %%=v(@nowUtc)=%%.

``` # DatePart() Extracts a date part (such as the day, month, or year) from a date or timestamp string. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` DatePart(dateString, datePart) ``` The `DatePart()` function has two parameters: - `dateString` (string): Required. A string that contains a date or timestamp. - `datePart` (string): Required. The date part that you want to extract from the string. Accepted values: `Y` (years), `M` (months), `D` (days), `H` (hours), and `MI` (minutes). ## Supported Date Formats You can specify a date string in several formats, including: - ISO 8601 timestamp: `2023-08-05T13:41:23-06:00` - ISO 8601 date: `2023-08-05` - US date and time notation: `8/5/2023 1:41 PM` - Long-form notation: `5 August 2023` or `August 5, 2023` - Date and time: `2023-08-05 1:41:23 PM` - Time only: `1:41 PM` - Chinese and Japanese notation: `2023 年 8 月 5 日` - Korean notation: `2023년 8월 5일` The function doesn’t support these formats: - Dates in which the day includes an ordinal suffix, such as `August 5th, 2023` or `5th August 2023`. - Little-endian numeral notation, such as `5/8/2023` to represent the 5th of August, 2023. - Month names in languages other than English, such as `5 août 2023`. - Dates that include any numerals other than Western Arabic numerals, such as `٢٠٢٣/٨/٥`. - Dates based on any calendar system other than the Gregorian calendar, such as `18 Av, 5783` or `18 Muharram, 1445`. ## Usage This example extracts the year from a date string. ``` %%[ Var @date, @year Set @date = "2023 年 8 月 5 日" Set @year = DatePart(@date, "Y") ]%%

The current year is %%=v(@year)=%%.

``` The example outputs the current year: ``` The current year is 2023. ``` # DateTimeUnitOfMeasure An enumeration of the possible units of measure for time values in data extension retention settings. | Name | Description | | -------- | ----------------------------------------------------------------------------------------------- | | `Days` | Indicates that the time value used for data retention of data extensions is measured in days. | | `Months` | Indicates that the time value used for data retention of data extensions is measured in months. | | `Weeks` | Indicates that the time value used for data retention of data extensions is measured in weeks. | | `Years` | Indicates that the time value used for data retention of data extensions is measured in years. | # DayOfWeekEnum The days of the week used when scheduling a recurrence pattern. ## Values | Name | Description | | ----------- | ----------------------------------------------------- | | `Monday` | Indicates that the recurrence happens each Monday. | | `Tuesday` | Indicates that the recurrence happens each Tuesday. | | `Wednesday` | Indicates that the recurrence happens each Wednesday. | | `Thursday` | Indicates that the recurrence happens each Thursday. | | `Friday` | Indicates that the recurrence happens each Friday. | | `Saturday` | Indicates that the recurrence happens each Saturday. | | `Sunday` | Indicates that the recurrence happens each Sunday. | ## Related Items - [MonthlyRecurrence](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/monthlyrecurrence.md) - [YearlyRecurrence](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/yearlyrecurrence.md) # Deactivate ## Overview Deactivates an account user ### Syntax Deactivate() ## Example This sample code initializes a specific account and deactivates that account. ``` var acctUser = AccountUser.Init('myAccountUser', 123456789); var status = acctUser.Deactivate(); ``` You can’t delete an account user via server-side JavaScript. # Decode the JWT You application login page needs to decode the JWT passed to it and leverage the information as needed. You need two pieces of information to decode the JWT: 1. `encodedJWT` = The JWT passed to the page. 2. `secret` = The JWT signing secret key for your application used to decode the endcoded JWT. This value is stored on the installed package. Check out our downloadable SDKs to see coding examples in a variety of languages. Below are examples of just the JWT decoding piece, leveraging external libraries referenced in the Resources section below. ## C# Example of Decoding a JWT ```java using JWT; // install from https://github.com/johnsheehan/jwt using Newtonsoft.Json.Linq; namespace Example { public class ExampleClass { string encodedJWT = "jwttokengoeshere"; string secret = "mysecret"; string decodedJWT = JWT.JsonWebToken.Decode(encodedJWT, secret); JObject parsedJWT = JObject.Parse(decodedJWT); } } ``` ### node.js Example of Decoding a JWT ```javascript var jwt = require("jwt-simple"); // install with: 'npm install jwt-simple' var encodedJWT = "jwttokengoeshere"; var secret = "mysecret"; var decodedJWT = jwt.decode(encodedJWT, secret); ``` ## PHP Example of Decoding a JWT ```php ``` ## Ruby Example of Decoding a JWT ```ruby require "jwt" @encodedJWT = 'jwttokengoeshere'; @secret = 'mysecret'; @decodedJWT = JWT.decode(@encodedJWT.to_s,nil,@secret) ``` ## Related Items - [Single Sign On](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/single-sign-on.md) - [Encoded JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encoded-jwt.md) - [Explanation of Decoded JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/explanation-decoded-jwt.md) # DecryptSymmetric() Decrypts encrypted data using the supplied algorithm and encryption values. Supply either a value or a valid external key for the password, initialization vector (IV), and a salt. You can also use the external keys if you previously created keys in the Key Management section of the Marketing Cloud Engagement web interface. If you haven't created any keys, the function generates a password using the password parameter or stored value, the salt parameter or stored value, and the IV parameter or stored value. If you don't pass or reference an initialization vector, the function uses the password parameter or stored value as the initialization vector. This function treats Salt and IV values either directly provided or looked up by key as hex strings, with each pair of characters representing a single byte in the larger strings. Don't attempt to use these values as a cipher string, because you can’t successfully decrypt those strings using this function. You can wrap the `EncryptSymmetric()` and `DecryptSymmetric()` functions in `Base64Encode()` and `Base64Decode()` functions to view the final string in plain text. You can only use the `EncryptSymmetric()` and `DecryptSymmetric()` AMPscript functions on data contained in Marketing Cloud Engagement. You can't use these functions with third-party encryption and decryption functionality. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DecryptSymmetric(encryptedData, encryptionAlgorithm, passwordExternalKey, passwordValue, saltExternalKey, saltValue, ivExternalKey, ivValue) ``` The `DecryptSymmetric()` function has eight parameters: - `encryptedData` (string): Required. The encrypted data that you want to decrypt. - `encryptionAlgoritm` (string): Required. The algorithm used to encrypt the data. Accepted values: `aes` (AES or Rijndael encryption), `des` (DES), and `tripledes` (Triple DES or Triple DEA). You can specify cipher modes and padding methods for DES and Triple DES algorithms. See [Encryption Algorithm Options](#encryption-algorithm-options) for more information. - `passwordExternalKey` (string): Required. The external key of a password that was created in Key Management. - `passwordValue` (string): Required. The password value. - `saltExternalKey` (string): Required. The external key of a salt in Key Management. - `saltValue` (string): Required. The salt value, represented as an 8-byte hexadecimal string. - `ivExternalKey` (string): Required. The external key of an initialization vector in Key Management. - `ivValue` (string): Required. The initialization vector, represented as a 16-byte hexadecimal string. ## Encryption Algorithm Options You can specify cipher modes for DES and Triple DES algorithms. To specify these options, add a semicolon after the algorithm, followed by `mode=` and the name of the cipher mode. Accepted values for cipher modes are: - `cbc` - Cipher Block Chaining (this cipher is the default) - `cfb` - Cipher Feedback - `ecb` - Electronic Codebook - `ofb` - Output Feedback - `cts` - Ciphertext Stealing You can also include a padding method by adding `padding=` and the name of the padding mode. Accepted values are: - `pkcs7` - PKCS#7/RFC 5652 (this method is the default) - `ansix923` - ANSI X9.23 - `iso10126` - ISO 10126 - `zeros` - Zero padding (all bytes padded with zeroes) - `none` - No padding ## Usage This example sets the @clearData variable to the value of the @endData after the function decrypts that data. This example uses provided values for the password, salt, and IV, and it sets any external key values to the undeclared variable @null. The Salt and IV values provided in this example are hexadecimal string values. The Salt value includes 8 bytes of hex information, and the IV value provides 16 bytes. ``` %%[ Set @clearData=DecryptSymmetric(@encData, /* Data to decrypt */ 'AES', /* Encryption algorithm */ @null, /* Password external key */ 'aardvark', /* Password value */ @null, /* Salt external key */ '0000000000000000', /* Salt value */ @null, /* IV external key */ '00000000000000000000000000000000' /* IV value */ ) ]%% ``` This example uses external keys instead of provided values: ``` %%[ Set @clearData = DecryptSymmetric(@encData, 'AES', @passwordExternalKey, @null, @saltExternalKey, @null, @IVExternalKey, @null ) ]%% ``` ## See Also - [EncryptSymmetric()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-encrypt-symmetric.md) - [Key Management in Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_key_management.htm) # Define a Custom Split Activity with Multiple Outcomes You can provide multiple possible outcomes for your custom split activities in Journey Builder. First, define default outcomes in the activity's config.json. The activity's custom javascript then overrides these default outcomes programmatically, or based on user-supplied values. **note:** Use the `RestDecision` activity type when configuring multiple outcomes. ![Decision tree of outcomes for Buy, Sell, and Custom Label, respectively: Send SMS, Update Contact, or Custom Activity, each with 1 day turnaround.](https://developer.salesforce.com/docs/media/images/jb-custom-split.gif) ## Define Default Outcomes To define default outcomes, include an `outcomes` object in the activity's config.json. - Each default outcome must contain an `arguments` object that contains a `branchResult` field. Journey Builder expects the custom activity's Execute REST call response to contain the `{ branchResult: value }` object. The `value` matches the branchResult of one of the activity's outcomes. - Give the custom activity a label in the UI. Include a `label` field in the outcome's `metaData` object. Journey Builder displays the text in this field when users hover over the branch entry point. **note:** If you don't define a label, it is loaded using the internationalization (i18n) strings from the config.json. ## Sample ```json "outcomes": [ { "arguments": { "branchResult": "buy_item", "some argument": "passed from config.json for buy_item" } }, { "arguments": { "branchResult": "sell_item", "some argument": "passed from config.json for sell_item" } }, { "arguments": { "branchResult": "hold_item", "some argument": "passed from config.json for hold_item" }, "metaData": { "label": "MyCustomLabel" } } ] ``` ## Related Items - [Internationalize Branch Labels](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/internationalize-branch-labels.md) # Definition.Add ## Overview Add a send definition ### Syntax Definition.Add(1, 2, 3, 4) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | -------------------------------------------------------- | | **1** | string | **Required** | Customer key, name, and subject line for send definition | | **2** | string | **Required** | Customer key for related send classification | | **3** | string | **Required** | Customer key for email used in send definition | | **4** | array | **Required** | Array of associated list IDs | ## Examples This sample code adds the send definition. ``` var esdParams = { "CustomerKey" : "example_esd", "Name" : "Example Send Definition", "EmailSubject" : "Sent By Example Send Definition" }; Send.Definition.Add(esdParams, 'example_sc_key', 'example_email_key', [ 12345, 12346 ]); ``` # Definition.AddWithDE ## Overview Add a send definition that incorporates a sendable data extension ### Syntax Definition.AddWithDE(1, 2, 3, 4, 5) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------------------------------- | | **1** | string | **Required** | Customer key, name, and subject line for send definition | | **2** | string | **Required** | Customer key for related send classification | | **3** | string | **Required** | Customer key for email used in send definition | | **4** | string | **Required** | Customer key of sendable data extension used in send definition | | **5** | string | **Required** | Customer key of publication list to use with send definition | ## Examples This sample code adds the send definition with the applicable sendable data extension: ``` var esdParams = { "CustomerKey" : "ssjs_de_esd_1c", "Name" : "SSJS DE Test ESD3", "EmailSubject" : "Third send By Test DE Send Definition" }; // local values var scKey = 'scKey'; var emailKey = 'test_email'; var deKey = 'deKey'; var pubListKey = 'myPubList'; var status = Send.Definition.AddWithDE(esdParams, scKey, emailKey, deKey, pubListKey); ``` # Definition.AddWithFilterDefinition ## Overview Add a send definition that incorporates a filter definition ### Syntax Definition.AddWithFilterDefinition(1, 2, 3, 4, 5) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------------------------- | | **1** | string | **Required** | Customer key, name, and subject line for send definition | | **2** | string | **Required** | Customer key for related send classification | | **3** | string | **Required** | Customer key for email used in send definition | | **4** | string | **Required** | Customer key of filter definition used in send definition | | **5** | string | **Required** | Targeted list ID | ## Examples This sample code adds the send definition with the appropriate filter definition: ``` var esdParams = { "CustomerKey" : "filterDef_esd", "Name" : "Example Filtered Send Definition", "EmailSubject" : "Sent By Filtered Send Definition" }; var scKey = 'scKey'; var emailKey = 'test_email'; var filterDefKey = 'fdKey'; var listID = 144; var status = Send.Definition.AddWithFilterDefinition(esdParams, scKey, emailKey, filterDefKey, listID); ``` # DefinitionRemove ## Overview Remove a previously initialized send definition and return the status of the removal ### Syntax DefinitionRemove() ## Examples This sample code removes a send definition with an external key of myESD: ``` var esd = Send.Definition.Init('myESD'); var status = esd.Remove(); ``` # DefinitionRetrieve ## Overview Retrieve send definitions based on the specified criteria ### Syntax DefinitionRetrieve(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------- | | **1** | string | **Required** | Criteria used to search for send definition | ## Examples This sample code retrieves an array of send definitions based on the specified criteria: ``` var esd = Send.Definition.Retrieve({Property:"CustomerKey", SimpleOperator:"equals", Value:"ssjs_test_esd"}); ``` # DefinitionSend ## Overview Sends email messages to the lists associated with the initialized send definition ### Syntax DefinitionSend(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------------------------------------------------------------------------------------- | | **1** | object | **Required** | Date object specifying when send should perform. If you pass no value or a null value, the send performs immediately. | ## Examples This sample code initializes a send definition with an external key of myESD and performs a send: ``` var esd = Send.Definition.Init('myESD'); var status = esd.Send(); ``` # DefinitionUpdate ## Overview Updates the send definition and returns a status ### Syntax DefinitionUpdate(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------------------------- | | **1** | string | **Required** | Attributes of send definition to change | ## Examples This sample code initializes a send definition with an external key of myESD and updates the name: ``` var esd = Send.Definition.Init('myESD'); var status = esd.Update({ "Name" : "Updated ESD Name" }); ``` This sample code updates an email send definition with a new sendable data extension: ``` var newDE = { DataExtensionKey : "DE" PubListKey : "MyPubListKey" } var deESD = Send.Definition.Init('ESD'); var status = deESD.Update(newDE); This sample code demonstrates how to update a filter definition used by a send definition: var esd = Send.Definition.Init('myESD'); var esdUpdates = { Name : "Updated ESD Name", FilterDefinition : { CustomerKey : "myFilterDefKey", ListID : 12345 } }; var status = esd.Update(esdUpdates); ``` # Delete Delete objects individually or in batches. You can delete multiple object types in a request. The API deletes objects in the order they appear in the `APIObject` array. ## Parameters | Name | Data Type | Description | | --------------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Objects` | Array of [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) objects | A collection of one or more objects to delete. The objects are deleted in the order they have been acted upon: first in, first out. This array can hold different object types, which allows you to perform complex interactions like deleting an account and two emails, in one call. | | `Options` | [DeleteOptions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleteoptions.md) object | Optionally specifies [more processing options](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleteoptions.md). A DeleteOptions instance is required for this parameter. However, no properties need to be defined for the instance. | | `OverallStatus` | String | Specifies the overall status of the request. Valid status values include:
  • OK - This status code states that all objects were successfully deleted.
  • Has Error - Valid for Delete method calls with multiple APIObject objects, this status code states that some of the operations failed, while some succeeded.
  • Error - This status code states that all delete operations failed during validation or processing.
| | `RequestID` | String | A unique identifier for the request. This string contains an output variable of the key of the request. | ## Output | Name | Data Type | Description | | -------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `DeleteResult` | Array | An array of objects that contains a list of return values. The API returns objects in the order they are deleted. This array contains one `DeleteResult` object for each `APIObject` in the request. | ## Related Items - [Delete a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_data_extension_object.md) - [Delete a Row from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_row_from_a_data_extension_via_the_web_service_api.md) - [Delete a Subscriber List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_subscriber_list.md) - [Delete a Subscriber Profile Attribute](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deleting_a_subscriber_profile_attribute.md) # DELETE /hub/v1/nestedtags/{tagId} ## Overview Deletes an existing tag and all of its nested tags. ### URL Parameters | Name | Type | | Description | | --------- | ------ | ------------ | ------------------------ | | **tagId** | number | **Required** | ID of the tag to delete. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /hub/v1/nestedtags/14 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 204 No Content ``` # DELETE /hub/v1/workflowitems/{workflowItemId}/roles/{workflowRoleInstanceId}/Users/{userId} Removes a user assigned to a workflow role. ## URL Parameters | Name | Type | | Description | | -------------------------- | ------ | ---------- | --------------------------------------- | | **workflowRoleInstanceId** | string | `Required` | Id of the workflow role instance record | | **workflowItemId** | string | `Required` | Id of the workflow item | | **userId** | string | `Required` | Id of the user to be removed | ## Responses | Status | Name | Type | Description | | ------- | --------- | ------ | ------------------------------------------------------------------ | | **204** |   |   | **204 No Content** | |   | message | string | Value is a required field. | |   | errorcode | string | Error code for the exception (10002) | |   |   |   |   | | **400** |   |   | **404 Not Found** | |   | message | string | The WorkflowRoleInstanceUser isn’t active, so it can’t be deleted. | |   | errorcode | string | Error code for the exception (30003) | |   |   |   |   | | **403** |   |   | **403 Unauthorized** | |   | message | string | Insufficient Privileges. | |   | errorcode | string | Error code for the exception (20002) | # DELETE /interaction/v1/eventDefinitions/{id} ## Overview Deletes an individual event definition by ID or key. ## URL Parameters | Name | Type | | Description | | ---- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | | id | string | Required | The ID of the event definition expressed in the form of a GUID (UUID). Required if not using a key. | | key | string | Required | The key of the event definition. Required if not using an ID. Prefix the parameter with key:. For example, /eventDefinitions/key:{key}. | # DELETE /interaction/v1/interactions/{id} ## Overview Deletes a journey by ID or key. When deleting last version of a journey, check if the journey is associated with a tag and unassociated the tag using the [deleteTags](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_interaction/deleteTags.md) resource. ### URL Parameters | Name | Type | | Description | | ----------------- | ------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **id** | string | **Required** | The ID of the journey to delete expressed in the form of a GUID (UUID). Required if not using a key. The ID deletes all versions of the journey, unless a versionNumber is provided. | | **key** | string | **Required** | The key of the journey. Required if not using ID. Prefix the parameter with **key:**. For example, **/interactions/key:{key}**. | | **versionNumber** | integer | | Version number of the journey to delete. **If no version is specified, ALL versions associated with the provided ID will be deleted.** | ### Usage **Example Request** The following request will delete the journey specified with the ID request parameter. If you don't provide the `versionNumber` parameter, then **ALL** versions of the identified journey will be deleted. YOU CANNOT RECOVER THIS DATA. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /interaction/v1/interactions/{id}?versionNumber={versionNumber} Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js HTTP/1.1 200 OK ``` **Example Error Response** ```js HTTP/1.1 500 { "documentation": "", "errorcode": 500, "message": "Internal Server Error" } ``` # DELETE /messaging/v1/email/seed-lists/{id} Deletes a seed list from an account. The MID is used from authentication. Make sure that: - The MID is activated for MCSeedList. - The Principal has AppId associated with it to validate that a partner is calling in. - The AppId is associated with the seed-list guid (one partner can't update the seed-list of another partner). If a seed-list GUID exists, this method inactivates all seeds in it. ## Response | Status | Description | | ------ | ----------- | | 204 | No content. | ### Validation Failure Scenarios | HTTP Status | Description | | ----------- | ---------------------------------------------------------- | | 400 | `{id} isn't a valid SeedList ID.` | | 400 | `Cannot find seed-list with this id: {id}.` | | 404 | `The seed-list id (GUID) doesn't belong to the PartnerId.` | | 429 | `API rate limit throttling is preventing success.` | ## Usage This example shows how to delete a seed list by specifying its ID. ``` DELETE /messaging/v1/email/seed-lists/{id} ``` The API responds with a success message. ```js 204 No Content ``` ## Related Items - [Seed-List in Rest Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/routes.md#seed-list) - [Seed-List Management API](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/messageSeedListManagement.md) # DELETE /messaging/v1/securityHeaders/{pageType} ## Overview Delete all the security headers applied to either a business unit's SAP-branded `view` or `click` domain. ### URL Parameters | Name | Type | Description | | ---------- | ------ | ----------------------------------------------- | | `pageType` | string | The type of the page, either `click` or `view`. | ## Usage ### Example Request ```bash Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /messaging/v1/securityHeaders/click Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```json HTTP/1.1 202 { "requestId": "bf176537-995f-461e-a7f4-1476c5e90ed7" } ``` ## Related Items - [HTTP Security Headers Overview](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-overview.md) - [Get All HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-get-all.md) - [Get HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-read.md) - [Update HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-update.md) # DELETE /messaging/v1/sms/definitions/{definitionKey} ## Overview Deletes a message definition. You can't restore a deleted definition. The deleted definition is archived, and a delete location of the definition key is provided in the response for reference. You can reuse a deleted definition key because the information associated with it is copied to a new unique identifier. ### URL Parameters | Name | Type | | Description | | ----------------- | ------ | ------------ | ------------------------------------ | | **definitionKey** | string | **Required** | Unique identifier of the definition. | ### Responses | Status | Name | Type | Description | | ------- | -------------------- | ------ | ----------------------------------------------------------------------- | | **200** |   |   | **Send definition is updated on server. Review example response.** | |   | requestId | string | The unique identifier of this request. | |   | message | string | Success | |   | deletedDefinitionKey | string | New value of the definition key for referencing the deleted definition. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /messaging/v1/sms/definitions/{definitionKey} Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ``` HTTP/1.1 200 OK { "message": “Success", "requestId": "UUID", "deletedDefinitionKey": "51a05a43-0a75-49dd-8cc7-8d316025c87f" } ``` ### HTTP Responses | Response | Reason | | ---------------- | -------------------------------------------------------------- | | 200 OK | Send definition is updated on server. Review example response. | | 400 Bad Request | Invalid request | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Send definition doesn’t exist. | | 500 Server Error | Internal error | # DELETE /messaging/v1/sms/definitions/{definitionKey}/queue Deletes the queue for a send definition. The send definition must be inactive. ## URL Parameters | Name | Type | Description | | ----------------- | ------ | ---------------------------------------------- | | **definitionKey** | string | Required. Unique identifier of the definition. | ## Usage In your DELETE request, include the definition key in the URL path. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /messaging/v1/sms/definitions/DEFINITION_KEY/queue Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` If the request is successful, the API returns a request ID and the status of the request. ```js HTTP/1.1 200 OK { "requestId":"bf27b84b-72e8-4244-8bdb-93e5de5fc7d8", "message":"Queued" } ``` # DELETE /platform/v1/ens-callbacks/{callbackId} ## Overview Deletes a registered callback that isn't used by any subscriptions. Delete all subscriptions for the callback before deleting the callback. ### URL Parameters | Name | Type | | Description | | -------------- | ------ | ------------ | ---------------------------------- | | **callbackId** | string | **Required** | Unique identifier of the callback. | ## Usage ### Example Request ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /platform/v1/ens-callbacks/65b885ab-c2b4-46fe-85d0-d6cb8be8057d Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### HTTP Responses | Response | Reason | | ---------------- | ------------------------------------------------------------------------------------------------------------- | | 200 Success | Callback is deleted. | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Callback ID doesn’t exist. | | 409 Conflict | Subscriptions exist for the callback. Delete all subscriptions for the callback before deleting the callback. | | 500 Server Error | Internal error | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # DELETE /platform/v1/ens-subscriptions/{subscriptionId} ## Overview Deletes a subscription. ### URL Parameters | Name | Type | | Description | | ------------------ | ------ | ------------ | ------------------------------------------------- | | **subscriptionId** | string | **Required** | Unique identifier for the subscription to delete. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /platform/v1/ens-subscriptions/d89c87c4-70f8-43d6-be1e-f01dce97fe4c Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### HTTP Responses | Response | Reason | | ---------------- | ------------------------------ | | 200 Success | Subscription deleted. | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Subscription ID doesn’t exist. | | 500 Server Error | Internal error | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # DELETE /sms/v1/keyword/{keyword}/{longCode} ## Overview Deletes a keyword on an account given a keyword and long code. ### JSON Parameters | Name | Type | | Description | | ------------ | ------ | --- | ------------------------------------------------- | | **keyword** | string | | The keyword that will be deleted | | **longCode** | string | | The long code of the keyword that will be deleted | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /sms/v1/keyword Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN { "LongCode": "5550003232", "Keyword": "TEST" } ``` **Example Response** ```js HTTP/1.1 202 Accepted { "Status": "SUCCESS Keyword with id alm5LXNSSktGMGluRznRb1Rb1R5MDZFQTo4Njow was successfully delete." } ``` # DELETE /sms/v1/keyword/{keyword}/{shortCode}/{countryCode} ## Overview Deletes a keyword on an account given a keyword, short code, and country code. ### JSON Parameters | Name | Type | | Description | | --------------- | ------ | --- | ----------------------------------------------------------------------------- | | **keyword** | string | | The keyword that will be deleted | | **shortCode** | string | | The short code of the keyword that will be deleted | | **countryCode** | string | | The two letter country code specifying the country that short code belongs to | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /sms/v1/keyword Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN { "ShortCode": "89239", "Keyword": "TEST", "CountryCode": "US" } ``` **Example Response** ```js HTTP/1.1 202 Accepted { "Status": "SUCCESS Keyword with id alm5LXNSSktGMGluRznRb1Rb1R5MDZFQTo4Njow was successfully delete." } ``` # DELETE /sms/v1/keyword/{keywordId} ## Overview Deletes a keyword on an account given a keyword Id. ### URL Parameters | Name | Type | | Description | | ------------- | ------ | ------------ | ------------------------------------------ | | **keywordId** | string | **Required** | Encoded Id of keyword that will be deleted | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com DELETE /sms/v1/keyword/alm5LXNSSktGMGluRznRb1Rb1R5MDZFQTo4Njow Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js HTTP/1.1 202 Accepted { "Status": "SUCCESS Keyword with id alm5LXNSSktGMGluRznRb1Rb1R5MDZFQTo4Njow was successfully delete." } ``` # Delete a Data Extension If you don’t need the information that’s stored in a data extension, you can delete it. When you delete a data extension, the information that it contains is also deleted and can't be accessed anymore. Marketing Cloud Engagement temporarily retains information from a deleted data extension to ensure that current processes can access that information. During this period, you can’t create a data extension with the same name as the deleted data extension. Don’t delete a data extension that’s assigned to a triggered send definition. If you do, the status of the triggered send definition changes to indicate an error. **important:** You can’t delete a data extension if it has a data relationship to contact records or to another data extension. To delete a data extension that has a data relationship, first use Data Designer to remove the relationship, and then delete the data extension. See [Data Designer](https://help.salesforce.com/s/articleView?id=mktg.mc_cab_data_designer.htm) in Salesforce Help. ## Sample SOAP Envelope ```xml Delete urn:uuid:d5c8c2ee-384e-4492-af18-b01e0d438b62 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx USERNAME PASSWORD External key of Data Extension ``` # Delete a Row from a Data Extension Use the [delete](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md) method on the `DataExtensionObject` object to delete a row from a data extension. **important:** When you use the [retrieve](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve.md) method to get a column that contains the `Date` data type, SOAP API returns a value that’s rounded to the nearest second, followed by AM or PM. This behavior occurs even when the source timestamp contains millisecond data. If you use a `Date` column as a primary key, it can prevent you from retrieving unique rows. Use caution when you delete rows that you obtained by using the `retrieve` method if the data extension those rows belong to uses a `Date` value as a primary key. ## Sample SOAP Request This sample SOAP envelope shows how to delete a row from a data extension. This example uses a specific value in a `MemberId` field to identify the row to delete. ```xml Delete https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN C8838DA2-F682-4DA1-B5E2-AFDD1B39CBAF MemberId 6d028f76-d945-43ea-8878-8cc6302daf1f ``` ## Sample SOAP Response If the row and value from the request is found in the data extension, the row is deleted. The response confirms which rows were deleted. ```xml DeleteResponse urn:uuid:f292ae97-8d18-4d17-9a81-4cec158d5467 urn:uuid:c882005d-4867-4658-a7d3-91f5eeb00324 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2024-07-10T18:41:23Z 2024-07-10T18:46:23Z OK Deleted DataExtensionObject 0 C8838DA2-F682-4DA1-B5E2-AFDD1B39CBAF MemberId 6d028f76-d945-43ea-8878-8cc6302daf1f e046d973-289f-45ce-a804-e78fe3486f55 OK ``` ## See Also - [Retrieve Data from a Data Extension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_data_from_a_data_extension.md) # Delete a Subscriber List Deletes a subscriber list. This action doesn't delete the subscribers on that list. When a list is deleted, no further sends can be conducted with that list. When you delete a subscriber list, your account also loses all tracking information related to that subscriber list. For this reason, we recommend leaving lists intact and creating new lists via new opt-in procedures. Use thesee code examples to construct your own API calls. ## Sample .NET Code ```csharp using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using etAPI; public partial class ListDelete : System.Web.UI.Page { //Global Variables private SoapClient client = new SoapClient(); protected void Page_Load(object sender, EventArgs e) { //Authenticate client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationSettings.AppSettings["wsUserName"]; client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationSettings.AppSettings["wsPassword"]; if (!IsPostBack) { } } protected void btnSubmit_Click(object sender, EventArgs e) { try { //Create List object [Subscribers > My Subscribers > My Lists] List l = new List(); l.ID = 1007548;//required l.IDSpecified = true; try { string dRequestID = String.Empty; string dStatus = String.Empty; //Call the Delete method on the List object DeleteResult[] dResults = client.Delete(new DeleteOptions(), new APIObject[] { l }, out dRequestID, out dStatus); //Display Results lblMessage.Text += "Overall Status: " + dStatus; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + dResults.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (DeleteResult ur in dResults) { lblMessage.Text += "Status Message: " + ur.StatusMessage; lblMessage.Text += "
"; } } catch (Exception ex) { //Set Message lblMessage.Text += "

UPDATE ERROR:
" + ex.Message; } } catch (Exception exc) { //Set Message lblMessage.Text += "

###ERROR
" + exc.Message; } } } ``` ## SOAP Envelope Example ```xml Delete urn:uuid:12345 123456 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx XXXXX XXXXX 12345 ``` # Delete a Subscriber Profile Attribute This page contains information about deleting a subscriber profile attribute using the SOAP API. ## Why Delete a Subscriber Profile Attribute You can remove subscriber profile attributes with this call when you no longer want to use or retain this information. ## How to Delete a Subscriber Profile Attribute Use the sample code below as a model to create your own API call. Use the SOAP request to validate that you've included all applicable information. ### Sample Java Code (Axis 1.4) ``` public void testDeleteAttributeForSubscriber() throws RemoteException { Soap_PortType stub = init(); ConfigureRequestMsg configureRequestMsg = new ConfigureRequestMsg(); PropertyDefinition definition = new PropertyDefinition(); //create special Attribute under profile management, this attribute holds html content definition.setName("SamplePropertyDefinition"); definition.setPropertyType(PropertyType.value1); //Set ClientID to create attribute on sub-account ConfigureOptions options = new ConfigureOptions(); ClientID clientID = new ClientID(); clientID.setID(232538); options.setClient(clientID); //this creates attribute in sub-account //definition.setClient(clientID); //this creates attribute in parent-account configureRequestMsg.setOptions(options); configureRequestMsg.setAction("delete"); APIObject[] objects = {definition}; configureRequestMsg.setConfigurations(objects); //API call to delete to Attribute.... ConfigureResponseMsg responseMsg = stub.configure(configureRequestMsg); assertNotNull(responseMsg.getOverallStatusMessage()); } ``` ### SOAP Request ``` delete 232538 Subject_Revoooo ``` # Delete a Triggered Send Definition To delete a triggered send definition, use the sample code below as a model for creating your own API request. Marketing Cloud Engagement changes the external key and name of a triggered send definition after it is deleted. This change allows you to reuse deleted names and external keys for new triggered send definitions. **note:** API requests that refer to a deleted triggered send definition always result in failure. ## Sample SOAP Envelope ```xml ${#Project#S1:113903:UN} ${#Project#S1:113903:PW} ExampleTSDDelete ``` ## Related Items - [Triggered Emails](https://help.salesforce.com/articleView?id=mktg.mc_es_triggered_emails.htm) # Delete Multiple Records in Marketing Cloud Next Using Bulk API 2.0 Use Bulk API 2.0 to delete thousands of records asynchronously. This table shows the relevant record types that you can delete using Bulk API 2.0. | Record Type | API Name | | --------------- | --------------- | | Contact records | `Contact` | | Lead records | `Lead` | | Campaigns | `Campaign` | | Segments | `MarketSegment` | | Flows | `FlowRecord` | ## Prerequisite Before you send a request to Bulk API 2.0, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Step 1: Prepare the CSV File To delete records in bulk, you must first create a CSV file that lists the IDs of the records you want to delete. Bulk deletion requests can include only the `Id` field. This behavior is different from other requests in Bulk API 2.0. The first line of the CSV file must contain the text `Id`. Each line after that contains the ID of each record that you want to delete, as shown in this example. ``` Id 0031Q00000jxYzNQAU 0031Q00000jxYzOQAU 0031Q00000jxYzPQAU 0031Q00000jxYzQQAU 0031Q00000jxYzRQAU ``` ## Step 2: Create a Bulk Ingestion Job To begin the process of deleting records in bulk, create a bulk ingestion job. Issue a POST request to the `/services/data/{apiVersion}/jobs/ingest` endpoint. The body of the request must contain at least two properties: `object` and `operation`. The value of the `object` property must match the API name of the record type that you’re deleting. The value of the `operation` property must be `delete`. This example shows a request to create a job that deletes Contacts in bulk. ```json POST /services/data/{apiVersion}/jobs/ingest HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN { "object": "Contact", "operation": "delete" } ``` If the request is successful, the response includes an `id` value. This value is the job ID, which you use in subsequent operations. ```json { "id": "7501Q00001CfAXbQAN", "operation": "delete", "object": "Contact", ... } ``` ## Step 3: Upload the Data To upload data, send a PUT request to the `/services/data/{apiVersion}/jobs/ingest/JOB_ID/batches` endpoint, where `JOB_ID` is your ingestion job ID. Include your data in CSV format in the body of the request. For best results, limit the size of the data to 100 MB. For general considerations related to uploading data using Bulk API 2.0, see [Upload Job Data](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/upload_job_data.htm) in the _Bulk API 2.0 and Bulk API Developer Guide_. ## Step 4: Change the Status of the Ingestion Job When you finish uploading data, change the status of the job to `UploadComplete`. This step tells the system to start processing the uploaded data. You can change the status by sending a PATCH request to the `/services/data/{apiVersion}/jobs/ingest/{jobId}` endpoint. The body of the request must be a JSON object with a single property named `state` with a value of `uploadComplete`. ```json PATCH /services/data/{apiVersion}/jobs/ingest/JOB_ID HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN { "state":"uploadComplete" } ``` To end an ingestion job without processing any records, change the value of `state` to `aborted`. ## Step 5: Check the Status of the Job Check the status of the ingestion job by sending a GET request to the `/services/data/{apiVersion}/jobs/ingest/JOB_ID` endpoint, where `JOB_ID` is the job ID for the ingestion job. If the request is successful, the response includes a `status` property, which describes the current state of the job. # Delete Records in Marketing Cloud Both REST API and Bulk API 2.0 support the deletion of records. Issue a DELETE request to delete up to 2,000 endpoints synchronously using REST API. Alternatively, use Bulk API 2.0 to delete thousands of records asynchronously. - [Delete Records Using REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-manage-objects-delete-rest.md) - [Delete Multiple Records Using Bulk API 2.0](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-manage-objects-delete-bulk.md) # Delete Records in Marketing Cloud Next Using REST API You can delete individual records using the [delete sObject rows](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_delete.htm) endpoints in REST API. ## Record Types You can use REST API to delete these record types. | Record Type | API Name | | ------------------ | --------------- | | Contact records | `Contact` | | Lead records | `Lead` | | Campaigns | `Campaign` | | Marketing segments | `MarketSegment` | | Flows | `FlowRecord` | ## Prerequisite Before you send a request to REST API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). If you don’t know the IDs of the records that you want to delete, [perform a query](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-manage-objects-query/mc-manage-objects-query.md). ## Send the Request To delete a record, send a DELETE request to the `/data/{apiVersion}/sobjects/OBJECT_API_NAME/RECORD_ID` endpoint. Replace `OBJECT_API_NAME` with the API name of the type of object that you want to delete, and replace `RECORD_ID` with the unique ID of the record to delete. You can find the IDs for the records that you want to delete by [running a query](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-manage-objects-query/mc-manage-objects-query.md). This example shows how to delete a marketing segment. The DELETE operation doesn’t contain a request body. ``` DELETE /services/data/{apiVersion}/sobjects/MarketSegment/RECORD_ID HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` When the record is deleted successfully, the API returns a `204 No Content` response with no response body. # Delete Scheduled Async API Conversation Use the ScheduledConversation object to delete a scheduled conversation. You can make the request synchronously or asynchronously by specifying `synchronous` or `asynchronous` as the request type. Asynchronous requests are queued and processed in the order they arrive. General delays in Async API processing impact an asynchronous deletion request, just like any other asynchronous request. ## Deletion Eligibility You can delete any scheduled conversation as long as it exists in the requesting MID. ## Errors | Error | Description | | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | | 204 AsyncAPI_Error | The conversation can’t be deleted at this time. Try again later. If the error continues to occur, contact Salesforce Customer Support. | | 220 AsyncAPI_Item_Not_Found | The conversation can’t be found. Try again later. If the conversation still can’t be found, it doesn’t exist, even in deleted status. | | 222 AsyncAPI_Invalid_Status_To_Delete_Item | The conversation can’t be deleted because it is already processed. | ## Sample SOAP Request ```xml Synchronous ExampleConversationID ``` ## Related Items - [Callback Handling for Asynchronous Calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_callback.md) - [Schedule a User-Initiated Email Send](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_a_user_initiated_email_message_send_via_the_web_service_api.md) - [Schedule an Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_an_email_send_definition.md) # Delete Scheduled Async API Non-Conversation Message Use the ScheduledRequest object to delete a scheduled message that isn’t part of a conversation. You can make the request synchronously or asynchronously by specifying `synchronous` or `asynchronous` as the request type. Asynchronous requests are queued and processed in the order they arrive. ## Deletion Eligibility You can delete any scheduled non-conversation message as long as the queued message’s scheduled time is fewer than 60 minutes from the time that the deletion request is made, if made synchronously, or processed, if made asynchronously. ## Errors Retry the deletion request until you receive a success response. | Error | Description | | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | 204 AsyncAPI_Error | The non-conversation message can’t be deleted at this time. Try again later. If the error continues to occur, contact Salesforce Customer Support. | | 220 AsyncAPI_Item_Not_Found | The non-conversation message can’t be found. Try again later. If the error continues to occur, contact Salesforce Customer Support. | ## Sample SOAP Request Synchronous ExampleRequestID ## Related Items - [Callback Handling for Asynchronous Calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asynchronous_processing_callback.md) - [Schedule a User-Initiated Email Send](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_a_user_initiated_email_message_send_via_the_web_service_api.md) - [Schedule an Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/scheduling_an_email_send_definition.md) # Delete via WSProxy To delete a single item or several items of the same type in a single call, use the `deleteItem()` and `deleteBatch()` functions. - Specify the first two parameters of the delete functions like you do for the create functions. - The optional third parameter includes any properties to be set using the SOAP `DeleteOptions` object. ## Example: Delete a Data Extension This example deletes a data extension using its object ID. ```js var prox = new Script.Util.WSProxy(); var objectID = "c9875a80-4dad-e411-b071-ac7ba13db5bc"; var res = prox.deleteItem("DataExtension", { ObjectID: objectID }); ``` **important:** You can’t delete a data extension if it has a data relationship to contact records or to another data extension. To delete a data extension that has a data relationship, first use Data Designer to remove the relationship, and then delete the data extension. See [Data Designer](https://help.salesforce.com/s/articleView?id=mktg.mc_cab_data_designer.htm) in Salesforce Help. The returned object has the same properties as the Create functions, except the results contain properties from the SOAP `DeleteResult` items. ## See Also - [Create via WSProxy](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_WSProxy_create.md) # DeleteData Deletes information from a data extension as indicated by the array containing the listed column name and value pairs. You can include multiple column name and value pairs in a single call. You can use this method in non-sending contexts, such as landing pages. **note:** This function times out if it runs for too long. The maximum number of rows that you can delete depends on the size of the data extension, system load, and other factors. For large deletion requests, we recommend that you implement a batching process. ## Syntax `Platform.Function.DeleteData(1, 2, 3)` ## Function Properties | Ordinal | Type | Description | | ------- | ------ | ------------------------------------------------------------------------------- | | `1` | String | Required. The name of data extension that contains the rows you want to delete. | | `2` | Array | Required. The columns to search for the specified values. | | `3` | Array | Required. The field values used to determine which rows to delete. | ## Example This example deletes all rows in the `MembershipRewards` data extension where the value in the `Area` column is `Kensington`. ```js

Rows deleted:

``` The only item in the response is the number of rows that were modified. # DeleteData() Deletes rows from a data extension, and returns the number of rows deleted. You can use this function in landing pages, microsites, and SMS messages in Mobile Connect. Use the `DeleteDE()` function to delete rows from a data extension in an email. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DeleteData(dataExt, columnName1, valueToDelete1, [columnName2, valueToDelete2 ...]) ``` The `DeleteData()` function has three parameters: - `dataExt` (string): Required. The name of the data extension that contains the data you want to delete. - `columnName1` (string): Required. The name of the column to search for the data you want to delete. - `valueToDelete1` (string): Required. The value that the function uses to determine which row to delete. You can delete multiple rows in the same operation by appending column names and field values to the end of the function. ## Usage To use the function, first pass it the name of the data extension that contains the data that you want to delete. Next, pass it the name of the column to search for the data that you want to delete. Finally, pass the value that identifies the row you want to delete. ### Deleting a Single Row Imagine you have a Flights data extension that contains the data in this table. | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | To delete the row in which the value in the Dest column is "LAX", use this function. ``` %%[ DeleteData("Flights", "Dest", "LAX") ]%% ``` The function deletes the specified row, leaving this data in the data extension: | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | SEA | 500 | 25 | The function returns `1`, indicating that it deleted one row. ### Deleting Multiple Rows You can also use this function to delete multiple rows based on more than one set of criteria. In this example, the Flights data extension from the earlier example has been expanded to include more data. | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | | ORD | SEA | 525 | 10 | | ORD | LAX | 400 | | | SEA | SAN | 300 | | | SEA | ATL | | 10 | | ATL | AUS | 350 | 10 | | STL | KCA | | 5 | | STL | ATL | 200 | | To delete the rows in which the value in either the Origin or the Dest column is "ATL", use this function. ``` %%[ DeleteData("Flights", "Origin", "ATL", "Dest", "ATL") ]%% ``` The function deletes the specified rows, leaving this data in the data extension: | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | | ORD | SEA | 525 | 10 | | ORD | LAX | 400 | | | SEA | SAN | 300 | | | STL | KCA | | 5 | The function returns `3`, indicating that it deleted three rows. ## See Also - [DeleteDE()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-de.md) # DeleteDE Deletes information from a data extension as indicated by the array containing the listed column name and value pairs. You can include multiple column name and value pairs in a single call. You can use this method in sendable contexts, such as email messages. ## Syntax `Platform.Function.DeleteDE(1, 2, 3)` ## Function Properties | Ordinal | Type | Description | | ------- | ------ | ---------------------------------------------- | | `1` | string | Required. Name of data extension | | `2` | array | Required. Names of columns from data extension | | `3` | array | Required. Names of values in data extension | ## Example This example deletes the rows from the data extension where the value of `LastName` is `Smith`. ``` ``` # DeleteDE() Deletes rows from a data extension. This function doesn’t return any output. You can use this function to delete rows from a data extension in an email. Use the [DeleteData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data.md) function to delete rows in CloudPages, landing pages, microsites, and SMS messages in MobileConnect. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DeleteDE(dataExt, columnName1, valueToDelete1, [columnName2, valueToDelete2 ...]) ``` The `DeleteDE()` function has three parameters: - `dataExt` (string): Required. The name of the data extension that contains the data you want to delete. - `columnName1` (string): Required. The name of the column to search for the data you want to delete. - `valueToDelete1` (string): Required. The value that the function uses to determine which row to delete. You can delete multiple rows in the same operation by appending column names and field values to the end of the function. ## Usage To use the function, first pass it the name of the data extension that contains the data that you want to delete. Next, pass it the name of the column to search for the data that you want to delete. Finally, pass the value that identifies the row you want to delete. ### Deleting a Single Row Imagine you have a Flights data extension that contains the data in this table. | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | To delete the row in which the value in the Dest column is "LAX", use this function. ``` %%[ DeleteDE("Flights", "Dest", "LAX") ]%% ``` The function deletes the specified row, leaving this data in the data extension: | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | SEA | 500 | 25 | ### Deleting Multiple Rows You can also use this function to delete multiple rows based on more than one set of criteria. In this example, the Flights data extension from the earlier example has been expanded to include more data. | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | | ORD | SEA | 525 | 10 | | ORD | LAX | 400 | | | SEA | SAN | 300 | | | SEA | ATL | | 10 | | ATL | AUS | 350 | 10 | | STL | KCA | | 5 | | STL | ATL | 200 | | To delete the rows in which the value in either the Origin or the Dest column is "ATL", use this function. ``` %%[ DeleteDE("Flights", "Origin", "ATL", "Dest", "ATL") ]%% ``` The function deletes the specified rows, leaving this data in the data extension: | Origin | Dest | Price | PerBagSurcharge | | ------ | ---- | ----- | --------------- | | IND | NYC | 100 | | | IND | LAX | 200 | | | IND | SEA | 500 | 25 | | ORD | SEA | 525 | 10 | | ORD | LAX | 400 | | | SEA | SAN | 300 | | | STL | KCA | | 5 | ## See Also - [DeleteData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-delete-data.md) # DeleteOptions Defines the options associated with a `Delete` request. ## Properties | Name | Data Type | Description | | ----------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CallsInConversation` | Integer | The number of calls that are part of a conversation. Requests are processed when the specified number of calls have been received. When you specify this property, you must also specify the `ConversationID` property. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ConversationID` | String | A unique ID for grouping multiple calls into a single conversation. All calls with the same ConversationID are processed as a single unit. | | `Priority` | String | This property is deprecated. The API still honors this property, but we recommend that you use the `QueuePriority` property in new API calls. | | `QueuePriority` | [Priority](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/priority.md) object | Defines the priority for asynchronous sends. Accepted values: `High`, `Medium`, and `Low`. The default value is `Medium`. | | `RequestExpirationTime` | String | The date and time when the asynchronous API request expires. Specify the value in ISO 8601 format with UTC time or with a timezone offset. When you specify both `RequestExpirationTime` and `ScheduledTime` in a request, the `RequestExpirationTime` must occur after the `ScheduledTime`. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | The type of request. Possible values are `synchronous` and `asynchronous`. | | `SaveOptions` | Array of [SaveOption](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/saveoption.md) objects | Specifies how information is overwritten. | | `ScheduledTime` | String | The date and time at which the request must be processed. Specify the value in ISO 8601 format with UTC time or a timezone offset. The specified time can be up to 30 days in the future. | | `SendResponseTo` | Array of [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) objects | Defines how responses are returned and under what conditions. Optional. | | `SequenceCode` | Integer | Specifies the processing sequence of a multi-step conversation. This optional property requires the use of ConversationID. | ## Related Items - [Delete method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md) # DeleteResult An object that contains results of each object in a `Delete` request. The API returns objects in this response object in the same order as they appeared in the request. For each `APIObject` in the request, the API returns one `DeleteResult`. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `Object` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies definition of object. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | ## Related Items - [Delete method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md) # Deleting A Subscriber Use this API call to delete a subscriber's information from your account. You don't need to delete a subscriber in order to unsubscribe that subscriber from an email list. When you delete a subscriber, your account also loses all tracking information related to that subscriber and a new instance of that subscriber could be added to lists from which that subscriber has previously unsubscribed. For this reason, we recommend that you unsubscribe subscribers rather than delete them. Use these code examples to create your own API call. ## Sample .NET Code ```csharp using System; using System.Configuration; using etAPI; public partial class SubscriberDelete : System.Web.UI.Page { //Global Variables private SoapClient client = new SoapClient(); protected void btnSubmit_Click(object sender, EventArgs e) { try { Subscriber sub = new Subscriber(); // Use one of the following to identify the subscriber sub.SubscriberKey = "12345"; // Preferred method sub.EmailAddress = "acruz@example.com"; sub.ID = 123456789; try { string requestID = String.Empty; string status = String.Empty; DeleteResult[] results = null; //Call the Delete method on the Subscriber object results = client.Delete(null, new APIObject[] { sub }, out requestID, out status); //Display Results lblMessage.Text += "Overall Status: " + status; lblMessage.Text += "
"; lblMessage.Text += "Number of Results: " + results.Length; lblMessage.Text += "
"; //Loop through each object returned and display the StatusMessage foreach (DeleteResult result in results) { lblMessage.Text += "Status Message: " + result.StatusMessage; lblMessage.Text += "
"; } } catch (Exception ex) { lblMessage.Text += "

UPDATE ERROR:
" + ex.Message; } } catch (Exception exc) { lblMessage.Text += "

###ERROR
" + exc.Message; } } } ``` ## Java (CXF) Code Example ```java public void testDeleteSubscriber() throws RemoteException { try { Soap stub = init(); Subscriber subscriber = new Subscriber(); subscriber.setSubscriberKey("jdoe@example.com"); DeleteRequest deleteRequest = new DeleteRequest(); APIObject[] apiObjects = {subscriber}; deleteRequest.getObjects().addAll(Arrays.asList(apiObjects)); deleteRequest.setOptions(new DeleteOptions()); DeleteResponse deleteResponse = stub.delete(deleteRequest); System.out.println("Deleted Subscriber ::: " + deleteResponse.getOverallStatus()); } catch (Exception e) { e.printStackTrace(); //Change the exception body at File > Settings > File Templates. } } ``` ## Sample SOAP Envelope ```xml
YOUR_ACCESS_TOKEN
example@example.com
``` ## Related Items - _Salesforce Help_: [Delete a Subscriber](https://help.salesforce.com/s/articleView?id=mktg.mc_es_delete_subscriber.htm) - [Unsubscriber Subscriber from an Email List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/unsubscribing_and_logging_an_unsubevent_with_a_logunsubevent_execute_call.md) # Delivery Profile Functions These functions allow you to access and control delivery profiles within your Marketing Cloud Engagement account. Use these functions as part of a landing page or other application. ## Load In your server-side JavaScript code, first load the core library using the syntax below: ``` Platform.Load("core","1"); ``` ## Initialization To interact with a delivery profile via server-side JavaScript, you must first initialize the object. The code below initializes a delivery profile with the external key of 'myDeliveryProfile'. ``` var myProfile = DeliveryProfile.Init('myDeliveryProfile'); ``` Once you initialize the delivery profile, you can use the associated functions. # DeliveryProfile An object that contains information about a single delivery profile in an account, such as IP address, domain, header inclusion, and footer inclusion information. ## Properties | Name | Data Type | Description | | ------------------------------ | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `DomainType` | [DeliveryProfileDomainTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofiledomaintypeenum.md) | Defines the type of domain associated with a delivery profile or send definition. Valid values include DefaultDomain or CustomDomain. | | `FooterContentArea` | [ContentArea](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apicontentarea.md) | Defines footer content area to use as part of a delivery profile or send definition. | | `FooterSalutationSource` | [SalutationSourceEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/salutationsourceenum.md) | Defines source of a footer salutation to use as part of a delivery profile or send definition. Valid values include:
  • Default
  • ContentLibrary
  • None
| | `HeaderContentArea` | [ContentArea](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apicontentarea.md) | Defines content area to be used in the header of a delivery profile or a send definition. | | `HeaderSalutationSource` | [SalutationSourceEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/salutationsourceenum.md) | Defines source of header salutation for a delivery profile or send definition. Valid values include:
  • Default
  • ContentLibrary
  • None
| | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `PrivateDomain` | [PrivateDomain](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privatedomain.md) object | Defines private domain to use as part of a delivery profile or send definition. | | `PrivateDomainSet` | [PrivateDomainSet](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privatedomainset.md) object | Contains information about the private domain set associated with a delivery profile. | | `PrivateIP` | [PrivateIP](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privateip.md) object | Contains information about the private IP address associated with a delivery profile. | | `SMIMESignatureCertificate` | [Certificate](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/certificate.md) object | Contains information about SMIME certificate used to authenticate email. | | `SourceAddressType` | [DeliveryProfileSourceAddressTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofilesourceaddresstypeenum.md) | Indicates the source IP address type used with the delivery profile. Valid values include DefaultPrivateIPAddress and CustomPrivateIPAddress. | | `SubscriberLevelPrivateDomain` | Boolean | Indicates the use of a subscriber level private domain. | ## Related Items - [DeliveryProfileDomainTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofiledomaintypeenum.md) - [DeliveryProfileSourceAddressTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofilesourceaddresstypeenum.md) - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # DeliveryProfileDomainTypeEnum The possible domain types for a delivery profile or send definition. ## Values | Name | Description | | --------------- | --------------------------------------------------------------------------------- | | `CustomDomain` | Indicates that the domain in a delivery profile is a private or dedicated domain. | | `DefaultDomain` | Indicates that the delivery profile uses the default domain for that account. | ## Related Items - [DeliveryProfile](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofile.md) - [EmailSendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailsenddefinition.md) - [SendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senddefinition.md) - [TriggeredSendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggeredsenddefinition.md) # DeliveryProfileSourceAddressTypeEnum The source IP address types for a delivery profile or send definition. ## Values | Name | Description | | ------------------------- | ------------------------------------------------------------------------ | | `CustomPrivateIPAddress` | Indicates that the delivery profile uses a custom private IP address. | | `DefaultPrivateIPAddress` | Indicates that the delivery profile uses the default private IP address. | ## Related Items - [DeliveryProfile](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofile.md) - [EmailSendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailsenddefinition.md) - [SendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senddefinition.md) - [TriggeredSendDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggeredsenddefinition.md) # Describe Get information about the metadata associated with an object. This method supports a request for object metadata in the form of an `ObjectDefinitionRequest` object and returns an `ObjectDefinition` object. ## Parameters | Name | Data Type | Description | | ------------------ | ------------------------------------------------------------ | ----------------------------------------------- | | `DescribeRequests` | [ObjectDefinitionRequest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/objectdefinitionrequest.md) object | A collection of requests to describe objects. | | `RequestID` | String | A unique identifier for the request. | | `ObjectDefinition` | [ObjectDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/objectdefinition.md) object | An object that contains the requested metadata. | ## Related Items - [Describe a Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/describing_a_subscriber.md) # Describe a Subscriber ## Why Describe a Subscriber The Subscriber object is the only object that returns both Properties and ExtendedProperties. Properties include the base Subscriber properties, and ExtendedProperties include subscriber attribute metadata. This call is ideally suited for building a profile center. ## How To Describe a Subscriber Use the information below to create your own API to describe a subscriber. ### Sample .NET Code ``` // Instantiate a Request Object for Subscriber ObjectDefinitionRequest request = new ObjectDefinitionRequest(); request.ObjectType = "Subscriber"; // Execute the Request ObjectDefinition[] results = integrationFramework.Describe(new ObjectDefinitionRequest[] { request }, out requestID); // Output the Results Console.WriteLine("_________Properties______________"); Console.WriteLine(results[0].Name); for (int i = 0; i < results[0].Properties.Length; i++) { Console.WriteLine("Name:\t" + results[0].Properties[i].Name); Console.WriteLine("PropertyType:\t" + results[0].Properties[i].PropertyType); Console.WriteLine("isRetrievable:\t" + results[0].Properties[i].IsRetrievable); } Console.WriteLine("_________ExtendedProperties______________"); if (results[0].ExtendedProperties != null) { for (int i = 0; i < results[0].ExtendedProperties.Length; i++) { Console.WriteLine("Name:\t" + results[0].ExtendedProperties[i].Name); Console.WriteLine("PropertyType:\t" + results[0].ExtendedProperties[i].PropertyType); Console.WriteLine("isRequired:\t" + results[0].ExtendedProperties[i].IsRequired); Console.WriteLine("isViewable:\t" + results[0].ExtendedProperties[i].IsViewable); Console.WriteLine("isRetrievable:\t" + results[0].Properties[i].IsRetrievable); } } ``` ### Output ``` _________Properties______________ Name: ID PropertyType: string isRetrievable: True Name: CreatedDate PropertyType: string isRetrievable: True Name: Client.ID PropertyType: string isRetrievable: True Name: EmailAddress PropertyType: string isRetrievable: True Name: SubscriberKey PropertyType: string isRetrievable: True Name: UnsubscribedDate PropertyType: string isRetrievable: True Name: Status PropertyType: string isRetrievable: True Name: EmailTypePreference PropertyType: string isRetrievable: True Name: Attributes PropertyType: string isRetrievable: False Name: PartnerType PropertyType: string isRetrievable: False Name: Lists PropertyType: string isRetrievable: False Name: GlobalUnsubscribeCategory PropertyType: string isRetrievable: False Name: SubscriberTypeDefinition PropertyType: string isRetrievable: False Name: Client PropertyType: string isRetrievable: False Name: PartnerProperties PropertyType: string isRetrievable: False Name: ModifiedDate PropertyType: string isRetrievable: False Name: ObjectID PropertyType: string isRetrievable: False Name: CustomerKey PropertyType: string isRetrievable: False Name: Owner PropertyType: string isRetrievable: False _________ExtendedProperties______________ Name: CarId PropertyType: double isRequired: False isViewable: True isRetrievable: True Name: Birthday PropertyType: datetime isRequired: False isViewable: True isRetrievable: True Name: CollegeName PropertyType: string isRequired: False isViewable: True isRetrievable: True Name: Hair Color PropertyType: string isRequired: False isViewable: True isRetrievable: True Name: ZIP Code PropertyType: string isRequired: False isViewable: True ``` ### Sample SOAP Envelope ``` XXXXX XXXXX 12345 Subscriber ``` ## See Also - [Subscriber Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) - _Salesforce Help_: [Profile Center](https://help.salesforce.com/articleView?id=mktg.mc_es_profile_center.htm) # Describe via WSProxy To return information about the structure of SOAP API objects, use the `Describe` method. The method takes either a string representing the object type to describe or an array of strings for multiple object types. ## Example: Describe a Data Extension ```js var prox = new Script.Util.WSProxy(); var res = prox.describe("DataExtension"); ``` ## Example Response The returned object has two properties, “RequestID” and “Results.” The results contain ObjectDefinition SOAP items that describe the desired object types. ```json { "RequestID": "fb768ddc-6670-4183-8b9d-4f0d5518bb2e", "Results": [...] } ``` # DescribeMscrmEntities() Returns the logical and display names of all Microsoft Dynamics CRM entities. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DescribeMscrmEntities() ``` This function doesn’t have any parameters. ## Usage This example creates a list of all entities in a Dynamics CRM account. ``` %%[ Var @entities_rs Set @entities_rs = DescribeMscrmEntities() ]%%

This is a list of CRM Entities:

    %%[ Var @entity_name, @entity_displayname, @counter For @counter = 1 to rowcount(@entities_rs) do Set @entity_name = field(row(@entities_rs,@counter), 'Name') Set @entity_displayname = field(row(@entities_rs,@counter), 'DisplayName') ]%%
  • Entity Name: %%=v(@entity_name)=%%, Entity Display Name: %%=v(@entity_displayname)=%%
  • %%[ next @counter ]%%
``` The example outputs a list of entity names and display names. # DescribeMscrmEntityAttributes() Retrieves information about the attributes of a Microsoft Dynamics CRM entity. This information includes the logical name, display name, and type of the attribute. If an attribute contains a Boolean, status, picklist, or state value, the function returns a comma-separated list of option and display values. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` DescribeMscrmEntityAttributes(entityName) ``` The `DescribeMscrmEntityAttributes()` function has one parameter: - `entityName` (string): Required. The name of the Microsoft Dynamics CRM entity to retrieve attributes from. ## Usage This example retrieves information about the attributes of the Lead entity in Microsoft Dynamics CRM. ``` %%[ Var @fields_rs Set @fields_rs = DescribeMscrmEntityAttributes('Lead') ]%% %%[ Var @field_name, @field_displayname, @counter, @field_type, @field_required, @field_options For @counter = 1 to rowcount(@fields_rs) do Set @field_name = Field(row(@fields_rs,@counter), 'Name') Set @field_displayname = Field(row(@fields_rs,@counter), 'DisplayName') Set @field_type = Field(row(@fields_rs,@counter), 'Type') Set @field_required = Field(row(@fields_rs,@counter), 'Required') Set @field_options = Field(row(@fields_rs,@counter), 'Options') ]%% %%[ Next @counter ]%%
Field Name Display Name Type Required Options
%%=v(@field_name)=%% %%=v(@field_displayname)=%% %%=v(@field_type)=%% %%=v(@field_required)=%% %%=v(@field_options)=%%
``` The example outputs a table that provides the field name, display name, field type, required status, and field options for each attribute in the Lead entity. # Design and Super Content Design content is a default for the content attribute that displays when editing an asset or as content thumbnails or previews when there is no actual content. Once the asset is published, design content is ignored. Design is only supported when used with blocks and slots. Super content is realistic content that displays when editing an asset. Like design content, super content is only used when editing and is ignored once the asset is published. Super content can be used to show human readable content instead of code, valid URLs and images instead of broken ones, markup that will be resolved at publishing time, or images that don't exist yet. Super content is only supported when used with slots. Add design content to the asset as a string, using the `design` attribute. Add super content to the asset as a string, using the `superContent` attribute. In this example, the partner uses `!!!attribute` to identify placeholders they later replace using their API. ## Sample Asset with Design and Super Content ```json { "name": "NTO Welcome Series Email", "channels": { "email": true, "web": false }, "views": { "html": { "content": "
Some header content

", "slots": { "firstslot": { "content": "
", "design": "
Drag blocks here to start editing them!
", "blocks": { "block1": { "content": "123", "design": "click here to start editing this block", "assetType": { "name": "freeformblock", "id": 195 } }, "block2": { "content": "234", "design": "click here to start editing this block", "assetType": { "name": "htmlblock", "id": 197 } } } }, "secondslot": { "content": "
", "design": "
Drag blocks here to start editing them!
", "minBlocks": 1, "maxBlocks": 1, "allowedBlocks": ["textblock"], "blocks": { "block3": { "superContent": "Some ampscript or custom markup or http://www.valid.url/likeThis", "content": "Some %%ampscript%% or !!!customMarkup or http://www.invalid.url/%%likeThis%%", "design": "click here to start editing this block", "assetType": { "name": "textblock", "id": 196 } } } } } }, "text": {}, "subjectline": {}, "preheader": {} }, "assetType": { "name": "templatebasedemail", "id": 207 } } ``` ## Related Items - [Asset Model](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset-model.md) - [Asset Model Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) # Develop a Custom Block Widget To develop and offer a custom block, you need the following: - A block widget: an HTML page for editing content that uses the Content Builder Block SDK to interact with content blocks in the editor. - A block icon and dragging icon. This icon displays as users drag and drop the block onto the canvas. - An app that serves this page and a hosting provider to host the app. - An installed package that includes your block component. ## Content Builder Block SDK on GitHub ## Block Widget URL When adding a block component to an installed package, provide a block widget URL. This is the registered endpoint for your custom content block app. For example, if the URL for your block widget is `https://www.example.com/myblock/`, then the Content Builder editor assumes these URLs exist. - `https://www.example.com/myblock/index.html` is your block widget page. - `https://www.example.com/myblock/icon.png` is your block icon. - `https://www.example.com/myblock/dragIcon.png` is your block drag icon. ## Test Your Block Widget To test your block, you need an account that's provisioned for Content Builder, with user permissions to use the editor. Add a block component to your installed package and test it in Content Builder. ## Register Your Block Widget on AppExchange To sell or distribute your custom block outside of your account, register your block widget's installed package on AppExchange. ## Related Items - [Register Endpoint for Custom Content Block Component](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create-content-block.md) - _Salesforce Help_: [Content Builder Permissions](https://help.salesforce.com/articleView?id=mktg.mc_ceb_content_builder_permissions.htm) - [List Your App in AppExchange](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list-app-appexchange.md) # Developer Community Integration Scenario Owen manages an existing CRM system for Northern Trail Outfitters, and part of his duties include planning an integration with Marketing Cloud Engagement. While Northern Trail Outfitters wishes to use the CRM as the database of record, the marketing staff wants to use information from that CRM to send emails to customers and subscribers. Those email messages include: - A welcome email sent to new customers - A monthly newsletter sent to opted-in subscribers - Transactional emails based on customer activities on the Northern Trail Outfitters website, such as reminders about special events for which a customer has signed up Northern Trail Outfitters also wants to use the integration to perform analytic tasks on the data, both in Marketing Cloud Engagement and the CRM system. Owen's tasks focus primary on the integration of the information of the two systems, as marketing handles the creating and sending of the email messages. He’s working in a .NET/C# environment and receives the appropriate credentials from his supervisor. ![Connecting the Development Environment](https://developer.salesforce.com/docs/media/images/owencrmsystem.jpg) Before doing anything else, Owen must successfully connect his development environment to SOAP API. Since he’s writing .NET/C# code, Owen connects using Visual Studio and successfully executes a call to retrieve the availability status of the API. Owen also researches authentication issues to make sure the two systems can interact. He discovers how to get a user token for entity direct login. With this token, his CRM application can directly access Marketing Cloud Engagement. ## Understanding the Data Model Owen decides to store subscriber information in data extensions to facilitate the exchange of information between the two systems. Now, he must decide how to move the data from one system to another in order to keep both systems in sync regarding the most current data. At this point, Owen turns to the documentation to determine how to perform the following actions: - Import existing CRM data into Marketing Cloud Engagement - Update information in Marketing Cloud Engagement based on what subscriber actions - Export updated information and mail analytics information back into the CRM system Owen learns about import definitions as a method of getting information into Marketing Cloud Engagement. He also learns about retrieving information from data extensions as a method of getting information out of data extensions programmatically. Finally, Owen learns about different methods of mapping fields between Marketing Cloud Engagement and the CRM system. After he’s reviewed all of the available information about imports, data extensions, and mapping, Owen familiarizes himself with the available API guidelines to ensure his code is efficient and complete. ![Mapping Marketing Cloud Engagement to the CRM System](https://developer.salesforce.com/docs/media/images/owencrmsystem2.jpg) Owen learns that the actual mapping of the fields occurs within the import definition. However, before the import can take place, he must make sure the data extension fields have the correct data type to receive the information from the CRM system. The correct fields also facilitate moving information back into the CRM system. ## Creating the Import Definition Owen creates the import definition starting with a single user and a single data extension. The import definition uses CSV data exported from the CRM system and placed on an enhanced FTP site. This site hosts the file until the import definition picks up the file and imports the information into the appropriate data extension. ## Manipulating Data Owen learns that information within Marketing Cloud Engagement receives updates based on the actions a subscriber takes on an email. This can include tracking information, updates to subscriber information, or unsubscribing from future email sends. The application can also segment out data using filters and query activities. Owen uses a combination of these features to segment updated users and prepare files to be exported. 1. Owen creates data filters to segment out subscribers based on their behavior regarding the email messages (such as customer service survey responses or messages not opened). 2. Owen creates query activities to segment out subscribers in the same geographical location. ## Extracting Information To export information from Marketing Cloud Engagement, Owen creates and performs an extract to move information back to the FTP site. ## Using Tracking Information Based on the tracking information returned to Owen, he can update records in the CRM to reflect any changes in contact information or behavior. Any changes made in the CRM system can also be reimported into Marketing Cloud Engagement using import definitions. ## Handling Errors and Exceptions Owen wants to implement error and exception handling so that the system doesn’t import the same data multiple times or erase previously imported data. Owen also learns the error code information sounding the import process. ## Scaling At this point, Owen wishes to scale his operation to handle the following aspects: - Handling multiple data extensions - Adding more automation - Pulling in data from a third party (such as a web analytics firm) ## Related Items - [Retrieve the Availability Status of an Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_availability_status_of_an_exacttarget_account.md) - [Create an Import Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_import_definition.md) - [Create a FilterDefinition Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_filterdefinition_object.md) - [Create a Query Activity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_query_activity.md) - [Create a Data Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extract_activity_with_the_soap_web_service_api.md) - [43000–43999 ImportDefinition Object Error Codes](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/43000_43999_importdefinition_object.md) # Developer Community Triggered Send Scenario Jen develops software for Northern Trail Outfitters, and her latest project involves working with her team to develop a new ecommerce site. Her tasks include integrating the ecommerce site with the Northern Trail Outfitters account to send several types of messages. These include welcome emails that are sent when the customer first creates an account, and purchase confirmations and receipts after a sale. These types of messages are transactional emails. Northern Trail Outfitters marketers continue to handle all marketing emails, and they also develop all of the necessary content for transactional emails. Jen handles the API code that calls the correct email message and creates and executes the sending of these transactional emails. She works with C# code and receives credentials from her supervisor. ![Connecting the Development Environment](https://developer.salesforce.com/docs/media/images/jen1new.jpg) Before doing anything else, Jen must successfully connect her development environment to SOAP API. Because she’s writing .NET/C# code, Jen connects using Visual Studio and successfully executes a call to retrieve the availability status of the API. ## Understanding the Data Model Now that Jen has successfully connected her development environment, she must understand how Marketing Cloud Engagement stores the data necessary to execute the email sends. Because the ecommerce site is new, Jen has the opportunity to work with others involved in implementing Marketing Cloud Engagement and decide how they identify individual users and store the applicable information. At this point, Jen relies on documentation to understand more about the application. She also learns about triggered sends and realizes that these email messages perform the function she’s responsible for implementing. The ecommerce site sends these messages when certain actions occur. She also learns about both subscriber lists and data extensions. Jen isn't the only person that uses this information, but she does have a stake in making the final decision. Jen also takes the time to familiarize herself with the API documentation to understand how to best write her code. Because the new ecommerce site relies on email to communicate with customers, Jen decides to make the email address the primary identifier for all customers. She also decides to store this information in data extensions, per the best practice recommendations. Finally, she decides to write her code to take advantage of both synchronous and asynchronous API calls. ![Creating Content](https://developer.salesforce.com/docs/media/images/TriggeredSendProcess.jpg) The marketers for Northern Trail Outfitters handle the actual creation of the email content and messages. However, they must provide Jen with the external keys for these email messages so she can retrieve these items into the email send definitions. ## Creating and Starting the Triggered Send Definition Jen discovers that triggered send definitions must be created and then started in order to make them functional. Initially, Jen has to create triggered send definitions for two different interactions: 1. A welcome email thanking customers for creating an account with Northern Trail Outfitters 2. A confirmation email thanking customers for a purchase After she creates those triggered send definitions, she starts them to ensure they can accept incoming calls. ## Handling Errors and Exceptions Jen must also learn how to handle error codes associated with triggered send definitions and the triggered send itself. For synchronous processing, Jen casts the CreateResult to a TriggeredSendCreateResult to gain access to the SubscriberFailures array. For asynchronous processing, the ResultMessage object represents the focal point for exception handling. Jen retrieves the ResultMessage for each request using the retrieve method, read from an email attachment or available as HTTP post variables. The ResultDetailXML property contains a serialized TriggeredSendCreateResult that provides more information about the error. ## Retrieving Triggered Send Definition Information and Tracking Both Jen and NTO's Marketing team want to know how customers are interacting with these transactional emails. Jen retrieves a tracking send summary to get the information needed and act accordingly. ## Scaling the Implementation After initial testing and implementation, Jen and the team want to expand their efforts to handle increased load and more features. ### Creating Email Messages Jen also recommends creating more email messages and personalizing them to the specific customer. Until this point, the email messages used fixed content to welcome the customer and let them know that the transaction had cleared. Jen recommends that NTO's Marketing team includes dynamic content in their email messages to include the attributes such as first name, last name, and a list of recent purchases. Jen also creates more triggered send definitions to accommodate customers who want to change their usernames and passwords. These definitions include HTML email messages created by the Marketing team and sent to Jen for inclusion in the triggered send definition. These HTML emails contain references to information in the data extension for use in the email message. ### Using the Asynchronous API To ensure that all API calls are properly handled, Jen uses the asynchronous API for further development on the ecommerce site. This step involves rewriting existing functionality, but Jen feels that the solution scales better and allows for better management of her API calls. ### Integrating AMPscript Jen also considers building a landing page for the marketers to view the triggered send tracking information she retrieves via the API. She stores this information in a data extension and builds a landing page using AMPscript that returns the tracking information for easy viewing. ## See Also - [Retrieve the Availability Status of an Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_availability_status_of_an_exacttarget_account.md) - [Retrieve an Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_an_email_via_the_soap_api.md) - [Create Triggered Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_triggered_send_definition.md) - [Start Triggered Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/starting_a_triggered_send_definition_via_the_web_service_api.md) - [Error Codes](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error_codes.md) - [CreateResult Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult.md) - [TriggeredSendCreateResult Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/triggeredsendcreateresult.md) - [ResultMessage Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/resultmessage.md) - [Retrieve a Triggered Send Summary](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_a_triggered_send_summary.md) - [Asynchronous Processing](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/soap_tech_articles_asynch.md) # Display Send-Time Content Contextually You can use AMPscript to pull information from a send logging database to determine which content displays to your subscribers. Depending on the context of the displayed content, you can use a send logging database to pull different information for those contexts. For example, you can display the content current as of send time as shared Social Forward content or content viewed on a web page. You can also display the most recent content when that content is displayed in an email message. This example shows you how to pull send-time content from a data extension so that you can use the data in your chosen context. ## Prerequisites To use this example, the send logging feature must be enabled for your account. For more information about enabling this feature, contact your Salesforce Account Executive. ## Basic Code Example This code example pulls send-time data from a send logging data extension when the content is viewed in an email. For shared content or content viewed in a web page, the AMPscript displays the most current content. The first block of the code sets up the variables necessary to contain the appropriate data and hold the applicable `SubscriberID` and `JobID` values. The `@SendLogData` lookup call references the send logging data extension and retrieves the information in the field assigned to the specific subscriber and job. The If-Else statement displays the content from the send logging data extension if that content resides in a web page or in a Social Forward context. Otherwise, the AMPscript displays the email content. ```AMPscript %%[ /* Set variables for looking up in send logging data extension. */ Var @SendLogData, @SubLookup, @JobLookup Set @SubLookup = SubscriberID Set @JobLookup = JobID Set @SendLogData = Lookup("Send_logging_DE","DE_Field","SubID",@SubLookup,"JobID",@JobLookup) /* Determine what should be displayed based on how the email is viewed. */ If _MessageContext == "VAWP" or _MessageContext == "Social" or _MessageContext == "FTAF" then ]%% /* Content to display when using the view as a web page, social forward, or forward to a friend features */ send logging value: %%=v(@SendLogData)=%% %%[ Else ]%% /* Content to display in the email inbox */ email value: %%DE_Field%% %%[ EndIf ]%% ``` ## Code Example with BatchId and Send Logging If you send the same email message more than one time, the “View As A Web Page” option can reference an earlier version of the email message that doesn’t reflect subsequent changes. To avoid this situation, reference the BatchID of the send in your AMPscript code to ensure that the correct email message is displayed as a web page. The user-defined `@eventID` variable either references the current send or an earlier version using the “View As A Web Page” option. If you send the same email message more than one time and use the “View As A Web Page” option, we recommend that you use send logging. If you don’t use send logging and a recipient is removed from the data extension before the next send, their “View As A Web Page” link stops working. ```AMPscript %%[ Var @eventId, @emailaddr, @SendLogEID, @SendLogEM, @SubLookup, @JobLookup,@BatchLookup Set @SubLookup = SubscriberID Set @JobLookup = JobID Set @BatchLookup = _JobSubscriberBatchID Set @SendLogEID = Lookup("SendLog","EventID","SubID",@SubLookup,"JobID",@JobLookup,"BatchID",@BatchLookup) Set @SendLogEM = Lookup("SendLog","EmailAddress","SubID",@SubLookup,"JobID",@JobLookup,"BatchID",@BatchLookup) If _MessageContext == "VAWP" or _MessageContext == "Social" or _MessageContext == "FTAF" then Set @eventId = @SendLogEID Set @emailAddress = @SendLogEM Else Set @eventId = [EventID] Set @emailAddress = [emailAddress] EndIf ]%% ``` ## See Also - [Lookup()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup.html) function reference - [Send Logging in Email Studio](https://help.salesforce.com/s/articleView?id=mktg.mc_es_send_logging.htm) # Divide() Returns the result of dividing the first parameter by the second parameter. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` Divide(dividend, divisor) ``` The `Divide()` function has two parameters: - `dividend` (number): Required. The initial number. - `divisor` (number): Required. The number to divide the dividend by. ## Usage To use this function, pass it two numbers. The numbers can be positive or negative integer or decimal numbers. ``` %%=Divide(512,256)=%% ``` The function returns the quotient of the two numbers: `2`. Domain Verification # Domain Verification Verify and manage the addresses and domains that are used to send email. This table lists the use cases that the Domain Verification API supports. | Supported Use Case | HTTP Method | URI | | --- | --- | --- | | Get domains | [GET](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=getDomains) | /messaging/v1/domainverification | | Create a domain or address | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=createDomain) | /messaging/v1/domainverification | | Update a domain or address | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=updateDomain) | /messaging/v1/domainverification/update | | Delete a domain or address | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=deleteDomain) | /messaging/v1/domainverification/delete | | Retrieve a verification token | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=retrieveDomainVerificationToken) | /messaging/v1/domainverification/verify | | Bulk-create sender addresses | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=createDomainsBulk) | /messaging/v1/domainverification/bulk/insert | | Register a domain | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=registerDomain) | /messaging/v1/domainverification/register | | Push registered domains | [POST](/docs/marketing/marketing-cloud/references/mc_rest_domain_verfication?meta=pushRegisteredDomains) | /messaging/v1/domainverification/push | **Version:** 1.0 ## Servers * `https://{subdomain}.rest.marketingcloudapis.com` * `subdomain (default N/A) The unique API subdomain for your Marketing Cloud Engagement tenant. You can find this value in the Installed Packages section of Marketing Cloud Engagement Setup.` ## Operations ### GET Get domains `GET /messaging/v1/domainverification` Operation ID: `getDomains`. Retrieves a list of email addresses and domains that can be used to send email from a Marketing Cloud Engagement account. This operation returns both verified and unverified addresses and domains. You can sort and filter the list. Required permission scope: Email | Read #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `$page` (query, string) The page of results to retrieve. Each page includes the number of records specified by the `$pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. * `$pageSize` (query, number) The number of records to return on each page of results. The default value is 25. * `$orderBy` (query, string) The field and sort method to use to sort the results. You can sort on these fields: `domain`, `status`, `issendable`, `domaintype`, and `modifieddate`. You can sort these fields in ascending (`ASC`) or descending (`DESC`) order. The default value is 'domainType ASC'. * `$filter` (query, string) A filter to apply to the results. You can filter on the values of the `status`, `issendable`, and `domaintype` fields. Filters use the format `FIELD_NAME in (VALUE1, VALUE2)`. #### Responses * **200** Indicates that the API accepted the request to list the domains for the current account. Media type: `application/json`. Schema: `domainGetResponseBody`. _Example_ ``` { "page": 1, "pageSize": 50, "count": 2, "items": [ { "enterpriseId": 314159, "domain": "noreply.salesforce.com", "status": "Verified", "domainType": "SAP", "isSendable": true, "memberId": 314159, "emailSendTime": "2023-08-05T11:39:29.61" }, { "enterpriseId": 314159, "domain": "test@example.org", "status": "Pending", "domainType": "UserDomain", "isSendable": true, "memberId": 314159, "emailSendTime": "2023-10-09T17:58:54.183" } ] } ``` * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Create a domain `POST /messaging/v1/domainverification` Operation ID: `createDomain`. Creates an email or domain record. When you create a record, Marketing Cloud Engagement sends a verification email. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `createDomainRequestBody`. #### Responses * **201** Indicates that the API accepted the request to add the address or domain. This response is returned as a plain text string. Most other operations return a JSON object. Media type: `text/plain`. Schema: `string`. Type: `string`. _Example_ ``` jose.figueroa@example.com successfully added. ``` * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Update an address or domain `POST /messaging/v1/domainverification/update` Operation ID: `updateDomain`. Updates the status of the `IsSendable` field for an email address or domain record. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `updateDomainRequestBody`. #### Responses * **200** Indicates that the API accepted the request to update or delete the address or domain. This response is returned as a plain text string, as opposed to most other operations, which return a JSON object. Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `1 records successfully updated!`. * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Delete an address or domain `POST /messaging/v1/domainverification/delete` Operation ID: `deleteDomain`. Deletes an email address or domain record. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `deleteDomainRequestBody`. #### Responses * **200** Indicates that the API accepted the request to update or delete the address or domain. This response is returned as a plain text string, as opposed to most other operations, which return a JSON object. Media type: `text/plain`. Schema: `string`. Type: `string`. Example: `1 records successfully updated!`. * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Retrieve a domain verification token `POST /messaging/v1/domainverification/verify` Operation ID: `retrieveDomainVerificationToken`. Retrieves a verification token for a domain. If the DNS configuration of the domain contains a TXT record that has a value equal to this token, the status of the domain changes to verified. In order to send email from a domain, it must be verified. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `getDomainTokenRequestBody`. #### Responses * **200** Indicates that the API accepted the request to retrieve the domain verification token. Media type: `application/json`. Schema: `domainTokenResponseBody`. _Example_ ``` { "domain": "example.com", "key": "SFMC-6BGTri-q0HTDufy88CndEqlMhO_0l5Xcoy8zCiVJ" } ``` * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Create domains in bulk `POST /messaging/v1/domainverification/bulk/insert` Operation ID: `createDomainsBulk`. Creates multiple sender email address records. The specified notification email address receives an email when all of the email address records have been created. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `createDomainBulkRequestBody`. #### Responses * **201** Indicates that the API accepted the request to add the addresses or domains. Media type: `application/json`. Schema: `domainCreateBulkResponseBody`. * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Register an email domain `POST /messaging/v1/domainverification/register` Operation ID: `registerDomain`. Registers a new domain to use for sending email. If the API accepts your request, it outputs a unique token. To complete the domain verification process, you must add this token to the DNS configuration for the domain as a TXT record. Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `getDomainTokenRequestBody`. #### Responses * **200** Indicates that the API accepted the request to retrieve the domain verification token. Media type: `application/json`. Schema: `domainTokenResponseBody`. _Example_ ``` { "domain": "example.com", "key": "SFMC-6BGTri-q0HTDufy88CndEqlMhO_0l5Xcoy8zCiVJ" } ``` * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ### POST Push registered domains to other business units `POST /messaging/v1/domainverification/push` Operation ID: `pushRegisteredDomains`. Makes one or more registered domains available in other business units (BUs) that share an Enterprise ID (EID). Required permission scope: Email | Write #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that allows you to issue requests to the API. Replace `YOUR_ACCESS_TOKEN` with your API authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Request body (required) Media type: `application/json`. Schema: `pushDomainsRequestBody`. #### Responses * **200** Indicates that the API accepted the request to push the domains to other business units. Media type: `application/json`. Schema: `domainPushResponseBody`. _Example_ ``` [ { "domain": "example.org", "message": "Success" }, { "domain": "example.edu", "message": "Success" } ] ``` * **400** Indicates that the request contained information that the API couldn't process. When you receive a 400 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "message": "JSON Deserialization Exception: Location Unknown", "errorcode": 10004, "documentation": "" } ``` * **401** Indicates that the API wasn't able to authorize your request. When you receive a 401 response, verify that you obtained an authorization token and that the token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Not Authorized" } ``` * **403** This response indicates that the API accepted your request but couldn't authorize it. When you receive a 403 response, make sure you have the necessary permission scope for the operation. You can modify permission scopes on the Installed Apps page in Marketing Cloud Engagement Setup. Media type: `application/json`. Schema: `mceErrorResponseBody`. _Example_ ``` { "documentation": "", "errorcode": 20002, "message": "Insufficient privileges to complete this action." } ``` * **500** Indicates that the API encountered an error when processing the request. When you receive a 500 response, verify that the request uses the correct syntax. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` { "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Internal Server Error" } ``` ## Schemas ### domainGetResponseBody * `page` (_number_) The current page of results. Each page includes the number of records specified by the `pagesize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. * `pageSize` (_number_) The maximum number of results returned in a page of results. * `count` (_number_) The number of results in the current page of results. * `items` (_array of object_) * `enterpriseId` (_number_) The enterprise ID of the parent account. * `domain` (_string_) A domain or email address used for sending email. * `status` (_string_) The verification status of the domain or address. * `domainType` (_string_) The type of domain or address. * `isSendable` (_boolean_) Indicates whether the address or domain can be used to send email. * `memberId` (_number_) The member ID (MID) of the account that contains the address or domain. * `emailSendTime` (_string_) A timestamp that indicates when the verification email was sent. ### mceErrorResponseBody * `documentation` (_string_) An empty string. * `errorcode` (_integer_) An internal error code. For a complete list of error codes, see [Handle Errors in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/error-handling.html). * `message` (_string_) The error message. ### httpErrorResponseBody * `documentation` (_string_) Contains a link to the [Marketing Cloud Engagement developer documentation page about handling REST API errors](https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm). * `errorcode` (_integer_) The error code. In some situations, this value can be 0. * `message` (_string_) The error message. ### createDomainRequestBody * `domain` (_string_) The email address or domain to add. _Example_ ``` { "domain": "jose.figueroa@example.com" } ``` ### updateDomainRequestBody Array of `object`. * `emailAddress` (_string_) The email address or domain to update. * `isSendable` (_boolean_) The value to apply to the `isSendable` attribute for the specified address or domain. If you specify a value of `false`, the email address or domain can't be used to send email after the update operation. If you specify `true`, the address or domain can be used to send email. _Example_ ``` [ { "emailAddress": "jose.figueroa@example.com", "isSendable": false }, { "emailAddress": "jamal.cooks@example.com", "isSendable": true } ] ``` ### deleteDomainRequestBody Array of `object`. * `emailAddress` (_string_) The email address or domain to delete. * `domainType` (_string_) The type of address or domain to delete. Allowed values: `UserDomain`, `SAP`, `PrivateDomain`. _Example_ ``` [ { "emailAddress": "jose.figueroa@example.com", "domainType": "UserDomain" }, { "emailAddress": "jamal.cooks@example.com", "domainType": "UserDomain" } ] ``` ### getDomainTokenRequestBody * `domain` (_string_) The domain to retrieve the verification token for. _Example_ ``` { "domain": "example.com" } ``` ### domainTokenResponseBody * `domain` (_string_) The domain that you requested a verification token for. * `key` (_string_) The verification token for the domain specified in the request. ### createDomainBulkRequestBody * `notificationEmail` (_string_) The email address to notify when all of the email address records have been created. * `addresses` (_array of string_) An array that contains the email addresses that you want to add. You can either specify this property or specify the `deTable` and `deColumn` properties. Each item: An email address. * `deTable` (_string_) The name of a data extension that contains email addresses that you want to add. * `deColumn` (_string_) The name of a column in the data extension that contains email addresses. This property is required if you specified the `deTable` property. _Example_ ``` { "notificationEmail": "administrator@example.com", "addresses": [ "noreply@example.com", "marketing@example.com", "support@example.com" ], "deTable": "EmailSenderTable", "deColumn": "EmailAddress" } ``` ### domainCreateBulkResponseBody * `requestId` (_string_) A unique ID for the bulk creation request. _Example_ ``` { "requestId": "2dc35fd5-8ee6-4751-977b-6673d43480bf" } ``` ### pushDomainsRequestBody * `domainList` (_array of string_) A list of the domains to push to other Business Units that belong to your organization. _Example_ ``` { "domainList": [ "example.com", "example.co.uk", "example.net" ] } ``` ### domainPushResponseBody Array of `object`. * `domain` (_string_) A domain that you attempted to push to other business units in your enterprise. * `message` (_string_) Indicates whether the domain was successfully pushed to other accounts in your organization. # Domain() Returns the domain part of an email address. The domain part is the part of the email address that comes immediately after the at sign (@). ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` Domain(emailAddress) ``` The `Domain()` function has one parameter: - `emailAddress` (string): Required. An email address. ## Usage This example returns the text after the @ sign (in this case, "example.com"). ``` %%= Domain(sales@example.com) =%% ``` You can use this function with the `emailaddr` system personalization string. When you do, the function returns the email recipient's domain. For example, if you send a message to mary.smith@example.com, and the message body contains the AMPscript `%%=Domain(emailaddr)=%%`, Marketing Cloud Engagement replaces the AMPscript code with "example.com". In some situations, the function returns `null`: - If the parameter that you provide doesn't include an at sign. - If the parameter is a non-string value. This table shows some of the possible values that the function can return. | Function | Result | | -------------------------------- | ------------- | | Domain("salesforce@example.com") | example.com | | Domain("sales@force@example") | force@example | | Domain("salesforceexamplecom") | `null` | | Domain(123) | `null` | # DoubleOptInMOKeyword Defines a mobile-originated (MO) keyword, which mobile users can use to subscribe to SMS messages by completing a double opt-in workflow. ## Properties | Name | Data Type | Description | | --------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DefaultPublication` | [List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list.md) object | Specifies the default publication list to which to add a subscriber. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InvalidPublicationMessage` | String | Specifies message to send in case a subscriber requests subscription to or unsubscription from an invalid publication list. | | `InvalidResponseMessage` | String | Specifies message to send in case a subscriber sends in an invalid response. | | `IsDefaultKeyword` | Boolean | Specifies if account defaults to this SMS keyword action if no other options are available. | | `MissingPublicationMessage` | String | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `NeedPublicationMessage` | String | Specifies message to send in case a subscriber sends in an response that doesn't specify a publication list. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `PromptMessage` | String | Contains message sent to subscriber to prompt response as part of the double opt-in process. | | `SuccessMessage` | String | Defines SMS message to send if triggered email send succeeds. | | `UnexpectedErrorMessage` | String | Contains message to send to subscriber in case of unexpected error. | | `ValidPublications` | Array of [List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list.md) objects | Defines valid publication lists for use with a double opt-in event. | | `ValidResponses` | Array of strings | Defines valid responses a subscriber can use as part of a double opt-in process. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # Download Email Recommendation Log Marketers can retrieve a report listing the count of email recommendations by product code. For a given date range, this report lists each product code and the number of the times that product was recommended for each email recommendation configuration, and, optionally, job id. To know which job id a recommendation is associated with, the email recommendation image must have a URL parameter named `sfmc_j`. The email job id is the parameter's value. **note:** Before you attempt to run or download the report, turn it on in Personalization Builder. ## Parameters To download an email recommendation log, you need these values. | Value | Description | | ------------------ | ---------------------------------------------------------------------------------------------------- | | MID | The account MID that contains the data. | | api_key | A valid API Key for that MID. | | start_date | Start date for the report. | | end_date | End date for the report. | | aggregation_method | The only option available for this report is `day`. Personalization Builder rolls up counts per day. | ## Example curl --header 'Content-Type: application/json' -XPOST https:// app.igodigital.com/api/v2/reporting/report/displays_by_item.csv -d '{ "mid": "1314420", "api_key": "", "aggregation_method": "day", "start_date": "2017-10-29", "end_date": "2017-11-29" }' > report.csv ## Related Items - _Salesforce Help_: [Displays by Item Report](https://help.salesforce.com/s/articleView?id=mktg.mc_pb_displays_by_item.htm) # Edit an Asset Edit Asset updates an existing Asset. Asset class or type, and custom attributes are created implicitly if they do not exist. ## Method and Endpoint ``` POST "/ecs/ecs/external/api/v1/asset/" ``` ## Request Body Parameters | Name | Type | Description | | ------------------ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | availability | string, enum | Set whether the asset can be selected. Possible values are: Y, N | | content_builder_id | string, Content Builder ID | Instead of loading the image from a hosted URL or Data URL, create an image for this asset using HTML from the specified Content Builder item. | | custom | map, string → string | The Asset Attributes to associate with this asset. New Attributes are created implicity if they don't exist. For example: locale: JP and segment: A3 | | display_time_zone | string | The timezone to show in-app timestamps for this asset. For example: UTC, Eastern Time (US & Canada) | | end_datetime | datetime, ISO-8601 | The date and time the asset is no longer allowed to be selected. For example: 2021-07-23T13:45:15Z | | fallback | string, enum | Set whether the asset can be selected as a fallback when rules disqualify all other content. Possible values are: Y, N | | image_url | string, URL, data URL | Can be either a web-accessible URL hosting an image or a base-64 encoded Data URL containing image data. | | start_datetime | datetime, ISO-8601 | The start date and time the asset is allowed to be selected. For example: 2021-06-23T13:45:15Z | | type | string | Name of the asset's asset_class. | | url | string, URL | The redirect link to use when an asset is clicked. | ## Example Request ``` POST "/ecs/ecs/external/api/v1/asset/cf868607-9eec-4e2b-ae87-3d2ca7ed7911" BODY: { "type": "Other-Icons", "availability": "Y", "fallback": "N", "start_datetime": "2021-07-23T00:00:00Z", "end_datetime": "2221-07-23T23:59:59Z", "display_time_zone": "Helsinki", "url": "https://www.example.com/einstein-content", "custom": { "locale": "SE" }, "image_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA4CAYAAAC2TwutAAAAAXNSR0IArs4c6QAACaNJREFUaAXtWn1wVFcVv+e+zSYNlCUhsYhaRxidtAVxxq9OKQNSmWlnoFo7okWtViw4zSbZTUxItGUyVkKMCbubEEbjMAV12gb5w47UjwZ1+KNC29FSEKFKh0zt9GMSQrZNmv2819995L59u9nN7qa7wRl5My/n3HPP5z3nfr0ssTyfpqa6m0VMHJeSVeUparITsVHu4Ot6evr+ORf5XGV4royaT0TlZ+calNKhZJUOra9YMO/AiuVIofXmHRgn49/v1YlC6MjmA2VjSNff6Kn1CMF8Vh9nDxLxl622HRFsrZRityZxzrx7/f1+3S4WdMxNMR9nTFiihjBe7Ont/ZtFsCFeb30li9sITMkW/8m7FIvvUmEsXAusMOM4f1quZWz+xrowlq5lrDDjOH9armVs/sa6MJbmmDH5gbmbfy+yuVvNO7DW1tYKKWSTNkFEU6VEr+n2TGhcAI91/lKySsdMvsJS8g4sNDW5SzJmOYaLY3dHIPBWJrd8Pt9Z9B3S/Uo2PDXxiG4XC+YVWHNz3Qpi8iHtDK4Gby5aXNWl25mgJMcP0Ddh669VumztgqN5BRaNyC4ppdPygujh9vZ2u8NWlx3x+/1v4FrzY01TOmIRabU1vZAw58CaGhpux73+S5ZxYqddFVWPWe1sCHf0oGz/o9kQ3L0ej3uNbhca5hQYnCAh4z1248R5E7JlLQr2vnQ45toUY9Q63RdnxJ4jydam4y0ELacbdJOn7r64EI9rg1jlnvYF9m3S7VyhGiCvx32CEe/2+/uO5Co3F76sGUNWyoQQe7RyBBUrIUezbucDISsdxLwkxWfykZsLb9ZPA29fHmnAEv1hm/IB5owFvfW1b4BWaqPngoa5kz4ZC7Mbvldfv7K7t/cf3oa6TiYFbNAk4j7FJPulq7J6EAMaykVhJp5ZM9bWVlctJH1fC2PyB8vKqT0SlrsR7FK8FXm+S5Ws4SjdFSNh6iUpDegowxfHJfjmeAfwg8GxkdcRcLMqXW07XzhrYKF3ZTsMLtJKYacjHGbLiNH9mpYvVLJSRiqxH55HVhyC03OpOszBkqKr0VO3P7Uv13bGEWlqcteIGDuDUbtSrsSGl6/gNRdfkb8DbUOuBiw+IvV16gUYHJYkn3c6Fwxi7groqopHQ8MWXwpChnGXz9f7hxRy1mbGOYagfmIFBTUcS/XwK2IjyiV9UES/d5bSdmUR5TaAPe8ubR0lfBZ73sfTbQ+gRcfHZplOcfEj6Mk7sLQZa2ys/5yIxf9sOcbopKuyam1wbPSMZLJG0+3QWcY/1NXV95qitbTUfTASEtZmDFIc/4j49N69fS82Nri/jlJbjz3t5bJydnDPnr4Rb4N7AoO4QMmme8jg632+vuPp+jLRZswxjCCXMZG0GRtcNgYvj27PFFQm5Ta6IWPy53DeHEjAbfg63DU1KYYR6Jcxj8dsvDNRITbPJM5OmZExLOPfVCuTJUY0uLiCto+PyQtwoNqipyIZShF7VwSsRxjnT7lclb/BwEW89e5TGKTVSgX6Bco2AptYGdM/cPJNSXQeJ5VlOLGEMT5DZLBBZPH59BLQa++A0fLg5ZF/YR5NXyQpXMYdNWEZ/y5GeKedNxccyp8ynOTt7t530c7f2FD3oJBiwE6bC4652+uqqFZHu1iqfNLiMT42qi6Q00FhweAsEDUMKaMxT6pgtjZO84/4An1q4iMhkjBv76C4+JYg+jyylTnz2RTb+pGAekwRdVDotJFN1Jpjzc3NS+FCS4KBRkpKF3SIWBhCMnHCIHoVk3nj4srq6xVELb2akJnGiJ7QQXk8nvcjQ3+RcTGEE/PXEOUNCNSyO0M2d0IUZdx2HTMeSydiZSweDj0KhoWaCWluj4dCNXDiK5qmIHHahto+Nk075vXWbZNxOaR51OkExryqvXPnTlc4NPkMMrRS9xcQOjBIt0WYPAqdb6XqNUfO63WvEkw8YHUSO4d9ZyDOzKtK0jx0uZactPiApLZRwAH9qSASmuyB8WIEpVzAWsI2x1j8lKfe3YF5ZiVJdZqBScHUbdZQBPMh3jw+fumLyNYaTdIwGLx0q8YVTGlPMO4IKDoG61OQ/7bCi/zAb9mG8+UR2LOS4DBvscJ2SmB0zLV4yRBWx3MYkRkPvjIdUOWnMqWCUm3NhJr/BS6UV/YkwdR8tQxpnmJB+PoF+KUWv25lg+OaYB6DtEGDs91YHT1YcZZrWhKU8ka1EIyPjbyjIErtRt1vMONnGofeWyx8nhBc8x9taXEvU+ZUYBu0XZy8Ty5kjlO4Fz2sablCZOtMdyBwWvP7evfd4nDSctC/A71p/42reQsFkbWyaFia+62acNa1BIXzrjKC+tnKOU98jbJZttexjYwy5/imkfxMb8wHDh8+fPDEs8f3qn0nmcO09Vv8/ROG+COY65ugaAV4MFloGI7gSkN/R1VEQFgPv+6GfXNdSNVjtSWtUzjhAHoazKt0BxS+BIVn8F7StLlC3IpfwJXjcWRNYtXi2EyHYCtRIUT78e2k1q6/ra12STy+INLV1fWOna5wHPfuwb55GDqSVkDNB9/Pl5TRRnUYV4E9BMZ+3VlICEPP4FZwbzAYjEsRfRIjf7fWj2AnsaW8DwGbVaLp2aCnvq4Hv1hoTOWDvqMucnyj3e83f5XAMWL71ZkLjOkWwVT5PNo0Ulq+8KtwfAJBHbAHZSqR7EK+QSm5Mm702Z1QBwJOfDvi2KyDUv1mvfoC/Q0OztYg6p+iBM8h3YX4LcZAZ2fnZbX5I6j77M4oHLfoWW6XqdyJdqffP4xgRhMUenpRxZJDifYVzKrVbn//CZDUW9AHH2s2ZSuFRo/7h9hbnThftmrj6oxJIjZokOG2r7ZmvyTMP2n++g7TaCv2XBVog5ZVcPYVxs45R/zW29Z1keFcaXC+VX2/x7ybsfTj50sPYN7gTTy47d6OM+bamIzfmaBOY6TvbvQ61r/duJ0n9s9pFitjM4QLRNiyZYv6wdHZ6fcJpbbZ4/kEHL5H4dOPKqWk7cVRyp6NhthfyUF/1EwaIuBxpGTXTTetOrRjx46opv9PQpQU2R3DwlKubgd2msZVn8YzwSRlmZiKSVcfZfH98knYwH9z2DmE9xKO7auRldVYzKawyDT7/f15b0dFn2PZBiU8yTqQrQ14nSoYrKD3mxCCoF3HBPUgQ2XZ9KT2X/XABMnrU51Kbqvb+6Wk+Zfcn7511QPDKfxX6V27QkU5/rq9ve/t2XjS9V31wPYG+o+WMONj2BI+iq/NfdgOLmID7lA3AycvuRnHrq3pHP+/pf0XpsnIEy9e+o0AAAAASUVORK5CYII=" } ``` ## Example Response ``` { "key": "Einstein Content", "uuid": "cf868607-9eec-4e2b-ae87-3d2ca7ed7911", "type": "Other-Icons", "url": "https://www.example.com/einstein-content", "image_url": null, "custom": { "locale": "SE" }, "created_at": "2021-08-02T22:20:52.861Z", "updated_at": "2021-08-02T22:38:28.804Z", "availability": "Y", "fallback": "N", "file_ext": "png", "status": "ready", "image_updated_at": "2021-08-02T22:38:28.755Z", "image_processing_completed_at": "2021-08-02T22:38:28.802Z", "image_checksum": "16afe520c3489cc77f668cb2dcfa571c-1", "asset_class_id": "f0bc4b14-c19c-49a5-a72f-1736a2afa8f9", "content_builder_id": null, "archived": false, "ect_tags": null, "start_datetime": "2021-07-23T00:00:00.000Z", "end_datetime": "2221-07-23T23:59:59.000Z", "display_time_zone": "Helsinki", "image_link": "https://ecs-asset-images-qa.s3.us-west-2.amazonaws.com/3612/21575198/f/cf868607-9eec-4e2b-ae87-3d2ca7ed7911.png?v=16afe520c3489cc77f668cb2dcfa571c-1", "display_time_zone_name": "Europe/Helsinki", "display_start_datetime": "2021-07-23T03:00:00+03:00", "display_end_datetime": "2221-07-24T01:59:59+02:00" } } ``` # Einstein Content Selection REST API Reference The REST API supports JSON and supports multi-channel use. REST calls are synchronous. # Einstein Recommendation Collect Tracking API ## Overview You can implement Einstein Recommendation Collect Tracking calls by making a POST request to the appropriate URL. When you issue your first request to the Collect API, the JSON response includes `user_id` and `session_id` values. You can use these values in subsequent calls. Include these parameters at the same level as the payload, as shown in this basic example. ``` https://MID.collect.igodigital.com/c2/MID/track_page_view.json { "payload": { "title": "INSERT_PAGE_TITLE", "url": "INSERT_PAGE_URL", "referrer": "INSERT_REFERRER_URL", "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` Keep these considerations in mind when you use the Collect API. - The Collect API only accepts requests that use the `Content-Type: application/json` header. - You can issue requests to HTTP or HTTPS endpoints. - An API key is only required when you issue a request that creates or updates product or catalog data via Streaming Updates. ### Parameter Definitions #### MID A unique client identifier. This value is typically the MID associated with the Business Unit. #### title The title of the page that the user is viewing. #### url The URL or path to the application page. #### referrer The previous page or referring URL for the application. #### email Include this value if the site is tracking the user’s email address or other identifier. For example, on pages such as newsletter signup pages or order confirmation pages, you typically have the user’s email address. The Collect API uses email addresses to merge duplicate values. #### user_id The `user_id` value returned from the first Collect API call for an individual user. Use this value for all future API calls for that individual. **note:** When you start a new session, a new profile is created. At the end of the session, if there are multiple records that share a common email address, those records are merged. #### session_id The `session_id` value returned from the first Collect API call for the user’s current session. Use this value for all API calls in an individual’s session. ## Item Detail View Collect Example This example shows how to implement an observation script that tracks views for a specific item detail page. ``` https://MID.collect.igodigital.com/c2/MID/track_page_view.json { "payload": { "item": "INSERT_ITEM", "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" }, "user_id": "", "session_id": "" } } ``` ### Additional Parameter Definitions #### item Represents the item that’s being displayed to the customer, such as on an item detail page. ## Real-Time Rating Collect Example This example implements an observation script that tracks when a user submits a rating for an item. ``` https://MID.collect.igodigital.com/c2/MID/track_rating.json? { "payload": { "item": "INSERT_ITEM", "rating": "INSERT_ITEM_RATING", "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### rating Populate this parameter with a numerical representation of the rating that the user submitted. You must pass this value in the same call for the rating to be properly recorded. ## Cart Collect Example This example implements an observation script that tracks a snapshot of the items in the user’s cart. ``` https://MID.collect.igodigital.com/c2/MID/track_cart.json? { "payload": { "cart": [ { "item": "INSERT_ITEM", "quantity": "INSERT_QUANTITY", "price": "INSERT_ITEM_PRICE", "unique_id": "INSERT_UNIQUE_ID" }, { "item": "INSERT_ITEM", "quantity": "INSERT_QUANTITY", "price": "INSERT_ITEM_PRICE", "unique_id": "INSERT_UNIQUE_ID" } ], "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### item Set this parameter to a unique identifier for the item in the user’s cart. #### quantity Set this parameter to the quantity of the item in the user’s cart. #### price Set this parameter to the per-unit price of the item in the user’s cart. ## Clear Cart Collect Example This example implements an observation script that indicates when the user has emptied their shopping cart. ``` https://MID.collect.igodigital.com/c2/MID/track_cart.json? { "payload": { "cart": { "clear_cart": true }, "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### clear_cart When true, indicates that the user has removed all items from their shopping cart. ## Conversion Collect Example This example implements an observation script that tracks a conversion event. ``` https://MID.collect.igodigital.com/c2/MID/track_conversion.json? { "payload": { "cart": [ { "item": "INSERT_ITEM", "quantity": "INSERT_QUANTITY", "price": "INSERT_ITEM_PRICE" }, { "item": "INSERT_ITEM", "quantity": "INSERT_QUANTITY", "price": "INSERT_ITEM_PRICE" } ], "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" }, "order_number": "INSERT_ORDER_NUMBER", "shipping": "INSERT_SHIPPING_CHARGE", "discount": "INSERT_DISCOUNT_AMOUNT" }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### order_number Set this parameter to the order number after a conversion event occurs. #### shipping This optional parameter specifies the shipping charge associated with the user’s order. #### discount This optional parameter specifies the discount amount that was applied to the user’s order. ## Search Collect Example This example implements an observation script that tracks page views for a specific item detail page. ``` https://MID.collect.igodigital.com/c2/MID/track_page_view.json? { "payload": { "search": "INSERT_SEARCH_TERM", "title": "INSERT_PAGE_TITLE", "url": "INSERT_PAGE_URL", "referrer": "INSERT_REFERRER_URL", "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### search Set this parameter to include the internal or external search keywords that led to the page view event. ## Category Page Collect Example This example implements an observation script that tracks page views for a specific item detail page. ``` https://MID.collect.igodigital.com/c2/MID/track_page_view.json? { "payload": { "category": "INSERT_CATEGORY_NAME", "title": "INSERT_PAGE_TITLE", "url": "INSERT_PAGE_URL", "referrer": "INSERT_REFERRER_URL", "user_info": { "email": "INSERT_EMAIL_OR_SUBSCRIBER_ID" } }, "user_id": "", "session_id": "" } ``` ### Additional Parameter Definitions #### category Set this parameter for each category and subcategory page. ### Example Response ``` { user_id: "5fb6fd46-7fd6-11e4-93db-123139337486" session_id: "5fb70c14-7fd6-11e4-93db-123139337486" } ``` ## Create or Update a Single Item Example This code sample implements streaming updates to a single item in your catalog. Replace the placeholder values with dynamic code to get the appropriate value for the item. Acceptable values for `item_type` are `content`, `product`, or `banner`. If your request doesn’t specify a value for `item_type`, or it provides a value that the API doesn’t recognize, the API uses a default value of `content`. ``` https://MID.collect.igodigital.com/c2/MID/update_item_secure.json?api_key= {"payload": { "item": "INSERT_ITEM", "unique_id": "INSERT_UNIQUE_ITEM_ID", "item_type": "INSERT_ITEM_TYPE", "name": "INSERT_ITEM_NAME_OR_TITLE", "INSERT_ATTRIBUTE_NAME": "INSERT_ATTRIBUTE_VALUE" } } ``` ## Create or Update Multiple Items Example This code sample updates multiple items in your catalog. Replace the placeholder values with dynamic code to get the appropriate value for the item. Acceptable values for `item_type` are `content`, `product`, or `banner`. If your request doesn’t specify a value for `item_type`, or it provides a value that the API doesn’t recognize, the API uses a default value of `content`. ``` https://MID.collect.igodigital.com/c2/MID/update_item_secure.json?api_key= {"payload": [ { "item": "INSERT_ITEM", "item_type": "INSERT_ITEM_TYPE", "name": "INSERT_ITEM_NAME_OR_TITLE", "INSERT_ATTRIBUTE_NAME": "INSERT_ATTRIBUTE_VALUE" }, { "item": "INSERT_ITEM", "item_type": "INSERT_ITEM_TYPE", "name": "INSERT_ITEM_NAME_OR_TITLE", "INSERT_ATTRIBUTE_NAME": "INSERT_ATTRIBUTE_VALUE" } ] } ``` Attributes can include multiple values. To specify an attribute that has multiple values, place the values in a string array, as shown in this code sample. ``` { "payload": { "item": "INSERT_ITEM", "item_type": "INSERT_ITEM_TYPE", "name": "INSERT_ITEM_NAME_OR_TITLE", "INSERT_ATTRIBUTE_NAME": [ "INSERT_ATTRIBUTE_VALUE1", "INSERT_ATTRIBUTE_VALUE2", "INSERT_ATTRIBUTE_VALUE3" ] } } ``` ## Update Item Availability Example You can use the API to update the availability of an item in your catalog. Set the value of `sku` to a unique ID for the item that you’re modifying. The `availability` parameter indicates whether the product is available. Acceptable values for `availability` are `Y` or `N`. ``` https://MID.collect.igodigital.com/api/update_product?key=&sku=INSERT_UNIQUE_ITEM_ID&availability=N ``` # Einstein Recommendations API The Einstein Recommendations engine empowers marketers to deliver millions of messages across key digital channels that are personalized for each individual’s needs, interests, and preferences. Developers use the Einstein Recommendations API to update the data used to provide recommendations, manage consumer privacy requests, and to easily download large reports. ## Set Up Your Development Environment 1. In the Marketing Cloud Engagement web interface, go to **Einstein > Email or Web Recommendations > Reporting > Admin Tools > Manage API Keys**. 2. Copy the **Crimson Kraken** API key value. This key is created when your account is provisioned. 3. To authenticate your calls, pass the API key in the header like this: ``` Host: https://app.igodigital.com POST /api/v2/organization/{customer_mid}/... Content-Type: application/json Authorization: Bearer YOUR_API_KEY ``` ## See Also - [Privacy Batch API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/pb-privacy-api.md) - [Download Email Recommendation Log](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/pb-email-rec-log.md) - _Salesforce Help_: [Customize the Calls](https://help.salesforce.com/articleView?id=mktg.mc_pb_customize_the_calls.htm) Rights of ALBERT EINSTEIN are used with permission of The Hebrew University of Jerusalem. Represented exclusively by Greenlight. # Email Represents an classic email created in Email Studio. ## Properties | Name | Data Type | Description | | ----------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `CategoryID` | Int | Specifies the identifier of the folder. | | `CharacterSet` | String | Indicates encoding used in an email message. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ClonedFromID` | Int | ID of email message from which the specified email message was created. | | `ContentAreas` | Array of objects | Contains information about content areas included in an email message. | | `ContentCheckStatus` | String | Indicates whether content validation has completed for this email message. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `EmailType` | String | Defines preferred email type. | | `Folder` | String | Specifies folder information (Retrieve only) - Deprecated. | | `HTMLBody` | String | Contains HTML body of an email message. | | `HasDynamicSubjectLine` | Boolean | Indicates if email message contains a dynamic subject line. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `IsActive` | Boolean | Specifies if the object is active. | | `IsHTMLPaste` | Boolean | Indicates if email message was created via pasted HTML. | | `ModifiedDate` | DateTime | Last time object information was modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Status` | [SubscriberStatus](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriberstatus.md) object | Defines status of object. | | `Subject` | String | Contains subject area information for a message. | | `TextBody` | String | Contains raw text body of a message. | # Email An object that represents a classic email in Email Studio. **note:** To manage Content Builder emails, use the [Assets endpoints in REST API](/docs/marketing/marketing-cloud/references/mc_rest_assets). ## Properties | Name | Data Type | Description | | ----------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CategoryID` | Int | Specifies the identifier of the folder containing the email. | | `CharacterSet` | String | Indicates encoding used in an email message. Valid values include:
  • **us-ascii** (United States)
  • **shift-jis** (Japanese)
  • **EUC-KR** (Korean)
  • **iso-8859-1** (Western European)
  • **big5** (Chinese)
  • **koi8-r** (Russian)
  • **utf-8** (Unicode)
  • **iso-2022-JP** (Japanese)
  • **iso-8859-2** (Central European)
  • **ISO-8859-11** (Thai)
  • **GB2312** (Simplified Chinese)
  • **iso-8859-6** (Arabic)
| | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ClonedFromID` | Int | ID of email message from which the specified email message was created. | | `ContentAreas` | Array of objects | Contains information about content areas included in an email message. | | `ContentCheckStatus` | String | Indicates whether content validation has completed for this email message. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `EmailType` | [EmailType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailtype.md) | Indicates whether the email contains HTML or plain text. | | `Folder` | String | Specifies folder information (Retrieve only) - Deprecated. | | `HasDynamicSubjectLine` | Boolean | Indicates whether email message contains a dynamic subject line. | | `HTMLBody` | String | Contains HTML body of an email message. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsActive` | Boolean | Specifies whether the object is active. | | `IsHTMLPaste` | Boolean | Indicates whether email message was created via pasted HTML. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only by using the API. | | `PreHeader` | String | Contains text used in preheader of email message on mobile devices. | | `Status` | String | Defines status of object. Status of an address. | | `Subject` | String | Contains subject area information for a message. | | `SyncTextWithHTML` | Boolean | Makes the text version of an email contain the same content as the HTML version. | | `TextBody` | String | Contains raw text body of a message. | | `__AdditionalEmailAttribute1` | String | Optional field that lets you specify up to five email attributes in `CREATE` or `RETRIEVE` calls. Used to capture analytics or other metadata. Additional attributes are `AdditionalEmailAttribute2`, `AdditionalEmailAttribute3`, and so on. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - _Salesforce Help_: [Personalization Strings in Email Studio](https://help.salesforce.com/articleView?id=mktg.mc_es_available_personalization_strings.htm) - [Create a Text-Only Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_text_only_email_via_the_web_service_api.md) - [Create a Triggered Send Email Campaign Workflow](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_triggered_email_campaign_workflow.md) - [Create an Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_email_via_the_web_service_api.md) - [Assets Endpoints (REST API)](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_assets) # Email The MCP server for Marketing Cloud Engagement includes several tools for managing email. This table includes information about MCP tools related to managing emails. | Tool Name | Description | Required Scopes | | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- | | `sfmc_create_email_send_definition` | Create an email send definition for transactional messaging. | Channels \| Email \| Write | | `sfmc_create_triggered_send_definition` | Create a triggered send definition. | Channels \| Email \| Write | | `sfmc_get_transactional_send_status` | Get the status of a transactional email send request.

Special considerations: Read-only, open-world | Channels \| Email \| Read | | `sfmc_get_triggered_send_summary` | Retrieve metrics (including sends, opens, clicks, and bounces) for a triggered send.

Special considerations: Read-only, open-world | Channels \| Email \| Read | | `sfmc_send_transactional_email` | Send a transactional email by specifying a message definition. | Channels \| Email \| Send | Email - Manage Send Definitions (REST API) # Email - Manage Send Definitions (REST API) Manage send definitions for sending transactional emails. A send definition is a configuration record that links email content to sending parameters. Salesforce REST API manages email send definitions. All operations require authentication with a Bearer token. This table lists the use cases that the API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Create a send definition | [POST](/docs/marketing/marketing-cloud-growth/references/mc-next-email-send-definitions?meta=createSendDefinition) | /sobjects/ListEmail | | Retrieve a send definition | [GET](/docs/marketing/marketing-cloud-growth/references/mc-next-email-send-definitions?meta=getSendDefinition) | /sobjects/ListEmail/{id} | | Update a send definition | [PATCH](/docs/marketing/marketing-cloud-growth/references/mc-next-email-send-definitions?meta=updateSendDefinition) | /sobjects/ListEmail/{id} | | Query send definitions | [GET](/docs/marketing/marketing-cloud-growth/references/mc-next-email-send-definitions?meta=querySendDefinitions) | /query | **Version:** 1.0.0 Contact: Salesforce Marketing Cloud, https://developer.salesforce.com ## Servers * `https://{subdomain}.my.salesforce.com/services/data/{versionNumber}` Salesforce REST API * `subdomain (default n/a) Your Salesforce tenant-specific subdomain.` * ``versionNumber (default n/a) The Salesforce API version number, such as `v68.0`.`` ## Operations ### POST Create a send definition `POST /sobjects/ListEmail` Operation ID: `createSendDefinition`. Tags: Send Definitions. Creates a ListEmail record that contains a send definition. Use the resulting send definition ID in requests to Direct Email Send API. #### Request body (required) Media type: `application/json`. Schema: `SendDefinitionCreate`. _Example_ ``` { "Name": "welcome-email@1.0.0", "FromName": "Northern Trail Outfitters", "FromAddress": "noreply@example.com", "ReplyToAddress": "support@example.com", "ManagedContentId": "20YSB000004Fzs52AC", "MessagePurpose": "Transactional", "IsOpenTrackingEnabled": true, "IsClickTrackingEnabled": true, "Status": "Draft" } ``` #### Responses * **201** Send definition created successfully. Media type: `application/json`. Schema: `object`. * `id` (_string_) The new send definition ID. * `success` (_boolean_) Indicates whether the operation succeeded. * `errors` (_array of object_) Array of errors if the operation failed. _Example_ ``` { "id": "0XBSG000000NY5p4AG", "success": true, "errors": [] } ``` * **400** Bad Request - Invalid field values or missing required fields Media type: `application/json`. Schema: `SalesforceError`. _Example: duplicateValue_ Duplicate Name ``` [ { "message": "duplicate value found: Name duplicates value on record", "errorCode": "DUPLICATE_VALUE", "fields": [ "Name" ] } ] ``` _Example: fieldIntegrity_ Unverified From Address ``` [ { "message": "The FromAddress is not verified", "errorCode": "FIELD_INTEGRITY_EXCEPTION", "fields": [ "FromAddress" ] } ] ``` * **401** Unauthorized - Invalid or expired token Media type: `application/json`. Schema: `SalesforceError`. * **403** Forbidden - Insufficient permissions or feature not enabled Media type: `application/json`. Schema: `SalesforceError`. _Example: insufficientAccess_ Insufficient Access ``` [ { "message": "insufficient access rights on object id", "errorCode": "INSUFFICIENT_ACCESS" } ] ``` _Example: featureNotEnabled_ Feature Not Enabled ``` [ { "message": "Access denied: feature not enabled for tenant", "errorCode": "FEATURE_NOT_ENABLED" } ] ``` ### GET Retrieve a send definition `GET /sobjects/ListEmail/{id}` Operation ID: `getSendDefinition`. Tags: Send Definitions. Retrieves a send definition by its ID. #### Parameters * `id` (path, string, required) The send definition ID. Pattern: ^\[a-zA-Z0-9\]+. _Example_ ``` 0XBSG000000NY5p4AG ``` #### Responses * **200** Send definition retrieved successfully Media type: `application/json`. Schema: `SendDefinition`. _Example_ ``` { "Id": "0XBSG000000NY5p4AG", "Name": "welcome-email@1.0.0", "FromName": "Northern Trail Outfitters", "FromAddress": "noreply@example.com", "ReplyToAddress": "support@example.com", "ManagedContentId": "20YSB000004Fzs52AC", "MessagePurpose": "Transactional", "IsOpenTrackingEnabled": true, "IsClickTrackingEnabled": true, "Status": "Draft", "Description": "Welcome email template" } ``` * **401** Unauthorized - Invalid or expired token Media type: `application/json`. Schema: `SalesforceError`. * **404** Not Found - The send definition specified in the request doesn’t exist. Media type: `application/json`. Schema: `SalesforceError`. ### PATCH Update a send definition `PATCH /sobjects/ListEmail/{id}` Operation ID: `updateSendDefinition`. Tags: Send Definitions. Updates a send definition. Include only the fields that you want to change. #### Parameters * `id` (path, string, required) The send definition ID. Pattern: ^\[a-zA-Z0-9\]+. _Example_ ``` 0XBSG000000NY5p4AG ``` #### Request body (required) Media type: `application/json`. Schema: `SendDefinitionUpdate`. _Example_ ``` { "FromName": "Updated Team Name", "IsOpenTrackingEnabled": false } ``` #### Responses * **204** The send definition was updated successfully. * **400** Bad Request - The value of a field in the request was invalid. Media type: `application/json`. Schema: `SalesforceError`. * **401** Unauthorized - The authorization token is invalid or expired. Media type: `application/json`. Schema: `SalesforceError`. * **403** Forbidden - The permissions associated with the token are insufficient to perform the action. Media type: `application/json`. Schema: `SalesforceError`. * **404** Not Found - The email send definition doesn’t exist. Media type: `application/json`. Schema: `SalesforceError`. ### GET Query send definitions `GET /query` Operation ID: `querySendDefinitions`. Tags: Send Definitions. Query send definitions with a Salesforce Object Query Language (SOQL) query. #### Parameters * `q` (query, string, required) A SOQL query string. _Example: listRecent_ List recent send definitions. ``` SELECT Id, Name, FromName, Status FROM ListEmail WHERE Status != 'Deleted' ORDER BY CreatedDate DESC LIMIT 10 ``` _Example: findByName_ Find a send definition by name. ``` SELECT Id, Name, ManagedContentId, Status FROM ListEmail WHERE Name = 'welcome-email@1.0.0' ``` _Example: filterByFromAddress_ Filter send definitions by From address. ``` SELECT Id, Name, FromAddress, MessagePurpose FROM ListEmail WHERE FromAddress = 'noreply@example.com' AND Status = 'Draft' ``` _Example: findByContent_ Find send definitions by managed content ID. ``` SELECT Id, Name, FromName, Status FROM ListEmail WHERE ManagedContentId = '20YSB000004Fzs52AC' ``` #### Responses * **200** The query executed successfully. Media type: `application/json`. Schema: `object`. * `totalSize` (_integer_) The number of records that the query returned. * `done` (_boolean_) Indicates whether all records were returned in the response. * `records` (_array of SendDefinition_) An array that contains send definition records. _Example_ ``` { "totalSize": 2, "done": true, "records": [ { "Id": "0XBSG000000NY5p4AG", "Name": "welcome-email@1.0.0", "FromName": "Northern Trail Outfitters", "Status": "Draft" }, { "Id": "0XBSG000000NY5p5AG", "Name": "event-reminder@1.0.0", "FromName": "NTO Events", "Status": "Active" } ] } ``` * **400** Bad Request - The SOQL query in the request was invalid. Media type: `application/json`. Schema: `SalesforceError`. * **401** Unauthorized - The token used in the request was invalid or expired. Media type: `application/json`. Schema: `SalesforceError`. ## Schemas ### SendDefinitionCreate An object that contains the fields used to create a send definition. * `Name` (_string_, required) A unique identifier for the definition. Use the format `package-name@version`. Example: `welcome-email@1.0.0`. * `FromName` (_string_, required) The sender display name. Example: `Northern Trail Outfitters Team`. * `FromAddress` (_string (email)_, required) The verified sender email address. The address you specify must be verified in your org. Example: `noreply@example.com`. * `ReplyToAddress` (_string (email)_) The reply-to email address. Example: `support@example.com`. * `ManagedContentId` (_string_, required) The CMS content record ID. The content you specify must be published. Pattern: ^\[a-zA-Z0-9\]+. Example: `20YSB000004Fzs52AC`. * `MessagePurpose` (_string_, required) The email classification: * `Transactional`: Operational, service-related email, such as order confirmations, password resets, account notifications, or shipping updates. * `Commercial`: Marketing and promotional messages, such as newsletters, product promotions, event invitations, or surveys. Allowed values: `Transactional`, `Commercial`. * `IsOpenTrackingEnabled` (_boolean_, required) Indicates whether to track email opens using a tracking pixel. * `IsClickTrackingEnabled` (_boolean_, required) Indicates whether to track link clicks by rewriting URLs. * `Status` (_string_) The status of the send definition. Allowed values: `Draft`, `Active`, `Deleted`. Default: `Draft`. * `Description` (_string_) An internal description of the definition. * `CampaignId` (_string_) The associated Salesforce Campaign reference. ### SalesforceError Salesforce error response. Array of `object`. * `message` (_string_) A human-readable error message. * `errorCode` (_string_) A machine-readable error code. * `fields` (_array of string_) An array that lists the fields that caused the error. ### SendDefinition A complete send definition record. * `Id` (_string_) The send definition record ID. Pattern: ^\[a-zA-Z0-9\]+. Example: `0XBSG000000NY5p4AG`. * `Name` (_string_) A unique identifier for the definition. Example: `welcome-email@1.0.0`. * `FromName` (_string_) The sender display name. Example: `Northern Trail Outfitters Team`. * `FromAddress` (_string (email)_) The verified sender email address. Example: `noreply@example.com`. * `ReplyToAddress` (_string (email)_) The reply-to email address. Example: `support@example.com`. * `ManagedContentId` (_string_) The CMS content record ID. Pattern: ^\[a-zA-Z0-9\]+. Example: `20YSB000004Fzs52AC`. * `MessagePurpose` (_string_) Allowed values: `Transactional`, `Commercial`. * `IsOpenTrackingEnabled` (_boolean_) Indicates whether email opens are tracked. * `IsClickTrackingEnabled` (_boolean_) Indicates whether link clicks are tracked. * `Status` (_string_) Allowed values: `Draft`, `Active`, `Deleted`. * `Description` (_string_) An internal description of the definition. * `CampaignId` (_string_) The associated Salesforce Campaign reference. * `CreatedDate` (_string (date-time)_, read-only) When the record was created. * `LastModifiedDate` (_string (date-time)_, read-only) When the record was last modified. ### SendDefinitionUpdate Fields for updating a send definition. Include only the fields that you want to change. * `Name` (_string_) A unique identifier for the definition. * `FromName` (_string_) The sender display name. * `FromAddress` (_string (email)_) The verified sender email address. * `ReplyToAddress` (_string (email)_) The reply-to email address. * `ManagedContentId` (_string_) The CMS content record ID. * `MessagePurpose` (_string_) Allowed values: `Transactional`, `Commercial`. * `IsOpenTrackingEnabled` (_boolean_) Indicates whether to track email opens. * `IsClickTrackingEnabled` (_boolean_) Indicates whether to track link clicks. * `Status` (_string_) Allowed values: `Draft`, `Active`, `Deleted`. * `Description` (_string_) * `CampaignId` (_string_) Email - Preview and Send (Direct Email Send API) # Email - Preview and Send (Direct Email Send API) Use Direct Email Send API to send transactional emails. All operations require authentication with a Bearer token that has the `sfap_api` scope. This table lists the use cases that the API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Send an email to a recipient | [POST](/docs/marketing/marketing-cloud-growth/references/mc-next-email-direct-send?meta=sendEmail) | /messaging/email/v1 | | Send an email to multiple recipients | [POST](/docs/marketing/marketing-cloud-growth/references/mc-next-email-direct-send?meta=sendBulkEmail) | /messaging/email/v1/bulk | | Preview a rendered email | [POST](/docs/marketing/marketing-cloud-growth/references/mc-next-email-direct-send?meta=previewEmail) | /messaging/email/v1/preview | **Version:** 1.0.0 Contact: Salesforce Marketing Cloud, https://developer.salesforce.com ## Servers * `https://api.salesforce.com/automation/actions360` Production server ## Operations ### POST Send an email to a single recipient `POST /messaging/email/v1` Operation ID: `sendEmail`. Tags: Messaging - Email. Renders and sends an email to a single recipient using the specified send definition. #### Parameters * `sendDefinitionId` (query, string, required) The unique ID of the send definition. Pattern: ^\[a-zA-Z0-9\]+. _Example_ ``` 0XBWs000000ugHVOAY ``` #### Request body (required) Media type: `application/json`. Schema: `object`. * `individualId` (_string_, required) The unique recipient identifier in Data 360, in the form `Individual__dlm/{id}`. Example: `Individual__dlm/user-001`. * `attributes` (_object_, required) The personalization data for the message. Keyed by the Apex class name defined in the CMS content. The key must match the class name exactly. Additional properties: `object`. The field-value pairs passed to the content template, as defined by the Apex class. _Example_ ``` { "WelcomeEmailInput": { "firstName": "John", "lastName": "Doe", "company": "Northern Trail Outfitters" } } ``` * `subject` (_string_) Overrides the subject that the content template renders for this recipient. * `body` (_string_) Overrides the HTML body that the content template renders for this recipient. * `text` (_string_) Overrides the plain-text body that the content template renders for this recipient. _Example_ ``` { "individualId": "Individual__dlm/user-001", "attributes": { "WelcomeEmailInput": { "firstName": "John", "lastName": "Doe", "company": "Northern Trail Outfitters" } } } ``` #### Responses * **200** Email sent successfully Media type: `application/json`. Schema: `object`. * `requestId` (_string_) The unique identifier of this send request. * `properties` (_object_) * `deliveryId` (_string_) The delivery tracking identifier for this message. _Example_ ``` { "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "properties": { "deliveryId": "del_abc123xyz" } } ``` * **400** Bad Request - A required field is missing or the request body is invalid. Media type: `application/json`. Schema: `Error`. * **401** Unauthorized - The authentication token is expired or invalid. Media type: `application/json`. Schema: `Error`. * **403** Forbidden - The feature isn’t enabled for the tenant, or the token scope isn’t sufficient to perform the action. Media type: `application/json`. Schema: `Error`. * **404** Not Found - The send definition specified in the request wasn’t found. Media type: `application/json`. Schema: `Error`. * **429** Too Many Requests - The request was rate limited. Implement an exponential backoff strategy before retrying the request. Media type: `application/json`. Schema: `Error`. ### POST Send an email to multiple recipients `POST /messaging/email/v1/bulk` Operation ID: `sendBulkEmail`. Tags: Messaging - Email. Renders and sends an email to multiple recipients in a single request using the specified send definition. #### Parameters * `sendDefinitionId` (query, string, required) The send definition record ID. Pattern: ^\[a-zA-Z0-9\]+. _Example_ ``` 0XBWs000000ugHVOAY ``` #### Request body (required) Media type: `application/json`. Schema: `object`. * `recipients` (_array of object_, required) The list of recipients. Each element contains the same properties as a single-send request body. * `individualId` (_string_, required) The unique identifier of the recipient in Data 360. Use this syntax to specify the ID: `Individual__dlm/{id}`. * `attributes` (_object_, required) The personalization data for the recipient, keyed by the Apex class name. Additional properties: `object`. * `subject` (_string_) Overrides the subject for this recipient. * `body` (_string_) Overrides the HTML body for this recipient. * `text` (_string_) Overrides the plain-text body for this recipient. _Example_ ``` { "recipients": [ { "individualId": "Individual__dlm/user-001", "attributes": { "WelcomeEmailInput": { "firstName": "John", "lastName": "Doe", "company": "Northern Trail Outfitters" } } }, { "individualId": "Individual__dlm/user-002", "attributes": { "WelcomeEmailInput": { "firstName": "Jane", "lastName": "Smith", "company": "Northern Trail Outfitters" } } } ] } ``` #### Responses * **200** Bulk email request accepted Media type: `application/json`. Schema: `object`. * `requestId` (_string_) The unique identifier for the batch request. * **400** Bad Request - A required field is missing or the body of the request is invalid. Media type: `application/json`. Schema: `Error`. * **401** Unauthorized - The token used in the request is expired or invalid. Media type: `application/json`. Schema: `Error`. * **403** Forbidden - The feature isn’t enabled for the tenant, or the permission scope for the token isn’t sufficient to perform the requested action. Media type: `application/json`. Schema: `Error`. * **404** Not Found - The send definition specified in the request wasn’t found. Media type: `application/json`. Schema: `Error`. * **429** Too Many Requests - The request was rate limited. Implement an exponential backoff strategy and then retry. Media type: `application/json`. Schema: `Error`. ### POST Preview a rendered email `POST /messaging/email/v1/preview` Operation ID: `previewEmail`. Tags: Messaging - Email. Renders an email with the supplied data and returns the result without sending. Use the preview operation to confirm that a template and data combination renders correctly before you send. #### Parameters * `sendDefinitionId` (query, string, required) The send definition (ListEmail) record ID. Pattern: ^\[a-zA-Z0-9\]+. _Example_ ``` 0XBWs000000ugHVOAY ``` #### Request body (required) Media type: `application/json`. Schema: `object`. * `individualId` (_string_, required) The recipient identifier used to resolve personalization data. * `attributes` (_object_, required) The personalization data, keyed by the Apex class name. Additional properties: `object`. _Example_ ``` { "individualId": "Individual__dlm/test-user", "attributes": { "WelcomeEmailInput": { "firstName": "John", "lastName": "Doe", "company": "Northern Trail Outfitters" } } } ``` #### Responses * **200** Rendered email preview Media type: `application/json`. Schema: `object`. * `response` (_object_) * `subject` (_string_) The rendered subject line. * `body` (_string_) The rendered HTML body. * `text` (_string_) The rendered plain-text body. * `preheader` (_string_) The rendered preheader text. _Example_ ``` { "response": { "subject": "Welcome to Northern Trail Outfitters, John!", "body": "..rendered HTML..", "text": "Welcome to NTO, John! ...", "preheader": "Your account is ready to use!" } } ``` * **400** Bad Request - A required field is missing or the request body is invalid. Media type: `application/json`. Schema: `Error`. * **401** Unauthorized - The token is expired or invalid Media type: `application/json`. Schema: `Error`. * **403** Forbidden - The feature isn’t enabled for the tenant, or the scope of the token isn’t sufficient to perform the action. Media type: `application/json`. Schema: `Error`. * **404** Not Found - The send definition specified in the request wasn’t found. Media type: `application/json`. Schema: `Error`. * **429** Too Many Requests - The request was rate limited. Implement an exponential backoff strategy and retry. Media type: `application/json`. Schema: `Error`. ## Schemas ### Error * `message` (_string_) A message that describes the error that occurred. _Example_ ``` { "message": "The send definition wasn’t found." } ``` # Email Activity Format The version 2 email activity, also known as send email activity, allows you to send email messages from within your journeys. This activity type can’t be used in a custom activity. **warning:** Existing version 1 email activities remain in the legacy format and function as normal until they are edited. When a marketer edits and saves a send email activity, Journey Builder automatically upgrades the activity by mapping the data to the version 2 format. ## [](#journey-specification-format)Journey Specification Format The activity must be formatted as specified below. The following JSON object is included in the `activities` array of a journey, as defined in the Journey Specification. ## Helpful Hints - The email activity creates a triggered send which it uses during runtime to deliver the email message. - When a journey is unpublished, the triggered send is set to inactive. - If the activity is republished, the triggered send is reactivated to keep reporting numbers for accurate versions. - You can obtain the sender profile ID and delivery profile ID by going to Email Studio > Admin > Delivery Settings. - The email you configure for use with this activity must meet certain delivery standards. - Contain a Profile Center link - Pass validations - Contain only valid AmpScript and SSJS - Must not contain any errors - If an exception occurs while publishing the journey containing an invalid email, the errors will display in the Journey Builder UI. ## Sample Request ```js { "type": "EMAILV2", "key": "", "name": "", "applicationId": "", "outcomes": [ { "key": "", "next": "" } ], "metaData":{ "icon":"/img/email-icon.svg", "iconSmall":"/img/email-icon.svg", "category":"message", "version":"1.0", "isConfigured":true }, "configurationArguments":{ "triggeredSend":{ "emailId":"", "emailSubject": "", "preHeader":"", "description":"", "campaigns":[ { "id":"", "name":"", "color":"" } ], "sendClassificationId":"", "senderProfileId":"", "deliveryProfileId":"", "publicationListId":"", "suppressionLists":[ { "name":"", "id":"" } ], "domainExclusions":[ { "name":"", "id":"" } ], "exclusionFilter":"", "isTrackingClicks":true, "isMultipart":true, "isSendLogging":true, "suppressTracking":true, "ccEmail":"", "bccEmail":"", "keyword":"", "throttleLimit":500, "throttleOpens":"12:00", "throttleCloses":"12:30", "isSalesforceTracking":true } } } ``` ## Sample Response ```js { "id": "", "key":"", "name":"", "type":"EMAILV2", "outcomes":[ { "next": "" "arguments":{}, "metaData":{} } ], "arguments":{ }, "configurationArguments":{ "triggeredSend":{ "emailId":"", "emailSubject": "", "preHeader":"", "description":"", "campaigns":[ { "id":"", "name":"", "color":"" } ], "sendClassificationId":"", "senderProfileId":"", "deliveryProfileId":"", "publicationListId":"", "suppressionLists":[ { "name":"", "id":"" } ], "domainExclusions":[ { "name":"", "id":"" } ], "exclusionFilter":"", "isTrackingClicks":true, "isMultipart":true, "isSendLogging":true, "suppressTracking":true, "ccEmail":"", "bccEmail":"", "keyword":"", "throttleLimit":500, "throttleOpens":"12:00", "throttleCloses":"12:30", "isSalesforceTracking":true } }, "metaData":{ "icon":"/img/email-icon.svg", "iconSmall":"/img/email-icon.svg", "category":"message", "version":"1.0", "isConfigured":true } } ``` ## Related Items [Journey Specification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.md) # Email functions These functions allow you to access and control email messages within your Marketing Cloud Engagement account. ## Load Use the Email Server-Side JavaScript Functions In your server-side JavaScript code, first load the core library using the syntax below: ``` Platform.Load("core", "1"); ``` ## Initialization To interact with an email via server-side JavaScript, you must first initialize the object. The code below initializes an email with the external key of 'myEmail'. ``` var myEmail = Email.Init("myEmail"); ``` Once you initialize the email, you can use the associated functions. You can’t set the external key for an email message manually via the user interface. You can manually set the external key of an email address created via the SOAP API, or you can find the appropriate value by performing a retrieve on the email message and taking the value from the results. # EmailAddress Defines an email address that’s used to communicate with a subscriber. ## Properties | Name | Data Type | Description | | ------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------- | | `Address` | String | Address used to communicate with a subscriber. | | `AddressType` | String | The type of address. | | `Statuses` | Array of [AddressStatus](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/addressstatus.md) objects | Array of status values for an address. | | `Type` | [EmailType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailtype.md) | Indicates the type of email to send to the address. Possible values: `Text` or `HTML`. | # EmailAddress Represents an email address for a subscriber. ## Properties | Name | Data Type | Description | | ------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Address` | String | The physical mailing address required at the bottom of all email messages contains the information described by this property (no P.O. Boxes). The address used to communicate with a Person. | | `AddressType` | String | Indicates what type of address this object represents. | | `Statuses` | Array of [AddressStatus](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/addressstatus.md) objects | Array of status values for an address. | | `Type` | [EmailType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailtype.md) object | Indicates the type of email to send to the address. Possible values: `Text` or `HTML`. | ## Related Items - [Unsubscribe and Log an UnsubEvent with a LogUnsubEvent Execute Call](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/unsubscribing_and_logging_an_unsubevent_with_a_logunsubevent_execute_call.md "Unsubscribing_and_Logging_an_UnsubEvent_with_a_LogUnsubEvent_Execute_Call") # Emails These technical articles include information related to managing email using SOAP API. - [Create a Text-Only Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_text_only_email_via_the_web_service_api.md) - [Create an Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_email_via_the_web_service_api.md) - [Retrieve Additional Email Attributes](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_additional_email_attributes.md) - [Retrieve an Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_an_email_via_the_soap_api.md) - [Retrieve the Email Folder Hierarchy](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_email_folder_hierarchy.md) - [Update the Subject and Body of an Email Message](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/updating_the_subject_and_body_of_an_email_message.md) # EmailSendDefinition An object that contains the content, sender profile, delivery profile, and audience information for a classic Email Studio message. **note:** To manage Content Builder emails, use the [Assets endpoints in REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_assets). To create an email send definition with a send definition list where the value of `DataSourceTypeID` is `List` and the value of `SendDefinitionListType` is `SourceList`, you need the **Email | Subscribers | List | SendEmailToList** permission. To create or update an email send definition with a send definition list where the ID is the All Subs List, you need the **Email | Subscribers | All Subscribers | SendEmailToList** and **View** permissions. To start or test an email send definition using the [Perform](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/perform.md) method, you need the **Email | Content | Email | Send** or **Test Send** permissions. ## Properties | Name | Data Type | Description | | ------------------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Additional` | String | The ID for a send that customers use as a campaign ID. This property contains external campaign ID information or more metadata that appears in the tracking extract, and there is a personalization string for it. You can set this information at the time of the send or within an email send definition. | | `AutoBccEmail` | String | Defines blind carbon copy email address to which to send a message as part of an email send definition. | | `BccEmail` | String | Indicates email addresses to receive blind carbon copy of a message. The BccEmail property allows access to the BCC feature if enabled on the account. It doesn’t error out if feature isn’t enabled. The API returns no tracking information for BCC emails. You must specify this property in an email send definition. You can’t specify this property at send time. However, you can create a profile attribute for this property and pass in a value at send time. | | `CategoryID` | Int | Specifies the identifier of the folder. | | `CCEmail` | String | Carbon copy email address. You must specify the CCEmail property in an email send definition, as you can’t specify this property at send time. You can create a profile attribute for this property and pass in a value at send time, however. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DeduplicateByEmail` | Boolean | Indicates whether a send definition de-duplicates multiple emails sent to the same email address. Set to `true` to ensure that only one message is sent to a single email address, if that email appears on several different lists or data extensions in a send definition. | | `DeliveryProfile` | [DeliveryProfile](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofile.md) object | Identifies the delivery profile included in a send classification. | | `DeliveryScheduledTime` | DateTime | Defines scheduled data and time for a send related to an email send definition. | | `Description` | String | Describes and provides information regarding the object. | | `DomainType` | [DeliveryProfileDomainTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofiledomaintypeenum.md) | Defines the type of domain associated with a delivery profile or send definition. Valid values include DefaultDomain or CustomDomain. | | `DynamicEmailSubject` | String | Contains content to be used in a dynamic subject line. | | `Email` | [Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/email.md) object | Default email address for object. Indicates if subscriber information can be used for email sends. | | `EmailSubject` | String | Subject for an email send. This property is required when updating a user-initiated send definition. If you don’t pass the new subject to the email send definition, it retains the old subject for that definition. You must also specify the send classification to use as part of the send. | | `ExclusionFilter` | String | Contains a string of AMPscript that can evaluate to true or false, used to exclude email addresses from a send definition. If you include an ExclusionFilter in a create call, you must also include the SendDefinitionList property. The ExclusionFilter property can cause performance issues with send time for large amounts of email addresses. Use the data filter function if you experience performance problems. | | `FooterContentArea` | [ContentArea](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apicontentarea.md) | Defines footer content area to use as part of a delivery profile or send definition. | | `FooterSalutationSource` | [SalutationSourceEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/salutationsourceenum.md) | Defines source of a footer salutation to use as part of a delivery profile or send definition. Valid values include:
  • Default
  • Content Library
  • None
| | `FromAddress` | String | Indicates From address associated with a object. Deprecated for email send definitions and triggered send definitions. | | `FromName` | String | Specifies the default email message From Name. Deprecated for email send definitions and triggered send definitions. | | `HeaderContentArea` | [ContentArea](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apicontentarea.md) | Defines content area to be used in the header of a delivery profile or a send definition. | | `HeaderSalutationSource` | [SalutationSourceEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/salutationsourceenum.md) | Defines source of header salutation for a delivery profile or send definition. Valid values include:
  • Default
  • Content Library
  • None
| | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `IsMultipart` | Boolean | Indicates whether the email is sent with Multipart/MIME enabled. | | `IsSeedListSend` | Boolean | Indicates whether a email send includes the use of a seed list. | | `IsSendLogging` | Boolean | Indicates whether send logging is enabled for the specified send definition. | | `IsWrapped` | Boolean | Indicates whether an email send contains the links necessary to process tracking information for clicks. | | `Keyword` | String | Not used. | | `MessageDeliveryType` | [MessageDeliveryTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/messagedeliverytypeenum.md) | Enumerates the types of message delivery options available for email send definitions. Valid values include:
  • Standard - use as default unless your account is configured to handle burst sending
  • DelayedDeliveryByMTAQueue
| | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `PreHeader` | String | Contains text used in preheader of email message on mobile devices. | | `PrivateDomain` | [PrivateDomain](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privatedomain.md) object | Defines private domain to use as part of a delivery profile or send definition. | | `PrivateIP` | [PrivateIP](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/privateip.md) object | Contains information about the private IP address associated with a delivery profile. | | `ReplyToAddress` | String | Specifies the reply address used for any messages sent using this send definition. | | `ReplyToDisplayName` | String | Optional value that specifies the display name for the email address contained in the ReplyToAddress property. | | `SeedListOccurance` | Int | Property definition. | | `SendClassification` | [SendClassification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sendclassification.md) object | Indicates the send classification to use as part of a send definition. This field is required when updating a user-initiated send definition. | | `SendDefinitionList` | Array of [SendDefinitionList](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senddefinitionlist.md) objects | Indicates the subscriber list to use as part of an email send definition. | | `SenderProfile` | [SenderProfile](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/senderprofile.md) object | Identifies the sender profile included in the send classification. | | `SendLimit` | Int | Indicates limit of messages to send as part of a send definition within a predefined send window. | | `SendWindowClose` | DateTime | Defines the end of a send window for a send definition. | | `SendWindowDelete` | Boolean | Indicates whether an existing send window for a send definition is deleted. | | `SendWindowOpen` | DateTime | Defines the beginning of a send window for a send definition. | | `SourceAddressType` | [DeliveryProfileSourceAddressTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/deliveryprofilesourceaddresstypeenum.md) | Indicates the source IP address type used with the delivery profile. Valid values include DefaultPrivateIPAddress and CustomPrivateIPAddress. | | `SuppressTracking` | Boolean | Indicates whether the send definition suppresses tracking results for associated sends. | | `TestEmailAddr` | String | Defines an email address to which to send a test message as part of an email send definition.Use the Test action when sending a test email to an email send definition. | | `TimeZone` | [TimeZone](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/timezone.md) object | Contains time zone information for an Account. For Create and Update calls, this property defines the time zone for an Account object. On a Retrieve call, TimeZone indicates which time zone is in effect for the Account object in question. Without a specific time zone, the Account defaults to Central Standard Time. | | `TrackingUsers` | Array of [TrackingUser](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/trackinguser.md) objects | Defines account users with access to tracking information for that send definition. | ## Methods | Name | Description | | ----------------------- | ----------------------------------------------------- | | [Create](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create.md) | Creates an individual object or a batch of objects. | | [Delete](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md) | Deletes an individual object or a batch of objects. | | [Perform](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/perform.md) | Manages asynchronous processes. | | [Retrieve](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve.md) | Retrieves an individual object or a batch of objects. | | [Update](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/update.md) | Updates an individual object or a batch of objects. | ## See Also - _Salesforce Help_: [Data Filters with Enhanced Subscriber Features](https://help.salesforce.com/s/articleView?id=mktg.mc_es_data_filters_with_enhanced_subscriber_feature.htm) - _Salesforce Help_: [Personalization Strings](https://help.salesforce.com/articleView?id=mktg.mc_es_personalization_strings.htm) - [Create, Perform, and Delete Email Send Definitions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_performing_and_deleting_email_send_definitions.md) - [Create an Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_email_send_definition_using_the_web_service_api.md) - [Create an Email Send Definition with Dynamic Content](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_email_send_definition_with_dynamic_content_using_the_web_service_api.md) - [Create a List-Based Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_email_send_definition.md) - [Retrieve the Audience of an Email Send Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_audience_of_send_definition.md) # EmailType The HTML versus text formats for an email object. The email type can’t be updated through the API. If your update request specifies a different email type value, the API ignores it. ## Values | Name | Description | | ------------------ | ------------------------------------------------------------------------------------------------------------ | | `Normal (HTML)` | Indicates that messages are formatted as HTML. | | `Text Only (Text)` | Indicates that the data extension field holds text data, so the email message consists of text-only content. | ## Related Items - [Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/email.md) - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) # EmailType The message formats for emails and subscriber preferences. ## Values | Name | Description | | ------------------ | ------------------------------------------------- | | `Normal (HTML)` | Indicates a standard HTML email. | | `Text Only (Text)` | Indicates an email that contains only plain text. | ## Related Items - [Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/email.md) - [EmailAddress](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/emailaddress.md) - [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) # Empty() Tests to see if a variable has a value. If the variable has a value, the function returns `false`. If the variable is an empty string or null, the function returns `true`. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). In Marketing Cloud Engagement, the `variable` parameter can be a variable, a string literal, or a number. In Marketing Cloud Next, the `variable` parameter must refer to a variable. If it isn’t a variable, the function returns an error. ## Syntax ``` Empty(variable) ``` The `Empty()` function has this parameter: - `variable` (string): Required. The variable that you want to test to see if it’s empty. ## Usage You can combine the `Empty()` function combined with If statements or the [Iif()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-iif.md) function to test for empty or null values, and to output the values of variables that aren't empty. This example declares three variables, assigns a text string to one, an empty string to another, and leaves the third unset. ``` %%[ Var @empty_var, @null_var, @non_empty_var Set @non_empty_var = "Hello, world!" Set @empty_var = "" ]%%

@empty_var: %%= Iif(not Empty(@empty_var), @empty_var, "Empty or null") =%%

@null_var: %%= Iif(not Empty(@null_var), @null_var, "Empty or null") =%%

@non_empty_var: %%= Iif(not Empty(@non_empty_var), @non_empty_var, "Empty or null") =%%

``` The example produces this output. ``` @empty_var: Empty or null @null_var: Empty or null @non_empty_var: Hello, world! ``` # Encode a JWT Using a Customer Key You can create a customer key, and then use it to encode custom journey requests as JSON Web Tokens (JWTs). By encoding requests as JWTs, your external application can validate that requests issued by custom journeys originate from Marketing Cloud Engagement. ## Prerequisites To encode a JWT, you must provide a cryptographic salt. Marketing Cloud Engagement uses this salt to increase the encrypted key’s security. The salt must be encoded in hexadecimal. You can use command-line programs to convert your salt to hexadecimal. The procedure for converting your salt to hexadecimal depends on your operating system. - In Windows PowerShell, enter this command: `'' | Format-Hex` - In macOS, Linux, or Unix terminals, enter this command: `echo -n '' | xxd -p` In these commands, replace `` with your salt string. Both commands return a hexadecimal-encoded string. Add the `0x` prefix to the beginning of the hexadecimal string to get a salt value. For example, the string `E9!wU3@0P02l` is equivalent to the hexadecimal string `45392177553340305030326c`. The complete hexadecimal salt string becomes `0x45392177553340305030326c`. ## Create the External Key Complete these steps to create a security key to use in Journey Builder. 1. In Marketing Cloud Engagement Setup, under Data Management, click **Key Management**. 2. Click **Create**. 3. For **Key Type**, choose **Salt** 4. For **Name**, enter a name for the key. 5. For **External Key**, enter your external key. The value that you enter can only contain ASCII characters. 6. For **Salt**, enter the hexadecimal-encoded salt. 7. Save the key. ## Configure a Journey Builder Custom Activity When you use the API to create a custom REST activity in a journey, you can require the activity to use the provided salt to encode requests as JWTs. 1. In the arguments of the custom activity, specify the parameter `"useJwt": true`. 2. Set the value of `customerKey` to equal the external key. **note:** If your application is only registered for a single stack, you can omit the `customerKey` parameter. If you do, Marketing Cloud Engagement uses your application’s signature as the signing key. ## Decode a JWT To decode a JWT, use an HS256 JWT validation library such as `jose`, `JWT.NET`, or `java-jwt`. For Salt keys, pass to the library the JWT and the unencoded salt string, which is the string before conversion to hexadecimal. ## Journey Payload Example This sample journey request body includes a custom REST activity. The custom activity uses a JWT to securely interact with an external application. ```json { "key": "", "name": "", "version": 1, "workflowApiVersion": 1, "activities": [ { "key": "REST-1", "name": "Custom REST Activity", "type": "REST", "outcomes": [ { "next": null } ], "arguments": { "execute": { "inArguments": [ { "message": "" } ], "outArguments": [], "url": "https://example.com/post.php?dir=et_rest_activity_execute", "body": "", "header": "", "useJwt": true, "customerKey": "", "timeout": 10000 } }, "configurationArguments": { "save": { "url": "https://example.com/post.php?dir=et_rest_activity_save", "body": "", "header": "", "useJwt": true, "customerKey": "" }, "validate": { "url": "https://example.com/post.php?dir=et_rest_activity_validate", "body": "", "header": "", "useJwt": true, "customerKey": "" }, "publish": { "url": "https://example.com/post.php?dir=et_rest_activity_publish", "body": "", "header": "", "useJwt": true, "customerKey": "" } }, "metaData": { "isConfigured": true } } ], "triggers": [], "goals": [], "entryMode": "SingleEntryAcrossAllVersions", "executionMode": "Production", "status": "Draft" } ``` ## Related Items - [Create an Encryption Key](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_create_a_key.htm) - [Encode with JWT Signing Secret](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encode-custom-activities-using-jwt-app-signature.md) # Encode Custom Activities Using a JWT Marketing Cloud Engagement uses JSON Web Tokens (JWTs) to validate the identity of API calls to your custom activities. Use a JWT for activities that retrieve sensitive data or perform sensitive actions. JWTs are encoded, but they aren’t encrypted. Encryption is handled at the transport layer using Secure Sockets Layer (SSL). To use a JWT, your application must have SSL enabled. When your application calls the API, Marketing Cloud Engagement posts the encoded JWT to the activity’s endpoint. The JWT lets your application know that the user calling the API is an authorized user. You can obtain a JWT by providing your customer key. Alternatively, you can use your JWT signing secret as a signing key. ## Customer Key Use an external key the signing key. Pass the external key into the `customerKey` field in the body of the custom activity request. (The external key and customer key are synonyms.) ## JWT Signing Secret You can use the JWT Signing Secret for your application as a fallback signing key. Use this method when the `customerKey` isn’t included in the custom activity request body. This method is helpful in situations where an integration partner hosts an application used by multiple users. By passing the Signing Secret, you can determine the origin of a custom activity request. ## Related Items - [Encode with Customer Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encode-custom-activities-using-jwt-customer-key.md) - [Encode with JWT Signing Secret](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encode-custom-activities-using-jwt-app-signature.md) # Encode with JWT Signing Secret ## How to Get a JWT Journey Builder uses the JWT Signing Secret from the package containing the activity as the default signing key for the JWT. ## How to Add a JWT to an Activity Set `"useJwt": true` in the activity's arguments for each call (save, validate, publish, execute) for which you wish to receive a JWT. If you don't include a `customerKey`, Journey Builder uses the JWT Signing Secret to verify the JWT. If you are using the External Key as the signing key, then `customerKey` is required. ## Sample Journey ```json var ixn = { "id": "...", "key": "...", "name": "My journey", "version": 1, "workflowApiVersion": 1, "activities": [ { "key": "REST-1", "name": "Custom REST Activity", "type": "REST", "outcomes": [ { "next": null } ], "arguments": { "execute": { "inArguments": [ { "message": "someMessage" } ], "outArguments": [], "url": "https://example.com/post.php?dir=et_rest_activity_execute", "body": "{email-body}", "header": "", "useJwt": true, "timeout": 10000 } }, "configurationArguments": { "save": { "url": "https://example.com/post.php?dir=et_rest_activity_save", "body": "", "header": "", "useJwt": true, }, "validate": { "url": "https://example.com/post.php?dir=et_rest_activity_validate", "body": "", "header": "", "useJwt": true, }, "publish": { "url": "https://example.com/post.php?dir=et_rest_activity_publish", "body": "", "header": "", "useJwt": true, } }, "metaData": { "isConfigured": true } } ], "triggers": [], "goals": [], "entryMode": "SingleEntryAcrossAllVersions", "executionMode": "Production", "status": "Draft" }; ``` ## Related Items [Encode with Customer Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/encode-custom-activities-using-jwt-customer-key.md) # Encoded JWT Your application login endpoint will receive a parameter called JWT, which is a string consisting of three parts: 1. Encoded JWT Header 2. JWT Second Part 3. JWT Third Part These parts occur in the above order separated by period ('.') delimiters. Each part contains base64url encoded content: ```base64 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9. eyJleHAiOjEzNDkyMzg0MzcsImlzcyI6Imh0dHBzOi8vaW1oLmV4YWN0dGFyZ2V0LmNvbSIsInJlcXVlc3QiOnsiY2xh aW1zVmVyc2lvbiI6MSwidXNlciI6eyJpZCI6MTA0MTQyNjcsIm9hdXRoVG9rZW4iOiJ3ZmRwZ3Y0c2U4eTQ4amM0bXI1 aGJndzciLCJlbWFpbCI6Im1jbGFya0BleGFjdHRhcmdldC5jb20iLCJpbnRlcm5hbE9hdXRoVG9rZW4iOiIwRVlhcUoy Rl9oMUh1UkVSQ2JmVWhXRjlndEFNU2c4NmxiR2dxMlJfNy0tZzNwaHlOTmJ2MW93aTdEWHdpMGliZyJ9LCJvcmdhbml6 YXRpb24iOnsiaWQiOjEwNDkwNzU0LCJlbnRlcnByaXNlSWQiOjEwNDkwNzU0LCJkYXRhQ29udGV4dCI6ImVudGVycHJp c2UiLCJzdGFja0tleSI6IlMxIn0sImFwcGxpY2F0aW9uIjp7ImlkIjoiOGIxZWJiMjQtOWU2OS00N2VhLTllNzItMWU5 MTE0YTU0M2I3IiwiY3VzdG9tZXJFbnZpcm9ubWVudCI6IlByb2QiLCJyZWRpcmVjdFVybCI6Imh0dHBzOi8vand0LmV4 YWN0dGFyZ2V0YXBwcy5jb20vIn19fQ. ChpXrkdZj5obVfooRlXzOEsTk_ydAATrkIcM0POhnA8 ``` ## Related Items - [Single Sign On](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/single-sign-on.md) - [Decode the JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/decode-jwt.md) - [Explanation of Decoded JWT](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/explanation-decoded-jwt.md) # EncryptSymmetric() Encrypts plain text data using the supplied algorithm and encryption values. You can supply either a value or a valid external key for the password, initialization vector (IV), and salt. You can also use the external keys if you previously created keys in the Key Management section of the Marketing Cloud Engagement web interface. If you haven't created any keys, the function generates a password using the password parameter or stored value, the salt parameter or stored value, and the IV parameter or stored value. If you don't pass or reference an initialization vector, the function uses the password parameter or stored value as the initialization vector. This function treats Salt and IV values either directly provided or looked up by key as hex strings, with each pair of characters representing a single byte in the larger strings. Don't attempt to use these values as a cipher string, because you can’t successfully decrypt those strings using this function. You can wrap the `EncryptSymmetric()` and `DecryptSymmetric()` functions in `Base64Encode()` and `Base64Decode()` functions to view the final string in plain text. You can only use the `EncryptSymmetric()` and `DecryptSymmetric()` AMPscript functions on data contained in Marketing Cloud Engagement. You can't use these functions with third-party encryption and decryption functionality. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` EncryptSymmetric(data, encryptionAlgorithm, passwordExternalKey, passwordValue, saltExternalKey, saltValue, ivExternalKey, ivValue) ``` The `EncryptSymmetric()` function has eight parameters: - `data` (string): Required. The plain text string to encrypt. - `encryptionAlgoritm` (string): Required. The algorithm to use to encrypt the data. See [Encryption Algorithm Options](#encryption-algorithm-options). - `passwordExternalKey` (string): Required. The external key of a password that was created in Key Management. - `passwordValue` (string): Required. The password value. - `saltExternalKey` (string): Required. The external key of a salt in Key Management. - `saltValue` (string): Required. The salt value, represented as an 8-byte hexadecimal string. - `ivExternalKey` (string): Required. The external key of an initialization vector in Key Management. - `ivValue` (string): Required. The initialization vector, represented as a 16-byte hexadecimal string. ## Encryption Algorithm Options To use this function, specify an encryption algorithm. Three algorithms are available. - `aes` — AES (Advanced Encryption Standard) - `des` — DES (Data Encryption Standard) - `tripledes` — Triple DES (applies the DES cipher to each data block three times) Of these options, AES is the most secure, followed by Triple DES, and then DES. When you use the DES or Triple DES algorithms, you can optionally specify a mode of operation. To specify a mode of operation, add a semicolon after the algorithm type, followed by `mode=` and the name of the cipher mode. Five cipher modes are available. - `cbc` - Cipher Block Chaining (default) - `cfb` - Cipher Feedback - `cts` - Ciphertext Stealing - `ecb` - Electronic Codebook - `ofb` - Output Feedback You can also include a padding method. To specify the padding method, add a semicolon after the mode of operation, followed by `padding=` and one of these options. - `ansix923` - ANSI X9.23 - `iso10126` - ISO 10126 - `none` - No padding - `pkcs7` - PKCS#7/RFC 5652 (this is the default padding method) - `zeros` - All bytes padded with zeros For example, to use Triple DES encryption with Cipher Feedback and ANSI X9.23 padding, specify `tripledes;mode=cfb;padding=ansix923` as the value of the second parameter. ## Usage This example sets the `@encData` variable to the encrypted value of the plain text supplied in the function (in this case, the word `Example`). This example uses provided values for the password, salt, and IV, and it sets any external key values to the undeclared variable `@null`. The Salt and IV values provided in this example represent hex string values. The Salt value includes 8 bytes of information, and the IV value provides 16 bytes. ``` %%[ Set @encData=EncryptSymmetric('Example', /* String to encrypt */ 'aes', /* Encryption algorithm */ @null, /* Password external key */ 'password', /* Password */ @null, /* Salt external key */ '0000000000000000', /* Salt value */ @null, /* IV external key */ '00000000000000000000000000000000' /* External key value */) ]%% ``` This example generates an encrypted string using Triple DES encryption with Cipher Feedback and ANSI X9.23 padding. ``` %%[ Var @encData, @string, @password, @salt, @iv Set @string = "Example" Set @password = "password" Set @salt="20192027EEBF11C8" Set @iv = "1493786BAE6088BA1EF0B505B4EF9852" Set @encData = EncryptSymmetric(@string, "tripledes;mode=cfb;padding=ansix923", @null, @password, @null, @salt, @null, @iv) ]%% %%=v(@encData)=%% ``` The function outputs the encrypted string. ``` 6eCZjiaICrQ= ``` ## See Also - [DecryptSymmetric()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-decrypt-symmetric.md) - _Salesforce Help_: [Key Management in Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_key_management.htm) # EndImpressionRegion Denotes the end of a region to track using impression tracking. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` EndImpressionRegion(boolEndAllRegions) ``` The `EndImpressionRegion()` function has one parameter: - `boolEndAllRegions` (boolean): If `true` or `1`, the function ends all previous impression regions. If `false`, the function only closes the preceding impression region. The default value is `false`. ## Usage To call the function, determine whether you want to end all impression regions, or only the impression region that preceded it. This example ends the preceding impression region only. ``` %%=EndImpressionRegion(false)=%% ``` This example ends all of the impression regions in the message. ``` %%=EndImpressionRegion(true)=%% ``` The system automatically ends all impression regions that aren’t explicitly closed by the end of the email. ## See Also - [BeginImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-begin-impression-region.md) - _Salesforce Help_: [Track Content Performance with Impression Regions](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_impression_regions.htm) # EndImpressionRegion ## Overview Ends an impression region within the supplied content. You can use the impression region to identify specific areas of content for analytical purposes. ### Syntax EndImpressionRegion(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------- | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **1** | Boolean | | Indicates whether the function closes all nested impression regions. A value of true closes all nested impression regions. A value of false does not close all nested impression regions. | ## Example ```

Step 1: Country Code


Step 2: First Name

Step 3: Last Name

Step 4: Favorite Food

``` ### customEvent.js Postmonger is required for communication between Journey Builder and the custom event. ```javascript define(["js/postmonger"], function (Postmonger) { "use strict"; var connection = new Postmonger.Session(); var payload = {}; var lastStepEnabled = false; var steps = [ // initialize to the same value as what's set in config.json for consistency { key: "selectCountry", label: "selectCountry" }, { key: "enterFirstName", label: "enterFirstName" }, { key: "enterLastName", label: "enterLastName" }, { key: "enterFavoriteFood", label: "enterFavoriteFood", active: false }, ]; var currentStep = steps[0].key; $(window).ready(onRender); connection.on("initEvent", initialize); connection.on("requestedTokens", onGetTokens); connection.on("requestedEndpoints", onGetEndpoints); connection.on("clickedNext", onClickedNext); connection.on("clickedBack", onClickedBack); connection.on("gotoStep", onGotoStep); function initialize(data) { var countryCode; var firstName; var lastName; if (data) { payload = data; } if (payload["arguments"]) { countryCode = payload["arguments"].countryCode; firstName = payload["arguments"].firstName; lastName = payload["arguments"].lastName; } $("#select-country-code").val(countryCode); $("#select-first-name").val(firstName); $("#select-last-name").val(lastName); } function onGetTokens(tokens) { // Response: tokens = { token: , fuel2token: } // console.log(tokens); } function onGetEndpoints(endpoints) { // Response: endpoints = { restHost: } i.e. "rest.s1.qa1.exacttarget.com" // console.log(endpoints); } function onClickedNext() { if ( (currentStep.key === "enterLastName" && steps[3].active === false) || currentStep.key === "enterFavoriteFood" ) { save(); } else { connection.trigger("nextStep"); } } function onClickedBack() { connection.trigger("prevStep"); } function onGotoStep(step) { showStep(step); connection.trigger("ready"); } function onRender() { connection.trigger("ready"); // JB will respond the first time 'ready' is called with 'initEvent' connection.trigger("requestTokens"); connection.trigger("requestEndpoints"); $("#toggleLastStep").click(function () { lastStepEnabled = !lastStepEnabled; // toggle status steps[3].active = !steps[3].active; // toggle active connection.trigger("updateSteps", steps); }); } function showStep(step, stepIndex) { if (stepIndex && !step) { step = steps[stepIndex - 1]; } currentStep = step; $(".step").hide(); switch (currentStep.key) { case "selectCountry": $("#step1").show(); break; case "enterFirstName": $("#step2").show(); $("#step2 input").focus(); break; case "enterLastName": $("#step3").show(); $("#step3 input").focus(); break; case "enterFavoriteFood": $("#step4").show(); $("#step4 input").focus(); break; } } function save() { var countryCode = $("#select-country-code") .find("option:selected") .attr("value"); var firstName = $("#select-first-name").val(); var lastName = $("#select-last-name").val(); var favoriteFood = $("#select-favorite-food").val(); payload["arguments"] = payload["arguments"] || {}; payload["arguments"].countryCode = countryCode; payload["arguments"].firstName = firstName; payload["arguments"].lastName = lastName; // Example criteria - if 'filterExpressionEnabled' is set to true in config.json, Journey Builder will // populate this step with the 'criteria' XML passed here // payload['arguments'].criteria = ""; if (favoriteFood && steps[3].active) { payload["arguments"].favoriteFood = favoriteFood; } payload["metaData"] = payload["metaData"] || {}; payload["configurationArguments"] = payload["configurationArguments"] || {}; payload.dataExtensionId = ""; connection.trigger("updateEvent", payload); } }); ``` # Example REST Activity ## config.json ```json { "workflowApiVersion": "1.1", "metaData": { "icon": "images/sms.png", "category": "message" }, "type": "REST", "lang": { "en-US": { "name": "REST Activity (Workflow API v1.1)", "description": "An example REST activity using workflow API v1.1 format." } }, "arguments": { "execute": { "inArguments": [ { "emailAddress": "{{InteractionDefaults.Email}}" }, { "phoneNumber": "{{Contact.Default.PhoneNumber}}" } ], "outArguments": [ { "foundSignupDate": "" } ], "url": "https://some-endpoint.com/execute" } }, "configurationArguments": { "save": { "url": "URI/for/your/activity/save" }, "publish": { "url": "URI/for/your/activity/publish" }, "validate": { "url": "URI/for/your/activity/validate" }, "stop": { "url": "URI/for/your/activity/stop" } }, "wizardSteps": [ { "label": "Step 1", "key": "step1" }, { "label": "Step 2", "key": "step2" }, { "label": "Step 3", "key": "step3" }, { "label": "Step 4", "key": "step4", "active": false } ], "userInterfaces": { "configModal": { "height": 200, "width": 300, "fullscreen": true } }, "schema": { "arguments": { "execute": { "inArguments": [ { "phoneNumber": { "dataType": "Phone", "isNullable": false, "direction": "in" } }, { "emailAddress": { "dataType": "Email", "isNullable": false, "direction": "in" } } ], "outArguments": [ { "foundSignupDate": { "dataType": "Date", "direction": "out", "access": "visible" } } ] } } } } ``` ## index.html Every custom activity must have an index.html in the root of its endpoint. ```html Custom Journey Builder Activity
Select your SMS message:
Here's a second page with some info on it.
You chose the message:
Hey, here's a fourth step, just for you. Toggle this on or off from step 1.
``` ## customActivity.js Postmonger is required for communication between Journey Builder and the activity. ```javascript define(["postmonger"], function (Postmonger) { "use strict"; var connection = new Postmonger.Session(); var payload = {}; var lastStepEnabled = false; var steps = [ // initialize to the same value as what's set in config.json for consistency { label: "Step 1", key: "step1" }, { label: "Step 2", key: "step2" }, { label: "Step 3", key: "step3" }, { label: "Step 4", key: "step4", active: false }, ]; var currentStep = steps[0].key; $(window).ready(onRender); connection.on("initActivity", initialize); connection.on("requestedTokens", onGetTokens); connection.on("requestedEndpoints", onGetEndpoints); connection.on("clickedNext", onClickedNext); connection.on("clickedBack", onClickedBack); connection.on("gotoStep", onGotoStep); function onRender() { // JB will respond the first time 'ready' is called with 'initActivity' connection.trigger("ready"); connection.trigger("requestTokens"); connection.trigger("requestEndpoints"); // Disable the next button if a value isn't selected $("#select1").change(function () { var message = getMessage(); connection.trigger("updateButton", { button: "next", enabled: Boolean(message), }); $("#message").html(message); }); // Toggle step 4 active/inactive // If inactive, wizard hides it and skips over it during navigation $("#toggleLastStep").click(function () { lastStepEnabled = !lastStepEnabled; // toggle status steps[3].active = !steps[3].active; // toggle active connection.trigger("updateSteps", steps); }); } function initialize(data) { if (data) { payload = data; } var message; var hasInArguments = Boolean( payload["arguments"] && payload["arguments"].execute && payload["arguments"].execute.inArguments && payload["arguments"].execute.inArguments.length > 0 ); var inArguments = hasInArguments ? payload["arguments"].execute.inArguments : {}; $.each(inArguments, function (index, inArgument) { $.each(inArgument, function (key, val) { if (key === "message") { message = val; } }); }); // If there is no message selected, disable the next button if (!message) { showStep(null, 1); connection.trigger("updateButton", { button: "next", enabled: false }); // If there is a message, skip to the summary step } else { $("#select1") .find("option[value=" + message + "]") .attr("selected", "selected"); $("#message").html(message); showStep(null, 3); } } function onGetTokens(tokens) { // Response: tokens = { token: , fuel2token: } // console.log(tokens); } function onGetEndpoints(endpoints) { // Response: endpoints = { restHost: } i.e. "rest.s1.qa1.exacttarget.com" // console.log(endpoints); } function onClickedNext() { if ( (currentStep.key === "step3" && steps[3].active === false) || currentStep.key === "step4" ) { save(); } else { connection.trigger("nextStep"); } } function onClickedBack() { connection.trigger("prevStep"); } function onGotoStep(step) { showStep(step); connection.trigger("ready"); } function showStep(step, stepIndex) { if (stepIndex && !step) { step = steps[stepIndex - 1]; } currentStep = step; $(".step").hide(); switch (currentStep.key) { case "step1": $("#step1").show(); connection.trigger("updateButton", { button: "next", enabled: Boolean(getMessage()), }); connection.trigger("updateButton", { button: "back", visible: false, }); break; case "step2": $("#step2").show(); connection.trigger("updateButton", { button: "back", visible: true, }); connection.trigger("updateButton", { button: "next", text: "next", visible: true, }); break; case "step3": $("#step3").show(); connection.trigger("updateButton", { button: "back", visible: true, }); if (lastStepEnabled) { connection.trigger("updateButton", { button: "next", text: "next", visible: true, }); } else { connection.trigger("updateButton", { button: "next", text: "done", visible: true, }); } break; case "step4": $("#step4").show(); break; } } function save() { var name = $("#select1").find("option:selected").html(); var value = getMessage(); // 'payload' is initialized on 'initActivity' above. // Journey Builder sends an initial payload with defaults // set by this activity's config.json file. Any property // may be overridden as desired. payload.name = name; payload["arguments"].execute.inArguments = [{ message: value }]; payload["metaData"].isConfigured = true; connection.trigger("updateActivity", payload); } function getMessage() { return $("#select1").find("option:selected").attr("value").trim(); } }); ``` ## Sample Request Sample POST data sent to `https://some-endpoint.com/execute`. ```js { "inArguments": [ { "emailAddress": "{{InteractionDefaults.Email}}" }, { "phoneNumber": "{{Contact.Default.PhoneNumber}}" } ], "outArguments": [], "activityObjectID": "1234abcd-56ef-78gh-90ij-9876klmn5432", "journeyId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "activityId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "definitionInstanceId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "activityInstanceId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "keyValue": "someContactKeyHere", "mode": 0 } ``` ## Sample Response Sample 200 OK response expected from the server. ```js { "foundSignupDate": "2016-03-10" } ``` ## Related Items - [Build Custom Activities and Events](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating-activities.md) # Execute Use the Execute method to get access to and execute individual or batches of helper requests. The helper functions provide access to functionality that would be tedious to build using other methods. Requests execute in the order they are added to the `ExecuteRequest` array. An `ExecuteRequest` object accepts an unlimited number of request parameters. Each request type has a set number of request parameters that are required to make the request work or to configure the request. ## Parameters This method has the following parameters. | Name | Data Type | Description | | ----------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `RequestID` | String | A unique identifier for the request. This parameter requires a null RequestId string. By default, this value is a GUID. | | `Requests` | [ExecuteRequest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/executerequest.md) object | An array of ExecuteRequest objects that specify the execution properties for a method. The objects are acted on in the order they have been added. This array can hold different ExecuteRequest types, which allows you to execute complex interactions in one call. | | `Results` | Array of [ExecuteResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/executeresponse.md) objects | The results of a method execution returned as an output parameter. | ## Request Types - [GetFolderHierarchy](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_email_folder_hierarchy.md) - This method retrieves the email folder hierarchy for an account. - MasterUnsub - Deprecated: Use the Subscriber Object to unsubscribe a subscriber. ## Output | Name | Data Type | Description | | --------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `[ExecuteResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/executeresponse.md)` | Array | An array of objects that contains a list of return values. The objects are returned in the order they’re executed. This array contains one `ExecuteResponse` object for `ExecuteRequest` object in the request. | | `OverallStatus` | String | The overall status of the request. Valid status values include:
  • `OK` - All requests were successfully executed.
  • `Has Error` - When executing multiple APIObject requests, this status code states that some of the operations failed, while some succeeded.
  • `Error` - All execute operations failed during validation or processing.
| # Execute via WSProxy To execute an action, use the execute function. - The first parameter is an array of Name/Value parameters to include in the call. - The second parameter is the name of the execute request. ## Example Request This example shows the parameters but is not a working example. ``` var prox = new Script.Util.WSProxy(); var props = [ { Name: "SomeName", Value: "SomeValue" } ]; var data = prox.execute(props, "Name of the execute request"); ``` ## Example Response The returned object has three properties, “Status”, “RequestID”, and “Results.” The results contain properties from the SOAP ExecuteResponse items. ``` { "Status": "OK", "RequestID": "fb768ddc-6670-4183-8b9d-4f0d5518bb2e", "Results": [...] } ``` # ExecuteFilter() Executes a data filter and returns an unordered rowset that contains the results. This function only works with data filters that are based on data extensions. You can’t use this function with data filters that are based on profile attributes. Use this function only on CloudPages, landing pages, microsites, and SMS messages created in MobileConnect. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` ExecuteFilter(dataFilterExternalId) ``` The `ExecuteFilter()` function has one parameter: - `dataFilterExternalId` (string): Required. The external ID of the data filter to execute. This function only works with data filters that are based on data extensions. ## Usage This example uses a data extension called "MembershipRewardsProgramme," which contains the data in this table. | MemberId | FirstName | Surname | RewardsPoints | RewardsTier | Area | | -------- | --------- | ---------- | ------------- | ----------- | ----------- | | 1 | Dennis | Smithers | 92374 | 2 | Chelsea | | 2 | Pooja | Chatterjee | 201042 | 1 | Hammersmith | | 3 | Tomás | Santos | 69311 | 3 | Kensington | | 4 | Sun-Hi | Kim | 23999 | 4 | Twickenham | | 5 | Jian | Yeh | 15123 | 4 | Chelsea | The account also contains a data filter called "MembershipRewardsProgramme_50k points plus," with an external key of `c5a7e0d9-41e0-4068-bdcc-8766d7c1af94`. This data filter searches for all values in which the number in the RewardsPoints column is greater than or equal to 50000. This code example filters the data extension based on the data filter. ``` %%[ Var @rows, @rowCount, @filterExtId Set @filterExtId = "c5a7e0d9-41e0-4068-bdcc-8766d7c1af94" Set @rows = ExecuteFilter(@filterExtId) Set @rowCount = RowCount(@rows) If @rowCount > 0 then For @counter = 1 to @rowCount do Var @row, @rank, @memberId, @firstName, @surname, @rewardsPoints, @rewardsTier, @area Set @row = Row(@rows, @counter) Set @memberId = Field(@row, "MemberId") Set @firstName = Field(@row, "FirstName") Set @surname = Field(@row, "Surname") Set @rewardsPoints = Field(@row, "RewardsPoints") Set @area = Field(@row, "Area") ]%% %%[ Next @counter EndIf ]%%
Rank MemberId FirstName Surname RewardsPoints Area
%%=v(@counter)=%% %%=v(@memberId)=%% %%=v(@firstName)=%% %%=v(@surname)=%% %%=v(@rewardsPoints)=%% %%=v(@area)=%%
``` The code example returns a table that contains values from the rowset. | Rank | MemberId | FirstName | Surname | RewardsPoints | Area | | ---- | -------- | --------- | ---------- | ------------- | ----------- | | 1 | 1 | Dennis | Smithers | 92374 | Chelsea | | 2 | 2 | Pooja | Chatterjee | 201042 | Hammersmith | | 3 | 3 | Tomás | Santos | 69311 | Kensington | # ExecuteFilterOrderedRows() Executes a data filter and returns an ordered rowset that contains the results. This function only works with data filters that are based on data extensions. You can’t use this function with data filters that are based on profile attributes. Use this function only on CloudPages, landing pages, microsites, and SMS messages created in MobileConnect. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` ExecuteFilterOrderedRows(dataFilterExternalId, numRows, sortColumn) ``` The `ExecuteFilterOrderedRows()` function has three parameters: - `dataFilterExternalId` (string): Required. The external ID of the data filter to execute. This function only works with data filters that are based on data extensions. - `numRows` (number): Required. The number of rows to return in the rowset. A value of `0` returns all results. There’s no maximum number of rows that can be returned. - `sortColumn` (string): Required. The column to sort data by, followed by a space and either "ASC" (for ascending order) or "DESC" (descending). ## Usage This example uses a data extension called "MembershipRewardsProgramme," which contains the data in this table. | MemberId | FirstName | Surname | RewardsPoints | RewardsTier | Area | | -------- | --------- | ---------- | ------------- | ----------- | ----------- | | 1 | Dennis | Smithers | 92374 | 2 | Chelsea | | 2 | Pooja | Chatterjee | 201042 | 1 | Hammersmith | | 3 | Tomás | Santos | 69311 | 3 | Kensington | | 4 | Sun-Hi | Kim | 23999 | 4 | Twickenham | | 5 | Jian | Yeh | 15123 | 4 | Chelsea | The account also contains a data filter called "MembershipRewardsProgramme_50k points plus," with an external key of `c5a7e0d9-41e0-4068-bdcc-8766d7c1af94`. This data filter searches for all values in which the number in the RewardsPoints column is greater than or equal to 50000. This code example filters the data extension based on the data filter and sorts the results in descending order based on the values in the RewardsPoints column. ``` %%[ Var @rows, @rowCount, @filterExtId Set @filterExtId = "c5a7e0d9-41e0-4068-bdcc-8766d7c1af94" Set @rows = ExecuteFilterOrderedRows(@filterExtId, 0, "RewardsPoints DESC") Set @rowCount = RowCount(@rows) If @rowCount > 0 then For @counter = 1 to @rowCount do Var @row, @rank, @memberId, @firstName, @surname, @rewardsPoints, @rewardsTier, @area Set @row = Row(@rows, @counter) Set @memberId = Field(@row, "MemberId") Set @firstName = Field(@row, "FirstName") Set @surname = Field(@row, "Surname") Set @rewardsPoints = Field(@row, "RewardsPoints") Set @area = Field(@row, "Area") ]%% %%[ Next @counter EndIf ]%%
Rank MemberId FirstName Surname RewardsPoints Area
%%=v(@counter)=%% %%=v(@memberId)=%% %%=v(@firstName)=%% %%=v(@surname)=%% %%=v(@rewardsPoints)=%% %%=v(@area)=%%
``` The code example returns a table that contains values from the rowset. | Rank | MemberId | FirstName | Surname | RewardsPoints | Area | | ---- | -------- | --------- | ---------- | ------------- | ----------- | | 1 | 2 | Pooja | Chatterjee | 201042 | Hammersmith | | 2 | 1 | Dennis | Smithers | 92374 | Chelsea | | 3 | 3 | Tomás | Santos | 69311 | Kensington | # ExecuteRequest An object that contains the execute call for performing utility functions. ## Properties | Name | Data Type | Description | | ------------ | ---------------------------------------------- | --------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `Name` | String | Name of the object or property. | | `Parameters` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Container for key value pairs of parameters for objects. | ## Related Items - [Retrieve the Email Folder Hierarchy](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_email_folder_hierarchy.md) - [Unsubscribe and Log an UnsubEvent with a LogUnsubEvent Execute Call](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/unsubscribing_and_logging_an_unsubevent_with_a_logunsubevent_execute_call.md) # ExecuteResponse An object that contains responses returned by the API for execute calls. ## Properties | Name | Data Type | Description | | --------------- | ---------------------------------------------- | ---------------------------------------------------------------------- | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `Results` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Contains the combination of names and values for the returned results. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | ## Related Items - [Retrieve the Email Folder Hierarchy](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_email_folder_hierarchy.md) # Explanation of the Decoded JWT After you decode the JWT, the JSON request body resembles this example. For multi-tenant applications, such as apps on AppExchange, the `authEndpoint` and `apiEndpointBase` values are the endpoints for the current tenant. ```json { "exp": 1366605874, "jti": "******************", "request": { "claimsVersion": 2, "rest": { "authEndpoint": "AUTH_TOKEN_ENDPOINT", "apiEndpointBase": "REGION_ENDPOINT", "refreshToken": "YOUR_REFRESH_TOKEN" }, "user": { "id": 10083350, "email": "user@example.com", "culture": "en-US", "timezone": { "longName": "(GMT-06:00) Central Time (No Daylight Saving)", "shortName": "CST", "offset": -6.0, "dst": false } }, "organization": { "id": 10088797, "enterpriseId": 10088797, "dataContext": "core", "stackKey": "S1", "region": "NA1" }, "application": { "id": "******************", "package": "sandbox.SSO_APP", "redirectUrl": "https://localhost/SSOExample/Home.aspx", "features": {}, "userPermissions": [] } } } ``` ## Field Reference for Decoded JWT | JSON Element | Description | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | exp | The exp (expiration time) claim identifies the expiration time on or after which the token MUST NOT be accepted for processing. Contains an **IntDate** value in **UTC**. | | request.claimsVersion | The version of the JWT claims structure. Possible values are `1` (legacy version) or `2` (default version for all new apps). | | request.rest.authEndpoint | Contains the request token URL for the environment or region. For multi-tenant applications, it can contain a tenant-specific endpoint. For example, `https://YOUR_TSD.auth.marketingcloudapis.com/v1/requestToken` | | request.rest.apiEndpointBase | Contains the base URL for REST API. For multi-tenant applications, it can contain a tenant-specific endpoint. For example, `https://YOUR_TSD.rest.marketingcloudapis.com/` | | request.rest.refreshToken | An OAuth refresh token for getting an updated access token. The refreshToken is valid for up to 700 days or until it has been used. If the token expires, inform the user to log out and log back in. This process generates a new refresh token for your app. If the refreshToken was used previously, you receive a 401 Unauthorized. The refreshToken has a 5-minute revocation period after use, allowing for more attempts in case the auth service doesn't respond immediately. If your package doesn't have an API Integration component, you don't receive a refreshToken. | | request.user.id | The user ID. | | request.user.oauthToken | This field isn't used in claims version 2. An OAuth token that can access REST Services for the user. The token is valid for 1 hour. For more information, see [Get an Access Token](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-getting-started/get-access-token.md). | | request.user.internalOauthToken | This field isn't used in claims version 2. An OAuth token that can access SOAP API. It’s also referred to as the legacyToken. | | request.user.refreshToken | This field isn't used in claims version 2. An OAuth refresh token for getting an updated oauthToken. Refresh tokens expire after 700 days or after they’ve been used. When the token expires, inform the user to log out and log back in. This process generates a new refresh token for your app. | | request.user.expiresIn | This field isn't used in claims version 2. Length in seconds before the token expires. A value of `1200` is equal to 20 minutes, for example. | | request.user.email | The email address of the user. | | request.user.culture | The culture code of the user. | | request.user.timezone.longName | The friendly name of the user's timezone. | | request.user.timezone.shortName | The timezone code of the user. | | request.user.timezone.offset | The Greenwich Mean Time (GMT) offset. | | request.user.timezone.dst | Is Daylight Savings Time (DST) applied to this timezone setting? | | request.organization.id | The account ID. For agency sub-accounts, this ID is the agency client ID and must match the value for the enterprise ID. For enterprise sub-accounts, ID this is the sub-account ID and can be different from the enterprise ID. | | request.organization.enterpriseId | The top-level enterprise account ID. For agency sub-accounts, use the agency client ID for the enterprise ID. | | request.organization.dataContext | The data context value represents the edition of the account. Possible values are `core` (Marketing Cloud Engagement Core or Advanced Edition), `reseller` (Marketing Cloud Engagement Agency or Agency Client), `tiered` (Marketing Cloud Engagement Enterprise Edition), and `enterprise` (Marketing Cloud Engagement Enterprise 2.0 Edition) | | request.organization.stackKey | The server instance that the account is on. Usual production values are `S1`, `S4`, `S6`, `S7`, `S10`, or `S50`. Used when making Email SOAP API calls to set the appropriate web service end point. | | request.organization.region | The currently supported data center regions are `NA1` and `EU1`. | | request.application.id | The package ID of your application. This value is in the installed package details. | | request.application.customerEnvironment | Distinguishes between production and development environments. | | request.application.redirectUrl | The URL you set for the home page of your application in the installed package. This URL is where you forward the user upon successful completion of SSO through your login page. | | request.application.features | Not used. | | request.application.userPermissions | Not used. | ## Refresh Token Implementation Restrictions Be aware of these restrictions in your implementation code when using the refreshToken to refresh the OauthToken (access token) that is about to expire and keep it contextualized to the logged-in user: - The app must be installed in the account you use to log in. If logging in via Marketing Cloud Engagement and selecting the app from the AppExchange listings, the app is installed in the correct account. - Only use the `refreshToken` parameter in the request body if you need a new contextualized token. - Each time you get a new access token, include a request to GET /platform/v1/endpoints. This request ensures that your app is calling the correct customer endpoints. - If you’re using the scope parameter (retired) while requesting a new access token and you want to contextualize the access token to the logged in user, the internalOauthToken you're using MUST NOT be expired. (The expiration time is denoted in the JWT.request.user.expiresIn value, which is in seconds.) - Here’s an example /requestToken request body structure to follow. ```json { "clientId": "", "clientSecret": "", "refreshToken": "", "accessType": "offline" } ``` When you use this structure to receive a new access token, you also receive a new refreshToken. This newly provided refreshToken must be used in the subsequent call to get a new access token. The previous refreshToken provided in the JWT is now invalid because you’ve used it. ## Related Items - [requestToken Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-getting-started/requestToken.md) - [Your Subdomain and Your Tenant's Endpoints](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/your-subdomain-tenant-specific-endpoints.md) # Extend Content Builder Content Builder includes native editors, called block widgets, used to create and edit the block's content. To give your users a customized editing experience within the Content Builder editor, you can develop custom block widgets with the Content Builder Block SDK. For example, instead of using the CKEditor WYSIWYG for HTML editing, you could use a different WYSIWYG, like QuillJS, by making a block widget for it. Custom blocks are also available in the CloudPages Content Builder editor. ## What’s a Block? A block is the simplest form of subcontent in the Content Builder asset model. A content block is a piece of HTML content that you can build using the Content Builder editor. You can build a content block individually or within a larger asset, like an email or a web page. Each content block has a type that determines what block widget to use. A block widget is a user interface used to create and edit the content of a block. Use the block framework to create your own block widgets. ![A block widget in use in a block framework.](https://developer.salesforce.com/docs/media/images/block_widget.png) ## How Does a Block Widget Work? In its basic form, a block widget is an HTML page that the editor renders in the widgets section. Block widgets use cross-document messages to interact with the editor. To facilitate the communication with the editor, the Content Builder Block SDK exposes available interactions as simple Javascript methods. You can host and serve the block widget as an HTML page from anywhere, then add it as an installed package component. When a user provisions the package, the editor shows the block icon as an available custom block. When the user drags the block icon onto the editor or edits a previously created content block of this type, the block widget’s HTML page opens in an iframe. As the user interacts with the widget, its HTML page uses the SDK to update the content block in the app in real time. ## Related Items - _Salesforce Help_: [Introduction to Content Builder](https://help.salesforce.com/articleView?id=mktg.mc_ceb_content_builder.htm) - [Content Builder Block SDK on GitHub](https://github.com/salesforce-marketingcloud/blocksdk) - [List Your App on AppExchange](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/list-app-appexchange.md) # Extend Journey Builder Journey Builder includes numerous useful out-of-the-box journey components for marketers and developers who use the Journey Builder canvas. | Event Types | Activity Types | Goal Types | | ----------- | --------------------- | ------------ | | Event | MultiCriteriaDecision | ContactEvent | | | DataExtensionUpdate | | | | Email | | | | EngagementDecision | | | | RandomSplit | | | | Wait | | When your business needs expand beyond these components, develop custom events and activities. Marketers then use these custom activities and events on the Journey Builder canvas to extend the native capabilities. ## See Also - _Salesforce Help_: [Journeys and Automations in Marketing Cloud Engagement](https://help.salesforce.com/s/articleView?id=mktg.mc_journeys_and_automations.htm) # Extract Use the `Extract` method to extract a package to a Marketing Cloud Engagement FTP site. Specify the File Transfer Location only when the intent is to deliver the file to a different FTP site. To reduce performance impacts, run data extracts outside of working hours. ## Parameters This method has the parameters described in this table. | Name | Data Type | Description | | ----------- | ---------------------------------------------------- | ------------------------------------------------------------------ | | `RequestID` | String | A unique identifier for the request. | | `Requests` | Array of [ExtractRequest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractrequest.md) objects | The requests specifying execution properties for a method. | | `Results` | Array of [ExtractResult[]](extractresult.md) objects | The results of a method execution returned as an output parameter. | ## Usage This sample SOAP envelope demonstrates how to use the Extract method to initiate a data extract. ```xml Extract urn:uuid:137067bb-1ec4-43e7-ba83-a183bexample e6c2db06-4440-4a6d-8e23-abc0c7ee0e64 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN c7219016-a7f0-4c72-8657-1ec12example StartDate 4/1/2026 1:00:00 AM EndDate 5/31/2026 1:00:00 AM ExtractBounces true ExtractClicks true ExtractConvers true ``` The response provides the status and a unique ID for the request. ```xml OK 03bc4f0a-5527-4b10-8743-f9456example ``` # ExtractDefinition An object that’s used to define and execute an extract request. This object doesn’t support all extract types. Use `ExtractRequest` to handle all extract request types. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ConfigurationPage` | String | The page displayed so that the user can configure the parameters to use when executing a data extract. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PackageKey` | String | Specifies the key associated with an extract package. | | `Parameters` | Array of [ExtractParameterDescription](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdescription.md) objects | Container for key value pairs of parameters for objects. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Values` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | Specifies values associated with an extract definition. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [ExtractRequest Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/executerequest.md) # ExtractDescription An object that describes a specific data extract. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ConfigurationPage` | String | The page displayed so that the user can configure the parameters to use when executing a data extract. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PackageKey` | String | Specifies the key associated with an extract package. | | `Parameters` | Array of [ExtractParameterDescription](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdescription.md) objects | Container for key value pairs of parameters for objects. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extract.md) - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # ExtractOptions Defines options for an extract. ## Properties | Name | Data Type | Description | | ----------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CallsInConversation` | Integer | The number of calls that must be received before the asynchronous API begins processing the conversation. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `Priority` | String | Defines the priority for a triggered send. | | `QueuePriority` | [Priority](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/priority.md) object | Defines the priority for asynchronous sends. Accepted values are `High`, `Medium`, and `Low`. The default value is `Medium`. | | `RequestExpirationTime` | String | The date and time when the asynchronous API request expires. Specify the value in ISO 8601 format with UTC time or with a timezone offset. When you specify both `RequestExpirationTime` and `ScheduledTime` in a request, the `RequestExpirationTime` must occur after the `ScheduledTime`. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | The type of request. Possible values are `synchronous` and `asynchronous`. | | `SaveOptions` | Array of [SaveOption](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/saveoption.md) objects | Specifies how information is overwritten. | | `ScheduledTime` | String | The date and time at which the request must be processed. Specify the value in ISO 8601 format with UTC time or a timezone offset. The specified time can be up to 30 days in the future. | | `SendResponseTo` | Array of [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) objects | Defines how responses are returned and under what conditions. | | `SequenceCode` | Integer | Specifies the processing sequence of a multi-step conversation. This property requires the use of ConversationID. | ## Related Items - [Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extract.md) # ExtractParameter Defines a parameter for an extract. ## Properties | Name | Data Type | Description | | ------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Name` | String | Name of the object or property. | | `Value` | String | Defines value to be used in filter or other object. In filters, the `BETWEEN` operator requires two values. The `IN` operator can handle multiple values. All other operators require only one value. Values of `isNull` or `isNotNull` ignore any supplied values and don’t return an error. | ## Related Items - [Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extract.md) - [ExtractParameterDataType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdatatype.md) - [ExtractParameterDescription object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdescription.md) # ExtractParameterDataType The data types supported for extract parameters. ## Values | Name | Description | | ---------- | ------------------------------------- | | `bool` | Indicates a boolean data type. | | `datetime` | Indicates a date-time data type. | | `dropdown` | Indicates a drop-down menu data type. | | `integer` | Indicates an integer data type. | | `string` | Indicates a string data type. | ## Related Items - [ExtractParameter](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameter.md) # ExtractParameterDescription Defines the parameters in an extract. ## Properties | Name | Data Type | Description | | -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `DataType` | [ExtractParameterDataType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdatatype.md) object | This has been deprecated. Use ValueType. (PropertyDefinition) The data type of the parameter to pass to the Data Extract. Use the data type to dynamically build a user interface with some basic data validation. (ExtractParameterDescription). | | `DefaultValue` | String | The default value for a data extension field if no value is supplied. Include `Now()` as the default value to have the field default to today’s date. Used by `ExtractParameterDescription` as the default value for the parameter if not supplied when a data extract is executed. Used by `PropertyDefinition` if the default value for the attribute if not supplied for a data profile attribute. | | `DropDownList` | String | Specifies the multiple potential values for a dropdown list in an extract parameter. | | `IsOptional` | Boolean | Indicates whether a parameter is optional. | | `Name` | String | Name of the object or property. | ## Related Items - [ExtractParameter](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameter.md) - [ExtractParameterDataType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameterdatatype.md) # ExtractRequest Defines a request to perform an extract. ## Properties | Name | Data Type | Description | | ------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------ | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ID` | String | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `Item` | [ExtractTemplate](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extracttemplate.md) object | Identifies an item in a mapped relationship. | | `Options` | [ExtractOptions](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractoptions.md) object | Options associated with a request. For a Configure call, options include CREATE or DELETE. | | `Parameters` | Array of [ExtractParameter](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractparameter.md) objects | Container for key value pairs of parameters for objects. | # ExtractResult Contains result of an extract request. Returned information includes applicable status and error code information. You can have multiple `ExtractResult` objects returned as the result of a single call. ## Properties | Name | Data Type | Description | | ------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- | | `ConversationID` | String | Unique ID of initial async API call. All requests that are processed as a single unit have the same ConversationID. | | `ErrorCode` | Int | Identifies the error of an API request via a numeric code. | | `OrdinalID` | Int | Defines position of object within an array of information. | | `OverallStatusCode` | String | Represents overall status of conversation via async API. | | `Request` | [ExtractRequest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extractrequest.md) object | Base objects for some types of requests. | | `RequestID` | String | Unique ID of initial async API call. | | `RequestType` | [RequestType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requesttype.md) object | Defines request as synchronous or asynchronous API. | | `ResultDetailXML` | String | Contains details of operation result in XML format. | | `ResultType` | String | Defines result as coming from synchronous or asynchronous API. | | `StatusCode` | String | Status of async API request. | | `StatusMessage` | String | Describes the status of an API call. | # ExtractTemplate Defines a template for performing an extract. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ConfigurationPage` | String | The page displayed so that the user can configure the parameters to use when executing a data extract. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PackageKey` | String | Specifies the key associated with an extract package. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | # Field and Attribute Functions Use the Recipient object to access attributes or fields from sendable data extensions related to the contact receiving the rendered content. Rendered content can appear in messages or web pages. # Field() Returns a specific field from a data row in Marketing Cloud Engagement or a record in Marketing Cloud Next. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` Field(row, fieldName, boolExceptionIfNotFound) ``` The `Field()` function has three parameters: - `row` (string): Required. The row object that contains the field that you want to return. - `fieldName` (string): Required. The name of the field to return from the row. - `boolExceptionIfNotFound` (boolean): If `true`, the function returns an exception if the specified field doesn’t exist. If `false`, the function returns an empty string if the field doesn’t exist. The default value is `true`. ## Usage To use the function, pass it a row and the name of the field from that row that you want to return. This example sets the value of `@field` to the value of the field "FieldName" from the first row of the rowset contained in the @rowset variable. ``` %%[ Set @field = Field(Row(@rowset, 1), "FieldName") ]%% ``` Combine the `Field()` function with the `Row()` function to output a specific piece of data from the specified row. This example creates a rowset from JSON data. The `Row()` function retrieves the first row from the rowset. The `Field()` function retrieves the value of the "Price" attribute from the first row. ``` %%[ Set @json = ' { "Flights": [ { "Origin": "IND", "Dest": "NYC", "Price": 100.0, "PerBagSurcharge": "N/A" }, { "Origin": "IND", "Dest": "LAX", "Price": 200.0, "PerBagSurcharge": "Free" }, { "Origin": "IND", "Dest": "SEA", "Price": 500.0, "PerBagSurcharge": 25 } ] }' Set @rowset = BuildRowsetFromJSON(@json, "$.['Flights'][*]", true) Set @row = Row(@rowset, 1) Set @field = Field(@row, "Price", 0) Output(v(@field)) ]%% ``` The function outputs `100`. ## See Also - [Row()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row.md) # FieldMap Defines how the imported file columns map to attributes. Different SOAP clients render the `SourceName` and `SourceOrdinal` properties differently. ## Properties | Name | Data Type | Description | | ----------------- | --------- | -------------------------------------------- | | `DestinationName` | String | Defines field where imported data resides. | | `Item` | Object | Identifies an item in a mapped relationship. | # Fields ### Syntax () This sub-object allows you to use the associated functions on the fields in a data extension. # Fields.Add Adds a field to a data extension. ## Syntax `Fields.Add(1)` ## Function Properties | Ordinal | Type | Description | | ------- | ------ | ------------------------------------------------------------------ | | `1` | Object | An object that specifies the properties of a data extension field. | The field object can contain these properties. | Name | Type | Description | | -------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CustomerKey` | String | A unique ID for the field. | | `DefaultValue` | String or Number | The default value that’s applied to the field if one isn’t provided when a row is added to the data extension. | | `FieldType` | String | The type of field. Possible values:
  • `Boolean`
  • `Date`
  • `Decimal`
  • `EmailAddress`
  • `Locale`
  • `Number`
  • `Phone`
  • `Text`
| | `IsPrimaryKey` | Boolean | Indicates whether the value of the field is used as a primary key. If `true`, the value is used as a primary key. | | `IsRequired` | Boolean | Indicates whether a value must be provided for the field when a row is added to the data extension. If the value is `true`, the data extension field is required. | | `MaxLength` | Integer | The maximum number of characters that can be specified in the value of a field. For a Text field, the value must be an integer that’s greater than 0 and less than or equal to 4000, and the default value is 50. For a Decimal field, this value specifies the maximum number of digits before and after the decimal point, and the maximum value is 29. | | `Name` | String | Required. The name of the field. | | `Ordinal` | Integer | The position of the field in the data extension. The ordinal value is used when displaying the data extension in Contact Builder. | | `Scale` | Integer | The number of digits that can follow the decimal point in a Decimal field. The minimum value is 0 and the maximum value is 8. | For more information, see [Data Extensions Data Types in Email Studio](https://help.salesforce.com/s/articleView?id=mktg.mc_es_data_extension_data_types.htm). ## Example This code example adds a field to an existing data extension. ``` var de = DataExtension.Init('SSJSTest'); var newField = { Name : "NewFieldV2", CustomerKey : "CustomerKey", FieldType : "Number", IsRequired: true, DefaultValue: "100" }; var status = de.Fields.Add(newField); ``` For information about creating a data extension and adding fields, see [DataExtension.Add](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionAdd.md). ## See Also - [DataExtension.Add](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionAdd.md) - _Salesforce Help_: [Data Extensions Data Types in Email Studio](https://help.salesforce.com/s/articleView?id=mktg.mc_es_data_extension_data_types.htm) # Fields.Retrieve ## Overview Returns an array of JSON objects that describe the available fields in a data extension ### Syntax Fields.Retrieve() ## Example This code initializes a data extension and retrieves information about the fields. ``` var birthdayDE = DataExtension.Init("birthdayDE"); var fields = birthdayDE.Fields.Retrieve(); ``` ``` [ { "Name":"FirstName", "FieldType":"", "IsPrimaryKey":false, "MaxLength":50, "Ordinal":0 "DefaultValue":"" }, { "Name":"LastName", "FieldType":"", "IsPrimaryKey":false, "MaxLength":50, "Ordinal":1 "DefaultValue":"" }, { "Name":"EmailAddress", "FieldType":"", "IsPrimaryKey":true, "MaxLength":100, "Ordinal":3, "DefaultValue":"" }, { "Name":"Birthday", "FieldType":"", "IsPrimaryKey":false, "MaxLength":10, "Ordinal":4, "DefaultValue":"" }, { "Name":"Age", "FieldType":"", "IsPrimaryKey":false, "MaxLength":3, "Ordinal":5, "DefaultValue":"" } ] ``` # Fields.UpdateSendableField ## Overview Updates a data extension field used as part of a send from a current value to a new value ### Syntax Fields.UpdateSendableField(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------ | | **1** | string | **Required** | Attributes of content area to change | ## Example This sample code updates the subscriber key value in a field to a new value: ``` var updateDE = DataExtension.Init('sendableDataExtension'); var status = updateDE.Fields.UpdateSendableField("DifferentSubKey", "Subscriber Key"); ``` File Transfer Locations # File Transfer Locations ## Overview A file location is an FTP site or other file storage location used to transfer files to or from your Marketing Cloud Engagement account. It's useful to create, rotate, manage and delete access keys, such as Amazon S3 credentials and external SFTP usernames and passwords. A file location configuration contains keys, passwords, and URLs. It's used with Automation Studio activities such as: * Imports * Data extracts * File transfer activities ### Base URI `https://{tsd}.rest.marketingcloudapis.com/` In the base URI example here, the abbreviation `{tsd}` is a placeholder to be replaced by the "tenant-specific domain". ### Supported Use Cases | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Create a file location. | [POST](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Create%2Ba%2Bfile%2Btransfer%2Blocation) | data/v1/filetransferlocation | | Get all file locations. | [GET](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Get%2Ball%2Bfile%2Btransfer%2Blocations) | data/v1/filetransferlocations | | Get a specific file location. | [GET](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Get%2Ba%2Bfile%2Btransfer%2Blocation) | data/v1/filtransferlocation/{customerKey} | | Update a specific file location. | [PATCH](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Update%2Ba%2Bfile%2Btransfer%2Blocation) | data/v1/filtransferlocation/{customerKey} | | Deactivate a specific file location. | [DELETE](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Delete%2Ba%2Bfile%2Btransfer%2Blocation) | data/v1/filtransferlocation/{customerKey} | | Validate a file location. | [POST](/docs/marketing/marketing-cloud/references/mc-file_transfer_locations?meta=Validate%2Ba%2Bfile%2Btransfer%2Blocation) | data/v1/filtransferlocation/validate | **Version:** 1.0 ## Operations ### GET Get a file transfer location identified by customerKey. `GET /data/v1/filetransferlocation/{customerkey}` Operation ID: `Get a file transfer location`. This method returns a single file location for the given customer key. ### Required Scopes Installed Packages > Data > File Locations > Read `Scope: 'file_locations_read';` #### Parameters * `customerkey` (path, string, required) The customerkey of the FileTransferLocation to retrieve. Example: `AWS_Marketing_Bucket`. #### Responses * **200** OK Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Example Response_ ``` { "fileTransferLocation": { "customerKey": "AWS_Marketing_Bucket", "name": "AWS Marketing Bucket", "description": "Marketing files", "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "accessKeyId": "ASLKJMO45MTESTBYR3Q", "roleArn": "arn:aws:iam::123456789:role/Marketing_Role", "regionName": "useast1", "relativePath": "winter/registrations", "bucketName": "marketing", "authType": "AccessKeyWithIamRole" } }, "requestId": "f6204345-9600-4464-8fc0-96c701234e11", "resultMessages": [] } ``` ### DELETE Deactivate a file transfer location identified by customerKey. `DELETE /data/v1/filetransferlocation/{customerkey}` Operation ID: `Delete a file transfer location`. This method deactivates a file location based on a given customer key. ### Required Scopes Installed Packages > Data > File Locations > Write `Scope: 'file_locations_write';` #### Parameters * `customerkey` (path, string, required) The customerkey of the FileTransferLocation to delete. Example: `AWS_Marketing_Bucket`. #### Responses * **200** OK Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Example Response_ ``` { "requestId": "6ee6372c-cfd0-4a36-a17d-a5d1348221b1", "resultMessages": [] } ``` ### PATCH Update a file transfer location identified by customerKey. `PATCH /data/v1/filetransferlocation/{customerkey}` Operation ID: `Update a file transfer location`. This method updates a file location based on a given customer key. ### Required Scopes Installed Packages > Data > File Locations > Write `Scope: 'file_locations_write';` #### Parameters * `customerkey` (path, string, required) The customerkey of the FileTransferLocation to update. Example: `AWS_Marketing_Bucket`. #### Request body (required) Update an existing File Transfer Location. Media type: `application/json`. Schema: `fileTransferLocationRequestBody`. _Example: Update an AWS S3 file location with Access Key with IAM Role authorization_ ``` { "fileTransferLocation": { "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "authType": "AccessKeyWithIAMRole", "accessKeyId": "AKHDYEMO45MTESTBYR3Q", "SecretAccessKey": "TmlGlsDKA3GO05+AxeUdtmo70DJNSDPXJElZkzU1", } } } ``` #### Responses * **200** OK Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Example Response_ ``` { "fileTransferLocation": { "customerKey": "AWS_Marketing_Bucket", "name": "AWS Marketing Bucket", "description": "Marketing files", "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "accessKeyId": "AKHDYEMO45MTESTBYR3Q", "roleArn": "arn:aws:iam::123456789:role/Marketing_Role", "regionName": "useast1", "relativePath": "winter/registrations", "bucketName": "marketing", "authType": "AccessKeyWithIamRole" } }, "requestId": "34f3dc68-7c0f-4ffa-8cac-6e27e0123444", "resultMessages": [] } ``` ### GET Get all file transfer locations for the current MID `GET /data/v1/filetransferlocations` Operation ID: `Get all file transfer locations`. Tags: Get file transfer location collection. This method returns one or more file locations that are owned by, or reside under your member identification code (MID). A file location is also known as a `fileTransferLocation`. ### Required Scopes Installed Packages > Data > File Locations > Read `Scope: 'file_locations_read';` #### Parameters * `$page` (query, integer) This parameter selects the page returned from paginated results. It's usually used with the $pagesize parameter, described next. * `$pagesize` (query, integer) This parameter is the count of results to return per page. It's typically provided with $page. * `$locationType` (query, string) This parameter filters locations by their type. Allowed values: `ExternalSftp`, `AmazonSimpleStorage`, `AzureBlobStorage`, `GcpBlobStorage`. #### Responses * **200** OK Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Example Response_ ``` { "page": 1, "pageSize": 50, "count": 2, "items": [ { "customerKey": "AWS_Marketing_Bucket", "name": "AWS Marketing Bucket", "description": "Marketing files", "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "accessKeyId": "ASLKJMO45MTESTBYR3Q", "roleArn": "arn:aws:iam::123456789:role/Marketing_Role", "regionName": "useast1", "relativePath": "winter/registrations", "bucketName": "marketing", "authType": "AccessKeyWithIamRole" } }, { "customerKey": "External_SFTP_Location", "name": "Corporate SFTP", "description": "Corporate SFTP Location for marketing files", "locationType": "ExternalSftp", "sFtpFileTransferLocation": { "portNumber": 22, "userName": "myuser", "url": "sftp://externalsftp.com", "authType": "Password" } } ], "requestId": "181d4981-2a1b-4031-b1be-dcea1234b043", "resultMessages": [] } ``` ### POST Create a new File Transfer Location in your account. `POST /data/v1/filetransferlocation` Operation ID: `Create a file transfer location`. This method creates a new file location. For each of the types, parameters differ slightly, with differences shown below. ### Required Scopes Installed Packages > Data > File Locations > Write `Scope: 'file_locations_write';` #### Request body (required) Create a new File Transfer Location to your account. Media type: `application/json`. Schema: `fileTransferLocationRequestBody`. _Example: Create a new AWS S3 file location with Access Key with IAM Role authorization_ ``` { "fileTransferLocation": { "name": "AWS Marketing Bucket", "customerKey": "AWS_Marketing_Bucket", "description": "Marketing files", "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "authType": "AccessKeyWithIAMRole", "accessKeyId": "ASLKJMO45MTESTBYR3Q", "SecretAccessKey": "TmlGlTEST2GO05+AxeUdtmoTEST1DPXJElZkzU1", "RoleARN": "arn:aws:iam::123456789:role/Marketing_Role", "regionName": "useast1", "bucketName": "marketing", "relativePath": "winter/registrations" } } } ``` _Example: Create a new External SFTP S3 file location with username/password authentication_ ``` { "FileTransferLocation": { "name": "Corporate SFTP", "customerKey": "External_SFTP_Location", "description": "Corporate SFTP Location for marketing files", "locationType": "ExternalSftp", "sFtpFileTransferLocation": { "authType": "Password", "userName": "myuser", "password": "Password123", "url": "sftp://externalsftp.com" } } } ``` _Example: Create a new Azure file location with AAD authentication_ ``` { "fileTransferLocation": { "customerKey": "AzureBlobStorageAAD1", "name": "myTestLocation1", "description": "MyTestLocation1", "locationType": "AzureBlobStorage", "azureFileTransferLocation": { "accessKeyId": "accessKeyId1", "SecretAccessKey":"SecretAccessKey1", "relativePath": "relativePath1", "bucketName": "bucket1", "storageAccountName":"blobcont", "tenantId":"tenantId", "authType": "AccessKey" } } } ``` _Example: Create a new GCP Storage file location with credentials_ ``` { "fileTransferLocation":{ "customerKey":"GCPTestAPIDev", "name":"GCPTestAPIDev", "description":"GCPTestAPIDev", "locationType":"GcpBlobStorage", "gcpFileTransferLocation":{ "bucketName":"my-gcp-bucket", "authType":"CredentialFile", "credentials":{ "type":"service_account", "project_id":"my-project-id", "private_key_id":"REDACTED_GCP_PRIVATE_KEY_ID", "private_key":"-----BEGIN PRIVATE KEY-----\n --private key here -- \n-----END PRIVATE KEY-----\n", "client_email":"myuserdev@example.iam.gserviceaccount.com", "client_id":"113787057901699177331", "auth_uri":"https://accounts.google.com/o/oauth2/auth", "token_uri":"https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url":"https://www.googleapis.com/robot/v1/metadata/x509/my-gcp-bucket%40example.iam.gserviceaccount.com" } } } } ``` #### Responses * **200** File Transfer Location created. Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Create a new AWS S3 file location with Access Key with IAM Role authorization_ ``` { "fileTransferLocation": { "customerKey": "AWS_Marketing_Bucket", "name": "AWS Marketing Bucket", "description": "Marketing files", "locationType": "AmazonSimpleStorage", "awsFileTransferLocation": { "accessKeyId": "ASLKJMO45MTESTBYR3Q", "roleArn": "arn:aws:iam::123456789:role/Marketing_Role", "regionName": "useast1", "relativePath": "winter/registrations", "bucketName": "marketing", "authType": "AccessKeyWithIamRole" } }, "requestId": "47f76ce6-0fe8-422f-8568-fba01234bdb9", "resultMessages": [] } ``` _Example: Create a new External SFTP S3 file location with username/password authentication_ ``` { "fileTransferLocation": { "customerKey": "External_SFTP_Location", "name": "Corporate SFTP", "description": "Corporate SFTP Location for marketing files", "locationType": "ExternalSftp", "sFtpFileTransferLocation": { "portNumber": 22, "userName": "myuser", "url": "sftp://externalsftp.com", "authType": "Password" } }, "requestId": "42bdd95b-0668-42cf-a9c6-112345a5836e", "resultMessages": [] } ``` ### POST Validate a file transfer location schema passed in request body. `POST /data/v1/filetransferlocation/validate` Operation ID: `Validate a file transfer location`. This method validates a file location. For each of the types, parameters differ slightly, with differences shown below. ### Required Scopes Installed Packages > Data > File Locations > Write `Scope: 'file_locations_write';` #### Request body (required) Validate a new File Transfer Location. Media type: `application/json`. Schema: `fileTransferLocationRequestBody`. _Example: Validate a new Azure file location with SAS authentication_ ``` { "fileTransferLocation": { "customerKey": "AzureBlobStorageSAS", "name": "MyTestLocation", "description": "Azure Workign SAS String", "locationType": "AzureBlobStorage", "azureFileTransferLocation": { "relativePath": "relativePath", "bucketName": "blbocont", "storageAccountName":"blobtest", "authType": "SharedAccessSignature", "sasQueryString": "sp=racwdli&st=2022-04-13T20:46:36Z&se=2022-06-03T04:46:36Z&spr=https&sv=2020-08-04&sr=c&sig=egUGxZe%2Bp3Nab1NrRjE0WAL7bJpD7r%2Fazumx%2BaKAlU4%3D" } } } ``` #### Responses * **200** File Transfer Location validation complete. Media type: `application/json`. Schema: `any`. Type: `any`. _Example: Invalid bucket response_ ``` { "valid":false, "requestId":"ce6c58f3-9dc0-4cc8-a2d9-3cfa041d84f6", "resultMessages":[ { "resultType":"Validation", "resultClass":"Error", "resultCode":"Error", "message":"The specified bucket does not exist." } ] } ``` _Example: Valid FTL response_ ``` { "valid":true, "requestId":"ce6c58f3-9dc0-4cc8-a2d9-3cfa041d84f6", "resultMessages":[] } ``` ## Schemas ### fileTransferLocationRequestBody Request object for creating or updating a File Transfer Location. * `fileTransferLocation` (_awsFileTransferLocationRequest | sftpFileTransferLocationRequest | azureFileTransferLocationRequest | gcpFileTransferLocationRequest_, required) One of: `awsFileTransferLocationRequest`, `sftpFileTransferLocationRequest`, `azureFileTransferLocationRequest`, `gcpFileTransferLocationRequest`. ### awsFileTransferLocationRequest `fileTransferLocation` object for creating or updating an AWS File Transfer Location. * `name` (_string_, required) A name for your file location that identifies the location in Marketing Cloud Engagement. Example: `AWS Marketing Bucket`. * `customerKey` (_string_) The key used when using the API. Example: `AWS_Marketing_Bucket`. * `description` (_string_) A description of the file location. Example: `Marketing files`. * `locationType` (_string_, required) The type of File Transfer Location. Allowed values: `ExternalSftp`, `AmazonSimpleStorage`, `AzureBlobStorage`, `GcpBlobStorage`. Example: `AmazonSimpleStorage`. * `awsFileTransferLocation` (_awsFileTransferLocation_, required) ### sftpFileTransferLocationRequest `fileTransferLocation` object for creating or updating an SFTP File Transfer Location. * `name` (_string_, required) A name for your file location that identifies the location in Marketing Cloud Engagement. Example: `Corporate SFTP`. * `customerKey` (_string_) The key used when using the API. Example: `External_SFTP_Location`. * `description` (_string_) A description of the file location. Example: `Corporate SFTP Location for marketing files`. * `locationType` (_string_, required) The type of File Transfer Location. Allowed values: `ExternalSftp`, `AmazonSimpleStorage`, `AzureBlobStorage`, `GcpBlobStorage`. Example: `ExternalSftp`. * `sFtpFileTransferLocation` (_sFtpFileTransferLocation_, required) ### azureFileTransferLocationRequest `fileTransferLocation` object for creating or updating an Azure File Transfer Location. * `name` (_string_, required) A name for your file location that identifies the location in Marketing Cloud Engagement. Example: `AzureFileLocation`. * `customerKey` (_string_) The key used when using the API. Example: `AzureBlobStorageAAD1`. * `description` (_string_) A description of the file location. Example: `Azure File Location for marketing files`. * `locationType` (_string_, required) The type of File Transfer Location. Allowed values: `ExternalSftp`, `AmazonSimpleStorage`, `AzureBlobStorage`, `GcpBlobStorage`. Example: `AzureBlobStorage`. * `azureFileTransferLocation` (_gcpFileTransferLocation_, required) ### gcpFileTransferLocationRequest `fileTransferLocation` object for creating or updating an GCP File Transfer Location. * `name` (_string_, required) A name for your file location that identifies the location in Marketing Cloud Engagement. Example: `GCPFileLocation Marketing`. * `customerKey` (_string_) The key used when using the API. Example: `GCPFileLocation`. * `description` (_string_) A description of the file location. Example: `GCP File Location for marketing files`. * `locationType` (_string_, required) The type of File Transfer Location. Allowed values: `ExternalSftp`, `AmazonSimpleStorage`, `AzureBlobStorage`, `GcpBlobStorage`. Example: `GcpBlobStorage`. * `gcpFileTransferLocation` (_gcpFileTransferLocation_, required) ### awsFileTransferLocation `awsFileTransferLocation` object for specifying properties unique to AWS File Transfer Locations. * `authType` (_string_, required) The authorization method for the system to access the location. Allowed values: `AccessKey`, `AccessKeyWithIAMRole`. Example: `AccessKeyWithIAMRole`. * `accessKeyId` (_string_, required) The AWS Access Key ID for authorization. Example: `ASLKJMO45MTESTBYR3Q`. * `secretAccessKey` (_string_, required) The AWS Secret Access Key for authorization. Example: `TmlGlTEST2GO05+AxeUdtmoTEST1DPXJElZkzU1`. * `roleArn` (_string_) For AWS IAM Role authorization, use the Role ARN found in AWS. Required if `authType=AccessKeyWithIAMRole`. Example: `arn:aws:iam::1234567890/Role_Name`. * `regionName` (_string_, required) The region location of the bucket. Supported values are listed below. Allowed values: `useast1`, `uswest1`, `uswest2`, `euwest1`, `eucentral1`, `apnortheast1`, `apsoutheast1`, `apsoutheast2`, `saeast1`, `cnnorth1`, `useast2`, `eunorth1`, `euwest2`, `euwest3`, `eusouth1`, `apeast1`, `apnortheast2`, `apnortheast3`, `apsouth1`, `cnnorthwest1`, `cacentral1`, `mesouth1`, `afsouth1`. Example: `useast1`. * `bucketName` (_string_, required) The name of your bucket in AWS. Example: `marketing`. * `realtivepath` (_string_) The relative location inside the bucket. Don't use a leading or trailing "/" in your path. Example: `winter/registrations`. ### sFtpFileTransferLocation `sFtpFileTransferLocation` object for specifying properties unique to SFTP File Transfer Locations. * `authType` (_string_, required) Choose the authorization method for the system to access the location. Allowed values: `password`, `authKey`. Example: `Password`. * `url` (_string_, required) URL to the external SFTP location. Example: `sftp://externalsftp.com`. * `username` (_string_, required) Username to the external SFTP location. Example: `myuser`. * `password` (_string_) Password to the external SFTP location. Required if `authType=password`. Example: `Password123`. * `keyManagementPublicKey` (_string_) Public key for authenticating to the SFTP location. Required if `authType=authkey`. Example: `ASLKJMO45MTESTBYR3Q`. ### gcpFileTransferLocation `gcpFileTransferLocation` object for specifying properties unique to GCP File Transfer Locations. * `authType` (_string_, required) Specify the authorization method for the system to access the location. Allowed values: `CredentialFile`. Example: `CredentialFile`. * `bucketName` (_string_, required) The name of your bucket in GCP. Example: `myMarketingBucket`. * `credentials` (_object_, required) Credential information for authenticating to your GCP account. * `type` (_string_, required) The GCP account type. Example: `service_account`. * `project_id` (_string_, required) The GCP project id. Example: `marketing-winter`. * `private_key_id` (_string_, required) The GCP private key id. Example: `REDACTED_GCP_PRIVATE_KEY_ID`. * `private_key` (_string_, required) The GCP private key. Example: `-----BEGIN PRIVATE KEY----- -- private key here -- -----END PRIVATE KEY-----` . * `client_email` (_string_, required) The GCP account's associated email address. Example: `myuser@example.com`. * `client_id` (_string_, required) The GCP client id. Example: `113787057901699177331`. * `auth_uri` (_string_, required) The GCP authentication URI. Example: `https://accounts.google.com/o/oauth2/auth`. * `token_uri` (_string_, required) The GCP token URI. Example: `https://oauth2.googleapis.com/token`. * `auth_provider_x509_cert_url` (_string_, required) The GCP certificate URI. Example: `https://www.googleapis.com/oauth2/v1/certs`. * `client_x509_cert_url` (_string_, required) The GCP client specific certificate URL. Example: `https://www.googleapis.com/robot/v1/metadata/x509/myMarketingBucket%40myMarketingAccount.iam.gserviceaccount.com`. ### azureFileTransferLocation `azureFileTransferLocation` object for specifying properties unique to Azure File Transfer Locations. * `authType` (_string_, required) Choose the authorization method for the system to access the location. Allowed values: `SharedAccessSignature`, `AccessKey`. Example: `Password`. * `bucketName` (_string_, required) The name of your bucket in Azure. Example: `marketing`. * `realtivepath` (_string_) The relative location inside the bucket. Don't use a leading or trailing "/" in your path. Example: `winter/registrations`. * `storageAccountName` (_string_, required) Account user name in Azure. Example: `myuser`. * `sasQueryString` (_string_) Shared access signature query string. Required if `authType=SharedAccessSignature`. Example: `sp=racwdli&st=2022-04-13T20:46:36Z&se=2022-06-03T04:46:36Z&spr=https&sv=2020-08-04&sr=c&sig=egUGxZe%2Bp3Nab1NrRjE0WAL7bJpD7r%2Fazumx%2BaKAlU4%3D`. * `tenantId` (_string_) Tenant Id in Azure. Required if `authType=AccessKey` Example: `tenantId`. * `accessKeyId` (_string_) Access Key ID for authenticating to the Azure location. Required if `authType=AccessKey`. Example: `accessKeyId1`. * `SecretAccessKey` (_string_) Secret key for authenticating to the Azure location. Required if `authType=AccessKey`. Example: `SecretAccessKey1`. # File Upload Issue a POST request to the `/asset/v1/content/assets` endpoint to upload files, such as gif, pdf, and png files. Add a file to the asset as an encoded base64 string using the `file` attribute. The maximum size file size is 5 MB. ## File Upload Example ```json POST /asset/v1/content/assets HTTP/1.1 Host: SUBDOMAIN.rest.marketingcloudapis.com Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN { "name": "1px transparent gif asset", "assetType": { "name": "gif", "id": 20 }, "file": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", "modelVersion": 2, "fileProperties": { "fileName": "1px_transparent.gif" } } ``` ## See Also - [Asset Model](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset-model.md) - [Asset Model Examples](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asset_model_examples.md) # FileTransferActivity An object that represents an instance of a file transfer activity within an account. Use the perform method on an existing file transfer activity. To start a FileTransferActivity using the perform method, you need the `Interactions | Activities | File Transfer | Start` permission. ## Properties | Name | Data Type | Description | | --------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `Keyword` | String | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## PartnerProperties Values The `PartnerProperties` property for this object accepts the value and data types listed in this table. | Value | Data Type | | ------------------------ | ------------------------------------------ | | FileTransferLocationKey | string | | FileTransferLocationID | GUID | | PublicKeyManagementKey | string | | PublicKeyManagementId | int | | FileTransferActivityID | GUID | | ClientID | int | | OwnerID | int | | Name | string | | Description | string | | CustomerKey | string | | FileSpec | string | | IsActive | bool | | IsEncrypted | bool | | IsCompressed | bool | | IsSigned | bool | | Retries | int | | RetryInterval | int | | MaxFileAge | int | | MaxFileAgeScheduleOffset | int | | MaxImportFrequency | int | | CreatedBy | int | | CreatedDate | datetime | | ModifiedBy | int | | ModifiedDate | datetime | | IsSequential | bool | | IsSuccessfulWithoutFile | bool | | IsUpload | bool | | IsPgp | bool | | MaxAgeUnit | FileTransferActivityMaxAgeUnit enumeration | Currently, 0-Hour is the only valid enumeration for `MaxAgeUnit`. The `PartnerProperties` property for this object in a Perform call accepts the value and data types listed in this table. | Value | Data Type | | ------------------ | --------- | | Type | string | | SourceResourceSpec | string | | IsCompressed | bool | | OutputFilename | string | | IsEncrypted | bool | | Encrypt | string | | EncryptionKey | string | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Perform a File Transfer Activity](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/performing_a_file_transfer_activity_via_the_soap_api.md) # FileTransferLocation Specifies a location in a file transfer activity or import. This object can refer to an external FTP site or an enhanced FTP site, which must be created in the web interface. It can’t be included as part of a retrieve call. Use this object's external ID as part of a file transfer activity or an import definition. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items [Create an Import Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_import_definition.md) # FileTrigger An object that represents file-based triggers in Automation Studio. ## Properties | Name | Data Type | Description | | ------------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ExternalReference` | String | Not used. | | `FileName` | String | Indicates name of file associated with the object. | | `FileTriggerProgramID` | String | Program ID associated with an instance of a file trigger. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsActive` | Boolean | Specifies whether the object is active. | | `LastPullDate` | DateTime | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `RequestParameterDetail` | String | Not used. | | `ResponseControlManifest` | String | Not used. | | `ScheduledDate` | DateTime | Not used. | | `Status` | String | Defines status of object. Status of an address. | | `StatusMessage` | String | Describes the status of an API call. | | `Type` | String | Indicates type of specific list. Valid values include Public, Private, Salesforce, GlobalUnsubscribe, and Master. Indicates the type of email to send to the address. Valid values include Text and HTML. | ## Related Items - [FileTriggerTypeLastPull object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filetriggertypelastpull.md) - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # FileTriggerTypeLastPull An object that tracks the last time a file was retrieved by a [file trigger](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filetrigger.md) in Marketing Cloud Engagement. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `ExternalReference` | String | Not used. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `LastPullDate` | DateTime | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Type` | String | Indicates type of specific list. Valid values include Public, Private, Salesforce, GlobalUnsubscribe, and Master. Indicates the type of email to send to the address. Valid values include Text and HTML. | ## Related Items - [FileTrigger object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filetrigger.md) - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # FileType The file formats supported for imports. ## Values | Name | Description | | ------- | -------------------------------------------------------------------------------------------- | | `CSV` | Indicates that the input file contains data in comma-separated values (CSV) format. | | `Other` | Indicates that the input file contains data that uses a delimiter other than commas or tabs. | | `TAB` | Indicates that the input file contains tab-delimited data. | ## Related Items - [ImportDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinition.md) # Filter Definition Functions To retrieve, create, update, and delete data filters, use the Filter Definition functions. ## Usage In your SSJS code, load the core library. ```js Platform.Load("core", "1"); ``` Next, initialize the object. This code example shows how to initialize a filter definition with the external key of `myFilterDef`. ```js var fd = FilterDefinition.Init("myFilterDef"); ``` After you initialize the filter definition, you can use SSJS functions to modify it. # FilterActivity An object that applies the logic of a data filter to a subscriber to create a group of subscribers who satisfy the filter criteria. - To create a FilterActivity where the SourceTypeID is the SubscriberList and SourceObjectID is the All Subs List Object ID, you need the Email | Subscribers | All Subscribers | View permission. - To start a FilterActivity using the perform method, you need the Interactions | Activities | Filter | Start permission. ## Properties | Name | Data Type | Description | | --------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `FilterActivityID` | String | Specifies the ID of the filter activity. | | `FilterDefinitionID` | String | Specifies the related filter definition ID for the filter activity. | | `DestinationObjectID` | String | Specifies the ID of the destination object for the filtered data. | | `DestinationTypeID` | Int | Specifies the type of destination object for the filtered data using one of the following values.
  • SubscriberList = 1
  • DataExtension = 2
  • GroupWizard = 3
  • BehavioralData = 4
| | `SourceObjectID` | String | Specifies the ID of the source object used to filter on. | | `SourceTypeID` | Int | Specifies the type of source object used to filter on using one of the following values.
  • SubscriberList = 1
  • DataExtension = 2
  • GroupWizard = 3
  • BehavioralData = 4
| | `OwnerID` | String | Specifies the user ID that owns the filter activity. | | `StatusID` | String | Determines whether the filter activity is deleted. 1 means the filter activity wasn't deleted and is still active. 0 indicates it was deleted. | | `CreatedBy` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the user ID that created the filter activity. | | `ModifiedBy` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the user ID that last modified the filter activity. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) - [Apply Filter to Subscriber List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apply_filteractivity.md) # FilterDefinition Defines an audience based on specified rules in a filter. This object supports both subscriber lists and data extensions. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `CategoryID` | Int | Specifies the identifier of the folder containing the filter definition. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DataFilter` | [FilterPart](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filterpart.md) object | Filter parts for a filter definition. This property specifies the rules for the filter, although these rules can’t be specified hierarchically. You can retrieve a data filter only if it doesn’t contain a data relationship. Use Today + or Today - qualifiers only with date values. | | `DataSource` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Source of data (such as a data extension or list) referred to by API as part of a filter definition. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # FilterPart The FilterPart object is an abstract base class for filters, including objects such as the following: - [SimpleFilterPart](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/simplefilterpart.md "SimpleFilterPart") - [ComplexFilterPart](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/complexfilterpart.md "ComplexFilterPart") - [TagFilterPart](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/tagfilterpart.md "TagFilterPart") # Filters The following are filters technical articles for SOAP API. - [Apply Filter to Subscriber List](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apply_filteractivity.md) - [Create and Update a FilterDefinition Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_filterdefinition_object.md) - [Use Complex Filter Parts](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/using_complex_filter_parts.md) # Fire an Entry Event There are two ways to send events to Journey Builder: - Using a Fire Event Activity in Automation Studio - By POSTing an event to the Journey Builder API To send events using the API: 1. Define the event and its properties. - If you define the event in the web interface, note the event definition key. - If you define the event by using the API, use the POST /eventDefinition resource. 2. Use a valid OAuth access token to authorize requests to REST API. 3. Using the POST /events resource, POST the required fields and event properties to the API. ## Results When an event is posted to the API, the data schema of the associated data extension validates that all fields from the API call exist in the data extension. The data extension associated with an event is defined in the DataExtensionID field in the EventDefinition table. - If a field is missing, a validation exception is thrown. - If the request is successful, an eventInstanceId is returned. This ID is a unique identifier for this specific request. ## Related Items - _Salesforce Help_: [Fire Event Activity in Automation Studio](https://help.salesforce.com/articleView?id=mktg.mc_jb_fire_event.htm) - [POST /eventDefinition Resource](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createEventDefinition.md) - [POST /events Resource](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/postEvent.md) # Folder The Folder object is deprecated. Use DataFolder instead. ## Properties | Name | Data Type | Description | | ---------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `Name` | String | Name of the object or property. | | `ParentID` | Int | Specifies the ID number of the parent account for Lock and Publish, On Your Behalf, Enterprise, and Enterprise 2.0 account children and business units. | | `Value` | String | Defines value to be used in filter or other object. In filters, the BETWEEN operator requires two values. IN can handle multiple values. All other operators require only one value. isNull and isNotNull ignores any supplied values and don't return an error. | ## Related Items [DataFolder Object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/datafolder.md) # Folder Functions These functions allow you to access and control folders within your Marketing Cloud Engagement account. ## Load In your server-side JavaScript code, first load the core library using this syntax: ``` Platform.Load("core","1"); ``` ## Initialization To interact with a folder via server-side JavaScript, you must first initialize the object. The code below initializes a folder with the external key of myFolder. ``` var myFolder = Folder.Init("myFolder"); ``` Not all Folder objects ll include an external key. You can initialize a Folder by assigning it an ID number: ``` var myIDFolder = Folder.Init(); myIDFolder.SetID(12345); ``` Once you initialize the folder, use the ID number to identify the folder in place of the external key for all applicable functions. # For Loops Use `For` loops to iterate through data structures or execute code a certain number of times. At a minimum, a `For` statement must include: - The keyword `For` immediately preceding the condition that you want to evalute. - A variable to use as a counter, and its initial value. - The keyword `to` or `downto` immediately following the value of the counter. - The value at which the loop stops. This value can be a number, variable, or AMPscript function. - The keyword `do`. - The code to execute in each loop. - The keyword `next` to iterate the counter. If you used the keyword `to`, the counter increases by one. If you used `downto`, the counter decreases by one. These keywords aren’t case-sensitive; that is, `FOR`, `For`, and `for` all function in the same way. ## Usage In their simplest form, `For` loops execute code a pre-determined number of times. This example shows how to output a string of text a specific number of times, printing the number of iteration in each line. ``` %%[ Var @repetitions Set @repetitions = 5 For @counter = 1 to @repetitions do OutputLine(Concat("

This is line "), v(@counter), "

") Next @counter ]%% ``` The code outputs this text: ``` This is line 1 This is line 2 This is line 3 This is line 4 This is line 5 ``` ## Iterating Through Data Structures Several AMPscript functions can create or load data structures, such as data extensions. For example, when you provide it with a string of text, the `BuildRowsetFromString()` function creates a data structure called a "rowset," which consists of one or more lines of tabular data. This example shows how to parse the data in this rowset. It also demonstrates how you can close and resume AMPscript code blocks to suit your desired output. The comments in the example explain the purpose of each line. ``` %%[ /* Initialize variables */ Var @dataString, @data, @rowCount, @row, @sku /* Set @dataString to a pipe-delimited string of data */ Set @dataString = "938402993|858372392|648404923|293203492" /* Build a rowset using the data in @dataString */ Set @data = BuildRowsetFromString(@dataString, "|") /* Count the number of rows in the rowset */ Set @rowCount = RowCount(@data) /* Break the AMPscript code block so that we can use some of these variables in our HTML */ ]%%

There are %%=v(@rowCount)=%% active SKUs:

    %%[ /* Execute the commands in the For loop once for each row in the rowset */ For @counter = 1 to @rowCount do /* Set the value of @row to the data in the current row (if @counter equals 1, set the value to the first row, and so forth) */ Set @row = Row(@data, @counter) /* Set the value of @sku to the first item in the current row */ Set @sku = Field(@row, 1) /* Break the AMPscript block again so that we can use the current value of the @sku variable in the HTML */ ]%%
  • (%%=v(@counter)=%%/%%=v(@rowCount)=%%): %%=v(@sku)=%%
  • %%[ /* Iterate the counter */ Next @counter ]%%
``` The output of this example contains this text: ``` There are 4 active SKUs: • (1/4): 938402993 • (2/4): 858372392 • (3/4): 648404923 • (4/4): 293203492 ``` # Form Component Blocks Form component blocks collect input from users. All form input blocks have two required attributes: `sfdc_cms:formInputLabelProperty` (the field label) and `sfdc_cms:formInputNameProperty` (the field name). ## lightning/inputText A field that accepts one line of input text. | Attribute | Type | Description | | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- | | `sfdc_cms:formInputLabelProperty` | string | Required. The label shown above the input field to describe what the user should enter. | | `sfdc_cms:formInputNameProperty` | string | Required. The internal name for the field. Use this field to identify the form after it’s submitted. | | `maxLength` | integer | Required. The maximum number of characters a user can enter in the field. The maximum value is `10000`. | | `placeholder` | string | The text that’s shown in the input field before the user types anything. Use this text to suggest the expected format or value. | | `width` | object | The width of the input field within its container. | This example shows how to create a basic input text field. ```json { "type": "block", "definition": "lightning/inputText", "attributes": { "sfdc_cms:formInputLabelProperty": "Full Name", "sfdc_cms:formInputNameProperty": "fullName", "maxLength": 100, "placeholder": "Enter your full name" } } ``` ## lightning/inputEmail A field for inputting an email address. This block type performs validation to make sure that the input value is a valid email address. | Attribute | Type | Description | | --------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- | | `sfdc_cms:formInputLabelProperty` | string | Required. The label shown above the input field to describe what the user should enter. | | `sfdc_cms:formInputNameProperty` | string | Required. The internal name for the field. Use this field to identify the form after it’s submitted. | | `maxLength` | integer | Required. The maximum number of characters a user can enter in the field. The maximum value is `10000`. | | `placeholder` | string | The text that’s shown in the input field before the user types anything. Use this text to suggest the expected format or value. | This example shows how to create a basic email entry field. ```json { "type": "block", "definition": "lightning/inputEmail", "attributes": { "sfdc_cms:formInputLabelProperty": "Email Address", "sfdc_cms:formInputNameProperty": "email", "maxLength": 255, "placeholder": "Enter your email address..." } } ``` ## lightning/inputCheckbox A checkbox input for boolean values, such as opt-in or agreement confirmations. | Attribute | Type | Description | | --------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | | `sfdc_cms:formInputLabelProperty` | string | Required. The label shown next to the checkbox to describe what the user is agreeing to or selecting. | | `sfdc_cms:formInputNameProperty` | string | Required. The internal name for the field. Use this field to identify the form after it’s submitted. | This example shows how to create a simple checkbox. ```json { "type": "block", "definition": "lightning/inputCheckbox", "attributes": { "sfdc_cms:formInputLabelProperty": "Subscribe to our newsletter", "sfdc_cms:formInputNameProperty": "subscribe" } } ``` ## lightning/inputDropdown A dropdown list that contains several predefined options. | Attribute | Type | Description | | --------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sfdc_cms:formInputLabelProperty` | string | Required. The label shown above the dropdown to describe what the user should select. | | `sfdc_cms:formInputNameProperty` | string | Required. The internal name for the field. Use this field to identify the form after it’s submitted. | | `options` | array | Required. The list of selectable options in the dropdown. Each option requires a `label` string, which is visible to the user, and a `value` string, which is an identifier that’s submitted with the form. | | `placeholder` | string | The text that’s shown in the dropdown before the user selects an option. Use this property to prompt the user to select an option. | This example shows how to create a basic dropdown list with two options. ```json { "type": "block", "definition": "lightning/inputDropdown", "attributes": { "sfdc_cms:formInputLabelProperty": "Country", "sfdc_cms:formInputNameProperty": "country", "placeholder": "Select your country...", "options": [ { "label": "Canada", "value": "CA" }, { "label": "United States", "value": "US" } ] } } ``` ## Related Items - [Content Component Blocks](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-manage-component-blocks.md) # Format Applies a formatting rule to a string or numeric value. For example, you can change the format of an ISO 8601 timestamp to show the date in the format that you prefer. ## Syntax `Format(1, 2)` ## Properties | Ordinal | Type | Description | | ------- | ---------------- | ------------------------------------------------------------- | | `1` | String or number | Required. The string or number to apply a formatting rule to. | | `2` | String | Required. A format code to apply to the string. | ## Format Codes for Numeric Value Types Use these codes to format numeric values or strings that contain numeric values. The values in the Example column are based on a sample numeric value of `4213.65`. | Formatting Code | Description | Example | | --------------- | -------------------------------------------------------------- | ------------- | | `C` | Currency value with group and decimal separators | $4,213.65 | | `D` | Decimal value | 4213.65 | | `E` | Exponential notation value | 4.213650E+003 | | `F` | Fixed-point value | 4213.65 | | `G` | The more compact of either fixed-point or exponential notation | 4213.65 | | `N` | Number with group and decimal separators | 4,213.65 | | `P` | Percentage with group and decimal separators | 421,365.00% | Include a number after any formatting code to modify the number of decimal places in the output, rounding up or down as needed. For example, if the input value is `4213.65` and you specify the `C0` formatting code, the output value is `$4,214`. With the same starting value and a formatting code of `C4`, the output value becomes `$4,213.6500`. ## Format Codes for Date Strings To apply a formatting rule to a date, specify the format that you want the function to output. You can use a predefined date format or specify a custom date format. ### Predefined Date Format Strings This table lists the predefined date formats for date values. The values in the Example column are based on the date Monday, August 5, 2024 at 1:41:23 PM in the UTC-06:00 time zone. | Formatting Code | Description | Example | | --------------- | ----------------------------------------------- | --------------------------------- | | `d` | Short-form date | 8/5/24 | | `M` | Month and day | August 5 | | `f` | Long-form date with 12-hour time | Monday, August 5, 2024 1:41 PM | | `g` | Short-form date with 12-hour time | 8/5/2024 1:41 PM | | `O` | ISO 8601 timestamp | 2024-08-05T13:41:23.0000000 | | `r` | RFC 1123 timestamp | Mon, 05 Aug 2024 13:41:23 GMT | | `s` | Sortable timestamp | 2024-08-05T13:41:23 | | `t` | 12-hour time | 1:41 PM | | `T` | 12-hour time in seconds | 1:41:23 PM | | `u` | Universal sortable timestamp | 2024-08-05 13:41:23Z | | `U` | Long-form date with 12-hour UTC time in seconds | Monday, August 5, 2024 7:41:23 PM | | `y` | Month and year | August 2024 | ### Custom Date Strings Combine the format codes listed in this table to output a date string that uses a custom format. The values in the Example column are based on the date Monday, August 5, 2024 at 1:41:23 PM in the UTC-06:00 time zone. | Formatting Code | Description | Example | | --------------- | --------------------------------------------------- | ------- | | `d` | Day expressed as a numeral without a leading zero | 5 | | `dd` | Day expressed as a numeral | 05 | | `ddd` | Abbreviated day name | Mon | | `dddd` | Day name | Monday | | `h` | Hours on a 12-hour clock without a leading zero | 1 | | `hh` | Hours on a 12-hour clock | 01 | | `HH` | Hours on a 24-hour clock | 13 | | `mm` | Minutes | 41 | | `M` | Month expressed as a numeral without a leading zero | 8 | | `MM` | Month expressed as a numeral | 08 | | `MMM` | Abbreviated month name | Aug | | `MMMM` | Month name | August | | `ss` | Seconds | 23 | | `tt` | 12-hour time period (AM or PM) | PM | | `yy` | Last two digits of the year | 24 | | `yyy` | Year | 2024 | | `z` | Time zone offset in hours without a leading zero | -6 | | `zz` | Time zone offset in hours | -06 | | `zzz` | Time zone offset in hours and minutes | -06:00 | **note:** Some format codes for custom dates are the same as the codes for predefined date formats. When you pass a single formatting code as a parameter for the `Format` function, the function outputs a date string in the specified format. If you pass more than one formatting code as a parameter, the function outputs a string with the date-formatting options you specified. For example, using the same example timestamp that’s used in the table, the function `Format(date, "d")` outputs `8/5/24`. However, the function `Format(date, "d MMMM")` outputs `5 August`. ## Usage You can use this function to format strings in several different ways. These examples show some of the ways that you can use this function. ### Formatting Currency Values Use the `C` formatting code to express a string or number as a currency value. The function in this example specifies that the output includes two decimal places (`C2`). ```html

The total price is .

``` The function outputs the string expressed as a dollar amount rounded to two decimal places. ``` The total price is $32.69. ``` ### Formatting Dates This example shows how to format a date by using a predefined format and a custom format. This example uses the `O` formatting code to format the incoming date and time value as an ISO timestamp. Next, it uses a custom format for the incoming date and time. The custom format includes the full name of the day (`dddd`), the full name of the month (`MMMM`), the date without a leading zero (`d`), and the year (`yyy`). It also shows the time in 24-hour format, including hours, minutes, seconds, and UTC offset (`HH:mm:ss (zzz)`). ```html

Date and time with a predefined format:

Date and time with a custom format:

``` The function outputs the date and time using the specified formats. ``` Date and time with a predefined format: 2024-08-05T13:41:23.0000000 Date and time with a custom format: Monday, August 5 2024 13:41:23 (-06:00) ``` # Format() Formats a string, date, or number in a specified format. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` Format(input, outputFormat, dataFormat, cultureCode) ``` The `Format()` function has four parameters: - `input` (datetime, number, or string): Required. The string to apply formatting rules to. - `outputFormat` (string): Required. A format string to apply to `input`. - `dataFormat` (string): The data format of the string. Possible values are `Date` and `Number`. **note:** For best results, always specify a value for `dataFormat`. If you don’t specify a value for `dataFormat`, the function tries to determine the type of the input data. - `cultureCode` (string): A culture code to apply to the string. ## Format Codes for Numeric Values Use these codes to format strings as numeric values. | Code | Output Format | | ---- | ------------------- | | `C` | Currency | | `D` | Decimal | | `E` | Scientific notation | | `F` | Fixed-point | | `G` | General | | `N` | Number | | `P` | Percent | You can also format strings as dates. See [Pre-Defined Date Formats](#pre-defined-date-formats) and [Custom Date Formats](#custom-date-formats). ## Usage You can use this function to format strings in several different ways. These examples show some of the ways that you can use this function. ### Pre-Defined Date Formats The `Format()` function can format a date string into one of several predefined formats. To format a date using one of these formats, specify the format string for `outputFormat` and specify `Date` for `dataFormat`. This table lists the formats that are available in both Marketing Cloud Engagement and Marketing Cloud Next. Because the output value can vary based on the locale, this table includes example values for the `en_US`, `fr_FR`, and `ja_JP` locales. | Description | Format String | Examples | | -------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Short date | `d` |
  • **(en_US)** 8/5/2026
  • **(fr_FR)** 05/08/2026
  • **(ja_JP)** 2026/08/05
| | Long date | `D` |
  • **(en_US)** Wednesday, August 5, 2026
  • **(fr_FR)** mercredi 5 août 2026
  • **(ja_JP)** 2026 年 8 月 5 日
| | Long date and short time | `f` |
  • **(en_US)** Wednesday, August 5, 2026 1:45 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45
  • **(ja_JP)** 2026 年 8 月 5 日 13:45
| | Long date and long time | `F` |
  • **(en_US)** Wednesday, August 5, 2026 1:45:30 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45:30
  • **(ja_JP)** 2026 年 8 月 5 日 13:45:30
| | General date with short time | `g` |
  • **(en_US)** 8/5/2026 1:45 PM
  • **(fr_FR)** 05/08/2026 13:45
  • **(ja_JP)** 2026/08/05 13:45
| | General date with long time | `G` |
  • **(en_US)** 8/5/2026 1:45:30 PM
  • **(fr_FR)** 05/08/2026 13:45:30
  • **(ja_JP)** 2026/08/05 13:45:30
| | Month and day | `m` or `M` |
  • **(en_US)** August 5
  • **(fr_FR)** 5 août
  • **(ja_JP)** 8 月 5 日
| | Round-trip date and time | `o` or `O` |
  • **(en_US)** 2026-08-05T13:45:30.1230000
  • **(fr_FR)** 2026-08-05T13:45:30.1230000
  • **(ja_JP)** 2026-08-05T13:45:30.1230000
| | RFC1123 date and time | `r` or `R` |
  • **(en_US)** Wed, 05 Aug 2026 13:45:30 GMT
  • **(fr_FR)** Wed, 05 Aug 2026 13:45:30 GMT
  • **(ja_JP)** Wed, 05 Aug 2026 13:45:30 GMT
| | Sortable date and time | `s` |
  • **(en_US)** 2026-08-05T13:45:30
  • **(fr_FR)** 2026-08-05T13:45:30
  • **(ja_JP)** 2026-08-05T13:45:30
| | Short time | `t` |
  • **(en_US)** 1:45 PM
  • **(fr_FR)** 13:45
  • **(ja_JP)** 13:45
| | Long time | `T` |
  • **(en_US)** 1:45:30 PM
  • **(fr_FR)** 13:45:30
  • **(ja_JP)** 13:45:30
| | Universal sortable date and time | `u` |
  • **(en_US)** 2026-08-05 13:45:30Z
  • **(fr_FR)** 2026-08-05 13:45:30Z
  • **(ja_JP)** 2026-08-05 13:45:30Z
| | Universal full date and time | `U` |
  • **(en_US)** Wednesday, August 5, 2026 1:45:30 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45:30
  • **(ja_JP)** 2026 年 8 月 5 日 13:45:30
| | Month and year | `y` or `Y` |
  • **(en_US)** August 2026
  • **(fr_FR)** août 2026
  • **(ja_JP)** 2026 年 8 月
| ### Custom Date Formats You can format a date string using a custom format by passing a string that specifies the format. The strings that you use vary depending on whether you use Marketing Cloud Engagement or Marketing Cloud Next. #### Day and Date Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ---------------------- | ------- | ---------------------- | ---------------- | | Full day name | Monday | `dddd` | `EEEE` | | Abbreviated day name | Mon | `ddd` | `EEE` | | Date (zero-padded) | 05 | `dd` | `dd` | | Date (non-zero-padded) | 5 | `d` | `d` | | Day number in week | 1 | (not available) | `u` | #### Month Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ------------------------------ | ------- | ---------------------- | ---------------- | | Full month name | August | `MMMM` | `MMMMM` | | Abbreviated month name | Aug | `MMM` | `MMM` | | Month number (zero-padded) | 08 | `MM` | `MM` | | Month number (non-zero-padded) | 8 | `M` | `M` | #### Year Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ----------------------- | ------- | ---------------------- | ---------------- | | Full year number | 2026 | `yyyy` | `yyyy` | | Last two digits of year | 26 | `yy` | `yy` | | Calendar era | AD | `gg` | `G` | #### Time Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ------------------------------------------------- | ------- | ---------------------- | ---------------- | | Hour (24-hour, zero-padded) | 13 | `HH` | `HH` | | Hour (24-hour, non-zero-padded) | 13 | `H` | `H` | | Hour (12-hour, zero-padded) | 01 | `hh` | `hh` | | Hour (12-hour, non-zero-padded) | 1 | `h` | `h` | | Minute (zero-padded) | 05 | `mm` | `mm` | | Minute (non-zero-padded) | 5 | `m` | `m` | | Second (zero-padded) | 09 | `ss` | `ss` | | Second (non-zero-padded) | 9 | `s` | `s` | | Millisecond | 423 | `fff` | `S` | | AM/PM marker (two letter) | PM | `tt` | `a` | | AM/PM marker (first letter only) | P | `t` | (not available) | | Time zone name | UTC | (not available) | `z` | | Time zone offset (hours and minutes, zero-padded) | -0800 | `zzz` | `Z` | | Time zone offset (hours only, zero-padded) | -08 | `zz` | `X` | | Time zone offset (hours only, non-zero-padded) | -8 | `z` | `X` | This example shows how to format the date to include the full name of the day ("dddd"), the full name of the month ("MMMM"), the date without a leading zero ("d"), and the year ("yyyy"). It also shows the time in 24-hour format, including hours, minutes, seconds, and UTC offset ("HH\:mm\:ss (zzz)"). ``` %%[ Var @now, @dateString Set @now = "5 August 2026 1:41:23 PM" Set @dateString = Format(@now, "dddd, MMMM d yyy HH:mm:ss (zzz)", "Date", "en_US") ]%%

Date and time with a custom format: %%=v(@dateString)=%%

``` The function outputs the date and time using the format that you specified. ``` Date and time with a custom format: Wednesday, August 5 2026 1:41:23 (-06:00) ``` You can use the `cultureCode` parameter to express day and month names in other languages. This example outputs the date using day and month names in Swahili. ``` %%[ Var @now, @dateString Set @now = "5 August 2026 1:41:23 PM" Set @dateString = Format(@now, "ddddd, d MMMM yyyy", "date", "sw_KE") ]%%

Date and time with a custom format: %%=v(@dateString)=%%

``` The function outputs the date string with the appropriate values translated. ``` Date and time with a custom format: Jumatano, 5 Agosti 2026 ``` ### Formatting Currency Values ``` %%[ Var @cost, @finalCostInDollars Set @cost = "31.4159" Set @finalCostInDollars = Format(@cost,"C2") ]%%

The total price is %%=v(@finalCostInDollars)=%%.

``` The function outputs the string expressed as a dollar amount rounded to two decimal places. ``` The total price is $31.42. ``` You can use the `cultureCode` parameter to express currency values for a different country. This example outputs the currency value in Indian Rupees. ``` %%[ Var @cost, @finalCostInRupees Set @cost = "3141.5926535" Set @finalCostInRupees = Format(@cost, "C0", "", "bn_IN") ]%%

চূড়ান্ত মূল্য %%=v(@finalCostInRupees)=%%

``` The function outputs the currency value expressed in Indian rupees, rounded to the nearest whole number. ``` চূড়ান্ত মূল্য ₹ 3,142 ``` ## See Also - [NumberFormatInfoClass Class](https://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx) on the Microsoft Developer Network - [DateTimeFormatInfo Class](http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx) on the Microsoft Developer Network # FormatCurrency() Formats a number as a currency value. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` FormatCurrency(number, cultureCode, decimalPlaces, currencySymbol) ``` The `FormatCurrency()` function has four parameters: - `number` (string or number): Required. The number that you want to format. This function assumes that the input number uses a period or full stop (.) as a decimal separator. If you input the number as a string, the function assumes that commas are used as thousands separators. - `cultureCode` (string): Required. The locale code to use when formatting the number. Locale codes can use POSIX format (such as `es_MX`) or BCP 47 format (such as `es-MX`). When you provide this value, the resulting number is formatted using patterns that suit the specified locale. - `decimalPlaces` (number): The number of decimal places to include in the result. If you don't provide a value, the resulting number has two decimal places. If you’re specifying a value for the `currencySymbol` parameter, then this parameter is required. - `currencySymbol` (string): The currency symbol to use with the value. If you provide a value for this parameter, it overrides the default currency symbol for the specified locale. ## Usage To use the function, pass it a number to format, and culture code that you want to use to format it. This example converts a number to a currency value that is formatted based on the United Kingdom locale (`en_GB`). `%%=FormatCurrency(1234.555,"en_GB")=%%` The function returns `£1,234.56`. ### Rounding or Adding Precision The function can output a currency value that is rounded to a certain decimal place, or that adds precision to the currency value. This example rounds the input number to the nearest whole number. ``` %%=FormatCurrency(1234.555, "de_CH", 0)=%% ``` The example outputs `CHF 1'235`. In some currencies, decimal divisions aren’t commonly used. For example, in Japan, the smallest unit of currency in current use is ¥1, and fractional divisions of the yen are uncommon. For this reason, the `FormatCurrency()` function rounds to the nearest yen by default. However, you can force the function to output a currency value by specifying a value for the third parameter, as in this example. ``` %%=FormatCurrency(1234.555, "ja_JP", 2)=%% ``` The example outputs `¥1,234.56`. ### Using Alternative Currency Symbols You can force the function to output a currency value that uses a specific currency symbol. For example, many currencies use the dollar sign (\$). You can use this feature to add information that helps the reader determine which currency you’re referring to. When you specify a currency symbol, you must also specify the number of decimal places to include in the output. This example replaces the default currency symbol for the Mexican peso (`$`) with an alternative (`Mex$`) that makes it easier to identify the currency being used. ``` %%=FormatCurrency(1234.555, "es_MX", 2, "Mex$")=%% ``` The example outputs `Mex$1,234.56`. ### Sample Outputs This table shows the results of formatting a number (1234.555) as a currency value using several different locale settings. | Locale | Function | Output | | ------------------------------- | ----------------------------------------- | -------------------- | | China | `%%=FormatCurrency(1234.555,"zh_CN")=%%` | `¥1,234.56` | | India | `%%=FormatCurrency(1234.555,"hi_IN")=%%` | `₹1,234.56` | | United States | `%%=FormatCurrency(1234.555,"en_US")=%%` | `$1,234.56` | | Indonesia | `%%=FormatCurrency(1234.555,"id_ID")=%%` | `Rp1.235` | | Pakistan | `%%=FormatCurrency(1234.555,"ur_PK")=%%` | `Rs 1,234.56` | | Nigeria | `%%=FormatCurrency(1234.555,"en_NG")=%%` | `₦1,234.56` | | Brazil | `%%=FormatCurrency(1234.555,"pt_BR")=%%` | `R$ 1.234,56` | | Japan | `%%=FormatCurrency(1234.555,"ja_JP")=%%` | `¥1,235` | | Germany | `%%=FormatCurrency(1234.555,"de_DE")=%%` | `1.234,56 €` | | France | `%%=FormatCurrency(1234.555,"fr_FR")=%%` | `1 234,56 €` | | Canada (French-speaking areas) | `%%=FormatCurrency(1234.555,"fr_CA")=%%` | `1 234,56 $` | | Canada (English-speaking areas) | `%%=FormatCurrency(1234.555,"en_CA")=%%` | `$1,234.56` | | Türkiye | `%%=FormatCurrency(1234.555,"tr_TR")=%%` | `₺1.234,56` | | Ukraine | `%%=FormatCurrency(1234.555,"uk_UA")=%%` | `1 234,56 ₴` | | South Korea | `%%=FormatCurrency(1234.555,"ko_KR")=%%` | `₩1,235` | | United Arab Emirates | `%%=FormatCurrency(1234.555,"ar_AE")=%%` | `1,234.56 د.إ.`‏ | | Philippines | `%%=FormatCurrency(1234.555,"fil_PH")=%%` | `₱1,234.56` | | Sweden | `%%=FormatCurrency(1234.555,"sv_SE")=%%` | `1 234,56 kr` | | Israel | `%%=FormatCurrency(1234.555,"he_IL")=%%` | `₪ 1,234.56` | | Saudi Arabia | `%%=FormatCurrency(1234.555,"ar_SA")=%%` | `1,234.56 ر.س.`‏ | ## See Also - [BCP 47 RFC](https://www.ietf.org/rfc/bcp/bcp47.txt) on IETF.org - [Locale specification](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html) on OpenGroup.org (for information about POSIX locales) # FormatDate() Formats a string as a date value. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes, with some differences
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Differences Between Marketing Cloud Engagement and Marketing Cloud Next In Marketing Cloud Engagement, this function uses standard .NET date and time formatting libraries. In Marketing Cloud Next, this function uses the Java SimpleDateFormat class, which uses different formatting strings. In Marketing Cloud Next, if you don’t specify a value for the `dateFormat` parameter, the function returns a string formatted with the `G` standard format. This format uses a combination of a short date value and a long time value. For example, in the `en_US` locale, this function outputs a timestamp that’s similar to this example: `5/15/2026 1:23:45 PM`. ## Syntax ``` FormatDate(dateString, dateFormat, timeFormat, localeCode) ``` The `FormatDate()` function has these parameters: - `dateString` (string): Required. The date string that you want to format. - `dateFormat` (string): A string that represents the format to apply to the date. - `timeFormat` (string): A string that represents the format to apply to the time. - `localeCode` (string): The locale code to use when formatting the date. ## Input Date Formats In Marketing Cloud Engagement, you can specify a date in these formats. | Description | Format | Example | | ---------------------------------------------------------- | ------------------------------ | ------------------------------ | | ISO timestamp | `yyyy-MM-dd'T'HH:mm:ss.fffzzz` | `2026-08-05T13:45:30.123-0700` | | Japanese notation | `yyyy '年' M '月' d '日'` | `2026 年 8 月 5 日` | | Korean notation | `yyyy'년' M'월' d'일'` | `2026년 8월 5일` | | Sortable date | `yyyy-MM-dd` | `2026-08-05` | | Sortable date and time | `yyyy-MM-dd HH:mm:ss` | `2026-08-05 13:45:30` | | US Customary date (non-zero-padded) | `M/d/yyyy` | `8/5/2026` | | US Customary date (zero-padded) | `MM/dd/yyyy` | `08/05/2026` | | US Customary date and time (12-hour time, non-zero-padded) | `M/d/yyyy h:mm:ss tt` | `8/5/2026 1:45:30` | | US Customary date and time (24-hour time, zero-padded) | `MM/dd/yyyy HH:mm:ss` | `08/05/2026 13:45:30` | | US Customary date and time with time zone | `MM/dd/yyyy HH:mm:ss fff` | `08/05/2026 13:45:30 -0700` | In Marketing Cloud Next, you can specify a date in these formats. | Description | Format | Example | | ------------------------------------------------------ | ---------------------------- | ------------------------------ | | ISO timestamp | `yyyy-MM-dd'T'HH:mm:ss.SSSZ` | `2026-08-05T13:45:30.123-0700` | | Sortable date | `yyyy-MM-dd` | `2026-08-05` | | Sortable date and time | `yyyy-MM-dd HH:mm:ss` | `2026-08-05 13:45:30` | | US Customary date (zero-padded) | `MM/dd/yyyy` | `08/05/2026` | | US Customary date and time (24-hour time, zero-padded) | `MM/dd/yyyy HH:mm:ss` | `08/05/2026 13:45:30` | | US Customary date and time with time zone | `MM/dd/yyyy HH:mm:ss ZZZ` | `08/05/2026 13:45:30 -0700` | ## Usage To use this function, supply it with a date to format. If you don’t pass any other parameters, the function formats the date string according to the locale settings for your Marketing Cloud Engagement business unit or your Marketing Cloud Next org. This example formats a date string to use the default locale setting for an account based in the United States. ``` %%[ Var @now, @dateString Set @now = "5 August 2024 1:41:23 PM" Set @dateString = FormatDate(@now) ]%%

Date and time formatted for your locale: %%=v(@dateString)=%%

``` The function outputs the date and time. ``` Date and time formatted for your locale: 8/5/2024 1:41:23 PM ``` ### Pre-Defined Date Formats The `FormatDate()` function can format a date string into one of several predefined formats. This table lists the formats that are available in both Marketing Cloud Engagement and Marketing Cloud Next. Because the output value can vary based on the locale, this table includes example values for the `en_US`, `fr_FR`, and `ja_JP` locales. | Description | Format String | Examples | | -------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Short date | `d` |
  • **(en_US)** 8/5/2026
  • **(fr_FR)** 05/08/2026
  • **(ja_JP)** 2026/08/05
| | Long date | `D` |
  • **(en_US)** Wednesday, August 5, 2026
  • **(fr_FR)** mercredi 5 août 2026
  • **(ja_JP)** 2026 年 8 月 5 日
| | Long date and short time | `f` |
  • **(en_US)** Wednesday, August 5, 2026 1:45 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45
  • **(ja_JP)** 2026 年 8 月 5 日 13:45
| | Long date and long time | `F` |
  • **(en_US)** Wednesday, August 5, 2026 1:45:30 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45:30
  • **(ja_JP)** 2026 年 8 月 5 日 13:45:30
| | General date with short time | `g` |
  • **(en_US)** 8/5/2026 1:45 PM
  • **(fr_FR)** 05/08/2026 13:45
  • **(ja_JP)** 2026/08/05 13:45
| | General date with long time | `G` |
  • **(en_US)** 8/5/2026 1:45:30 PM
  • **(fr_FR)** 05/08/2026 13:45:30
  • **(ja_JP)** 2026/08/05 13:45:30
| | Month and day | `m` or `M` |
  • **(en_US)** August 5
  • **(fr_FR)** 5 août
  • **(ja_JP)** 8 月 5 日
| | Round-trip date and time | `o` or `O` |
  • **(en_US)** 2026-08-05T13:45:30.1230000
  • **(fr_FR)** 2026-08-05T13:45:30.1230000
  • **(ja_JP)** 2026-08-05T13:45:30.1230000
| | RFC1123 date and time | `r` or `R` |
  • **(en_US)** Wed, 05 Aug 2026 13:45:30 GMT
  • **(fr_FR)** Wed, 05 Aug 2026 13:45:30 GMT
  • **(ja_JP)** Wed, 05 Aug 2026 13:45:30 GMT
| | Sortable date and time | `s` |
  • **(en_US)** 2026-08-05T13:45:30
  • **(fr_FR)** 2026-08-05T13:45:30
  • **(ja_JP)** 2026-08-05T13:45:30
| | Short time | `t` |
  • **(en_US)** 1:45 PM
  • **(fr_FR)** 13:45
  • **(ja_JP)** 13:45
| | Long time | `T` |
  • **(en_US)** 1:45:30 PM
  • **(fr_FR)** 13:45:30
  • **(ja_JP)** 13:45:30
| | Universal sortable date and time | `u` |
  • **(en_US)** 2026-08-05 13:45:30Z
  • **(fr_FR)** 2026-08-05 13:45:30Z
  • **(ja_JP)** 2026-08-05 13:45:30Z
| | Universal full date and time | `U` |
  • **(en_US)** Wednesday, August 5, 2026 1:45:30 PM
  • **(fr_FR)** mercredi 5 août 2026 13:45:30
  • **(ja_JP)** 2026 年 8 月 5 日 13:45:30
| | Month and year | `y` or `Y` |
  • **(en_US)** August 2026
  • **(fr_FR)** août 2026
  • **(ja_JP)** 2026 年 8 月
| ### Custom Date Formats You can format a date string using a custom format by passing a string that specifies the format. The strings that you use vary depending on whether you use Marketing Cloud Engagement or Marketing Cloud Next. #### Day and Date Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ---------------------- | ------- | ---------------------- | ---------------- | | Full day name | Monday | `dddd` | `EEEE` | | Abbreviated day name | Mon | `ddd` | `EEE` | | Date (zero-padded) | 05 | `dd` | `dd` | | Date (non-zero-padded) | 5 | `d` | `d` | | Day number in week | 1 | (not available) | `u` | #### Month Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ------------------------------ | ------- | ---------------------- | ---------------- | | Full month name | August | `MMMM` | `MMMMM` | | Abbreviated month name | Aug | `MMM` | `MMM` | | Month number (zero-padded) | 08 | `MM` | `MM` | | Month number (non-zero-padded) | 8 | `M` | `M` | #### Year Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ----------------------- | ------- | ---------------------- | ---------------- | | Full year number | 2026 | `yyyy` | `yyyy` | | Last two digits of year | 26 | `yy` | `yy` | | Calendar era | AD | `gg` | `G` | #### Time Format Strings | Description | Example | String (MC Engagement) | String (MC Next) | | ------------------------------------------------- | ------- | ---------------------- | ---------------- | | Hour (24-hour, zero-padded) | 13 | `HH` | `HH` | | Hour (24-hour, non-zero-padded) | 13 | `H` | `H` | | Hour (12-hour, zero-padded) | 01 | `hh` | `hh` | | Hour (12-hour, non-zero-padded) | 1 | `h` | `h` | | Minute (zero-padded) | 05 | `mm` | `mm` | | Minute (non-zero-padded) | 5 | `m` | `m` | | Second (zero-padded) | 09 | `ss` | `ss` | | Second (non-zero-padded) | 9 | `s` | `s` | | Millisecond | 423 | `fff` | `S` | | AM/PM marker (two letter) | PM | `tt` | `a` | | AM/PM marker (first letter only) | P | `t` | (not available) | | Time zone name | UTC | (not available) | `z` | | Time zone offset (hours and minutes, zero-padded) | -0800 | `zzz` | `Z` | | Time zone offset (hours only, zero-padded) | -08 | `zz` | `X` | | Time zone offset (hours only, non-zero-padded) | -8 | `z` | `X` | ### Usage Example This example shows how to format the date to include the full name of the day, the full name of the month, the date without a leading zero, and the year. It also shows the time in a 24-hour format, including hours, minutes, and seconds. This example works with Marketing Cloud Engagement. ``` %%[ Var @now, @dateString Set @now = "5 August 2024 1:41:23 PM" Set @dateString = FormatDate(@now, "dddd, MMMM d yyyy", "HH:mm:ss") ]%%

Date and time with a custom format: %%=v(@dateString)=%%

``` In Marketing Cloud Next, use this example instead. ``` %%[ Var @now, @dateString Set @now = "5 August 2024 1:41:23 PM" Set @dateString = FormatDate(@now, "EEEE, MMMMM d yyyy", "HH:mm:ss") ]%%

Date and time with a custom format: %%=v(@dateString)=%%

``` The function outputs the date and time using the format that you specified. ``` Date and time with a custom format: Monday, August 5 2024 13:41:23 ``` ### Formatting for a Different Locale You can format a date string into a format that aligns with the common notation for a locale by passing `S` or `L` for the `dateFormat` parameter, and the locale code for the `localeCode` parameter. ``` %%[ Var @now, @dateStringUA_S, @dateStringUA_L, @dateStringJP_S, @dateStringJP_L, @dateStringFR_S, @dateStringFR_L Set @now = "5 August 2024 1:41:23 PM" Set @dateStringUA_S = FormatDate(@now, "S", , "uk_UA") Set @dateStringUA_L = FormatDate(@now, "L", , "uk_UA") Set @dateStringJP_S = FormatDate(@now, "S", , "ja_JP") Set @dateStringJP_L = FormatDate(@now, "L", , "ja_JP") Set @dateStringFR_S = FormatDate(@now, "S", , "fr_CA") Set @dateStringFR_L = FormatDate(@now, "L", , "fr_CA") ]%%

Short-form date for the uk_UA locale (Ukrainian): %%=v(@dateStringUA_S)=%%

Long-form date for the uk_UA locale (Ukrainian): %%=v(@dateStringUA_L)=%%

Short-form date for the ja_JP locale (Japanese): %%=v(@dateStringJP_S)=%%

Long-form date for the ja_JP locale (Japanese): %%=v(@dateStringJP_L)=%%

Short-form date for the fr_CA locale (Canadian French): %%=v(@dateStringFR_S)=%%

Long-form date for the fr_CA locale (Canadian French): %%=v(@dateStringFR_L)=%%

``` The code outputs the short- and long-form date strings for the specified locales. ``` Short-form date for the uk_UA locale (Ukrainian): 05.08.2024 Long-form date for the uk_UA locale (Ukrainian): 5 серпня 2024 р. Short-form date for the ja_JP locale (Japanese): 2024/08/05 Long-form date for the ja_JP locale (Japanese): 2024年8月5日 Short-form date for the fr_CA locale (Canadian French): 2024-08-05 Long-form date for the fr_CA locale (Canadian French): 5 août 2024 ``` # FormatNumber() Formats a number as a numeric type, such as a decimal, date, or currency value. You can also use this function to convert numbers stored in strings to a number data type, and to round numbers to a certain number of decimal places. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` FormatNumber(number, formatType, cultureCode) ``` The `FormatNumber()` function has three parameters: - `number` (string or number): Required. The number that you want to format. This function assumes that the input number uses a period (.) as a decimal separator. - `formatType` (string): Required. The number type to convert the number to. Accepted values: - C - Formats the number as a currency value. - D - Formats the number as a decimal number. - E - Formats the number using scientific notation. - F - Formats the number to a fixed number of decimal places (two decimal places by default). - G - Formats the number without thousands separators. - N - Formats the number with thousands separators. - P - Formats the number as a percentage. - R - Round-trip (format ensures value parsed to string can be parsed back to numeric value) - X - Formats the number as a hexadecimal value. You can optionally follow this code with a number to indicate the precision of the number. For example, a currency value with two decimal places uses the parameter C2. - `cultureCode` (string): A POSIX locale code, such as `en_US` or `zh-TW`. When you provide this value, the resulting number is formatted using patterns that suit the specified locale. ## Usage To use the function, pass it a number to format, and the numeric type that you want to convert it to. You can optionally include a POSIX locale code. If you do, the function returns the resulting number in a format that aligns with the formatting practices of the specified culture. The following sections show several of the ways that you can use this function to format numbers. ### Rounding This example uses the N (number) type. The N is followed by a 2, indicating that the resulting number is rounded to two decimal places. ``` %%=FormatNumber(123.445,"N2")=%% ``` The function returns `123.45`. ### Converting Strings to Numbers This example converts a string to a number data type. ``` %%=FormatNumber("1234.56", "N")=%% ``` The function returns `1,234.56`. ### Normalizing Numbers You can use the G (general) number type to remove the thousands separators from numbers that are passed as strings. ``` %%=FormatNumber("1,234.56","G","en_US")=%% ``` The function returns `1234.56`. ### Localizing Numbers This example formats the input number as a currency value, rounded to two decimal places. It also formats the resulting number using rules that align with the `de_DE` (Germany) locale. ``` %%=FormatNumber("123.445","C2","de_DE")=%% ``` The function returns `123,45 €`. ### Converting Numbers to Percentages This example converts the result of dividing two numbers into a percentage. ``` %%[ Set @val1 = 42 Set @val2 = 326 Set @pct = Divide(@val1, @val2) ]%% %%=FormatNumber(@pct, "P3")=%% ``` The function returns `12.883%`. # ForwardedEmailEvent An object that contains information about a Forward To A Friend event. ## Properties | Name | Data Type | Description | | --------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `BatchID` | Int | Ties triggered send sent events to other events (like clicks and opens that occur at a later date and time). | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `EventDate` | DateTime | Date when a tracking event occurred. | | `EventType` | [EventType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/eventtype.md) object | The type of tracking event. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `SendID` | Int | Contains identifier for a specific send. | | `SubscriberKey` | String | Identification of a specific subscriber. | | `TriggeredSendDefinitionObjectID` | String | Identifies the triggered send definition associated with an event. This value also appears in tracking events to allow you to tie those events to a specific triggered send. | ## SOAP Envelope ``` ForwardedEmailEvent ID PartnerKey CreatedDate ModifiedDate Client.ID SendID SubscriberKey EventDate EventType TriggeredSendDefinitionObjectID BatchID ``` ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # ForwardedEmailOptInEvent The ForwardedEmailOptInEvent object specifies an opt-in event related to a Forward To A Friend event. ## Properties | Name | Data Type | Description | | --------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `BatchID` | Int | Ties triggered send sent events to other events (like clicks and opens that occur at a later date and time). | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `EventDate` | DateTime | Date when a tracking event occurred. | | `EventType` | [EventType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/eventtype.md) object | The type of tracking event. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `OptInSubscriberKey` | String | Specifies the subscriber key of a subscriber opted in via forwarded email. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `SendID` | Int | Contains identifier for a specific send. | | `SubscriberKey` | String | Identification of a specific subscriber. | | `TriggeredSendDefinitionObjectID` | String | Identifies the triggered send definition associated with an event. This value also appears in tracking events to allow you to tie those events to a specific triggered send. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # Functions Use Account Server-side JavaScript functions to access and modify accounts within your Marketing Cloud Engagement account. ## Load In your server-side JavaScript code, load the core library using the syntax below: ``` Platform.Load("core", "1"); ``` ## Initialization To interact with an Account via server-side JavaScript, you must first initialize the object. This code initializes an account with the external key of 'myAccount'. ``` Account.Init("myAccount"); ``` Once you initialize the Account object, you can use the other Account functions. # General The following are general technical articles for SOAP API. - [Check the Results of an API Call](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/checking_the_results_of_an_api_call.md) - [Perform a Data Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_a_data_extract_activity_with_the_soap_web_service_api.md) - [Create, Retrieve, Update, and Delete Folders](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_retrieving_updating_and_deleting_folders.md) - [Get the Fields Available for Retrieval](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting_the_fields_available_for_retrieval.md) - [Incoming Date Normalization](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/incoming_date_normalization.md) - [Perform a File Transfer](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/performing_a_file_transfer_activity_via_the_soap_api.md) - [Resolve Retrieve Call Errors](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/resolving_retrieve_call_errors.md) - [Retrieve All Records Since Last Batch](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_all_records_since_last_batch.md) - [Retrieve More than 2500 Records Using the ContinueRequest Property](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/continuerequest_2500records.md) - [Retrieve the Availability Status of an Account](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_availability_status_of_an_exacttarget_account.md) - [Review SOAP Envelopes to Retrieve Information](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/reviewing_soap_envelopes_to_retrieve_information.md) # GET /contacts/v1/attributeSetDefinitions Retrieves all attribute set definition from your contact data model. ## Code Example To retrieve all of the attribute set definitions for your account, issue a GET request to the `/contacts/v1/attributeSetDefinitions` endpoint. ```none Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/attributeSetDefinitions Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about the attribute sets in your contact data model. **note:** The output of this request contains several thousand lines. For a result that's easier to interpret, [retrieve the definitions for a specific attribute set by passing its ID](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_contacts/retrieveAttributeSetDefinitions.md). This sample has been shortened. ```json { "page": 1, "pageSize": 50, "count": 14, "items": [ { "id": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "key": "PushDemographics", "name": { "value": "MobilePush Demographics" }, "fullyQualifiedName": "MobilePush Demographics", "storageLogicalType": "PushAttributes", "isRoot": false, "isSendable": true, "categoryID": 685512, "isShared": false, "dataRetentionProperties": { "setDefinitionID": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "isRowBasedRetention": false, "isResetRetentionPeriodOnImport": false, "isDeleteAtEndOfRetentionPeriod": false }, "sendAttributeStorageName": "_ContactID", "sendContactKeyStorageName": "_SubscriberID", "isEvent": false, "relationships": [ { "id": "33f35cd5-f1c1-e311-a1e0-e83935a85380", "leftItem": { "relationshipType": "AttributeGroup", "identifier": "30f35cd5-f1c1-e311-a1e0-e83935a85380", "cardinality": "One", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "rightItem": { "relationshipType": "AttributeSet", "identifier": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "cardinality": "Many", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "relationshipAttributes": [ { "leftAttributeID": "487b6afa-7e4c-e311-8052-e83935a85380", "rightAttributeID": "16f35cd5-f1c1-e311-a1e0-e83935a85380", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" } ], "isSystemDefined": false, "leftRelationshipReferenceType": "CustomerData", "leftRelationshipIDs": [ { "type": "int16", "value": "2" } ], "canModify": false, "canRemove": false, "links": {}, "objectState": "Created" }, { "id": "c0453e25-1167-e411-92ad-e83935a85380", "leftItem": { "relationshipType": "AttributeSet", "identifier": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "cardinality": "One", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "rightItem": { "relationshipType": "AttributeSet", "identifier": "b7453e25-1167-e411-92ad-e83935a85380", "cardinality": "Many", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "relationshipAttributes": [ { "leftAttributeID": "12f35cd5-f1c1-e311-a1e0-e83935a85380", "rightAttributeID": "b8453e25-1167-e411-92ad-e83935a85380", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, { "leftAttributeID": "19f35cd5-f1c1-e311-a1e0-e83935a85380", "rightAttributeID": "b9453e25-1167-e411-92ad-e83935a85380", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" } ], "isSystemDefined": false, "leftRelationshipIDs": [], "canModify": false, "canRemove": false, "links": {}, "objectState": "Created" }, { "id": "d4453e25-1167-e411-92ad-e83935a85380", "leftItem": { "relationshipType": "AttributeSet", "identifier": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "cardinality": "One", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "rightItem": { "relationshipType": "AttributeSet", "identifier": "ca453e25-1167-e411-92ad-e83935a85380", "cardinality": "Many", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "relationshipAttributes": [ { "leftAttributeID": "12f35cd5-f1c1-e311-a1e0-e83935a85380", "rightAttributeID": "cb453e25-1167-e411-92ad-e83935a85380", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, { "leftAttributeID": "19f35cd5-f1c1-e311-a1e0-e83935a85380", "rightAttributeID": "ce453e25-1167-e411-92ad-e83935a85380", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" } ], "isSystemDefined": false, "leftRelationshipIDs": [], "canModify": false, "canRemove": false, "links": {}, "objectState": "Created" } ], "attributes": [ { "id": "12f35cd5-f1c1-e311-a1e0-e83935a85380", "key": "PushAppID", "name": { "value": "Application" }, "storageName": "_APID", "dataType": "Text", "isPrimaryKey": true, "isNullable": false, "isReadOnly": true, "displayOrder": 2, "ranges": [], "description": "", "length": 38, "dataSourceID": 3, "restrictedValues": [], "restrictionLookupListID": 4, "customerDataID": 7, "fullyQualifiedName": "MobilePush Demographics.Application", "parentId": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "isSystemDefined": true, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" }, { "id": "13f35cd5-f1c1-e311-a1e0-e83935a85380", "key": "Badge", "name": { "value": "Badge" }, "storageName": "_Badge", "dataType": "Number", "isPrimaryKey": false, "isNullable": true, "isReadOnly": true, "displayOrder": 3, "ranges": [], "description": "", "dataSourceID": 3, "restrictedValues": [], "fullyQualifiedName": "MobilePush Demographics.Badge", "parentId": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "isSystemDefined": true, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" }, { "id": "14f35cd5-f1c1-e311-a1e0-e83935a85380", "key": "Channel", "name": { "value": "Channel" }, "storageName": "_Channel", "dataType": "Text", "isPrimaryKey": false, "isNullable": true, "isReadOnly": true, "displayOrder": 4, "ranges": [], "description": "", "length": 20, "dataSourceID": 3, "restrictedValues": [], "fullyQualifiedName": "MobilePush Demographics.Channel", "parentId": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "isSystemDefined": true, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" }, { "id": "15f35cd5-f1c1-e311-a1e0-e83935a85380", "key": "City", "name": { "value": "City" }, "storageName": "_City", "dataType": "Text", "isPrimaryKey": false, "isNullable": true, "isReadOnly": false, "displayOrder": 5, "ranges": [], "description": "", "length": 200, "dataSourceID": 3, "restrictedValues": [], "fullyQualifiedName": "MobilePush Demographics.City", "parentId": "10f35cd5-f1c1-e311-a1e0-e83935a85380", "isSystemDefined": false, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" }, ... ], "canAddValues": true, "isSystemDefined": true, "canRemove": false, "canModify": false, "isReadOnly": false, "applicationID": "2051892d-5de2-4ecf-98af-8ca9a40d2c9c", "applicationKey": "com.exacttarget.mobilepush", "links": {}, "objectState": "Created" }, ... ], "links": { "self": { "href": "/v1/attributeSetDefinitions" }, "schema": { "href": "/v1/schema" } }, "requestServiceMessageID": "57d67e08-6e4c-4e06-98e6-f0993725c1ae", "responseDateTime": "2024-09-05T14:09:16.7400199-06:00", "resultMessages": [], "serviceMessageID": "eacba18f-c31c-4619-bc05-522d72e99ee0" } ``` # GET /contacts/v1/attributeSetDefinitions/{id} Retrieves an attribute set definition from your contact data model. ## URL Parameters | Name | Type | Description | | ---- | ------ | --------------------------------------------- | | `id` | string | The unique ID of an attribute set definition. | ## Code Example To retrieve information about an attribute set definition, issue a GET request to the `/contacts/v1/attributeSetDefinitions/{id}` endpoint. Replace `{id}` with the UUID of the attribute set. ```none Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/attributeSetDefinitions/{id} Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about the attribute set that you specified in the request. ```json { "item": { "id": "fab858d9-8473-4b43-a8bb-f3ca921c54a8", "key": "Contact", "name": { "value": "Contact" }, "fullyQualifiedName": "Contact", "isRoot": false, "isSendable": false, "isEvent": false, "relationships": [ { "id": "507b6afa-7e4c-e311-8052-e83935a85380", "leftItem": { "relationshipType": "AttributeGroup", "identifier": "ab7a6afa-7e4c-e311-8052-e83935a85380", "cardinality": "One", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "rightItem": { "relationshipType": "AttributeSet", "identifier": "fab858d9-8473-4b43-a8bb-f3ca921c54a8", "cardinality": "One", "connectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" }, "relationshipAttributes": [ { "leftAttributeID": "784e0522-e295-4ad1-9121-74cd50f47183", "rightAttributeID": "784e0522-e295-4ad1-9121-74cd50f47183", "leftConnectingID": { "identifierType": "FullyQualifiedName" }, "rightConnectingID": { "identifierType": "FullyQualifiedName" }, "objectState": "Created" } ], "isSystemDefined": false, "leftRelationshipReferenceType": "CustomerData", "leftRelationshipIDs": [ { "type": "int16", "value": "2" } ], "canModify": false, "canRemove": false, "links": {}, "objectState": "Created" } ], "attributes": [ { "id": "497b6afa-7e4c-e311-8052-e83935a85380", "key": "ContactKey", "name": { "value": "Contact Key" }, "storageName": "SubscriberKey", "dataType": "Text", "isPrimaryKey": false, "isNullable": false, "isReadOnly": true, "ranges": [], "description": "", "length": -1, "dataSourceID": 1, "restrictedValues": [], "customerDataID": 3, "fullyQualifiedName": "Contact.Contact Key", "parentId": "fab858d9-8473-4b43-a8bb-f3ca921c54a8", "isSystemDefined": true, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" }, { "id": "784e0522-e295-4ad1-9121-74cd50f47183", "key": "ContactID", "name": { "value": "Contact ID" }, "storageName": "SubscriberID", "dataType": "Number", "isPrimaryKey": true, "isNullable": false, "isReadOnly": true, "ranges": [], "description": "", "dataSourceID": 1, "restrictedValues": [], "customerDataID": 2, "fullyQualifiedName": "Contact.Contact ID", "parentId": "fab858d9-8473-4b43-a8bb-f3ca921c54a8", "isSystemDefined": true, "isIdentityValue": false, "isHidden": false, "isUpdateable": false, "parentType": "Set", "dataSourceName": {}, "links": {}, "objectState": "Created" } ], "canAddValues": false, "isSystemDefined": true, "canRemove": false, "canModify": false, "isReadOnly": true, "applicationID": "ce703ed3-e01f-4f5f-900d-76a95b363e29", "applicationKey": "com.exacttarget.contacts", "links": {}, "objectState": "Created" }, "links": { "attributeSetDefinitions": { "href": "/v1/attributeSetDefinitions" }, "schema": { "href": "/v1/schema" } }, "requestServiceMessageID": "06e44ef4-9753-4cb4-b20a-d51eced27b3c", "responseDateTime": "2024-09-05T14:04:09.041557-06:00", "resultMessages": [], "serviceMessageID": "635a0c87-3d9e-450b-93a8-4223e0187aba" } ``` # GET /contacts/v1/attributeSets/name:{name} Retrieves a collection of attribute value containers or the data rows of a specified attribute set by name. ## URL Parameters | Name | Type | Description | | ------ | ------ | ------------------------------------------------------------------------ | | `name` | String | Required. The name of the attribute set. Precede the value with `name:`. | ## Usage This call populates the ID, Key, and Name values for all items. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/attributeSets/name:Retail%20Orders Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about the requested attribute containers. ```json { "count": 200, "page": 10, "pageSize": 3, "Id": "abe05aca-2c17-e311-bb14-00237d5401ce", "Key": "Retail Orders", "Name": "Retail Orders", "SchemaId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0", "_links": { "self": { "href": "/attributeSets/{id}" }, "next": { "href": "/attributeSets/{id}?$page=11&$pageSize=3" }, "prev": { "href": "/attributeSets/{id}?$page=9&$pageSize=3" }, "attributeSetDefinition": {} }, "items": [ { "values": [ { "id": "abe05acb-2c17-e311-bb14-00237d5401ce", "key": "Customer Key", "name": "Customer Key", "value": "sgest@example.com" }, { "id": "abe05acd-2c17-e311-bb14-00237d5401ce", "key": "Order Number", "name": "Order Number", "value": "123456" }, { "id": "abe05ace-2c17-e311-bb14-00237d5401ce", "key": "Order Total", "name": "Order Total", "value": "177.99" } ] } ] } ``` # GET /contacts/v1/contacts/actions/delete/status?operationID= ## Overview Retrieves status of contact deletion operation. ### URL Parameters | Name | Type | | Description | | --------------- | ------- | ------------ | ----------------------------------------------------------------- | | **operationID** | integer | **Required** | Query string parameter indicating ID of operation to check status | ## Usage Use the OperationID value returned by a contact delete call in the query string parameter. Since the contact delete call has 2 phases, there is a response example for each of the 2 phases. ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/contacts/actions/delete/status?operationID= Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ``` { "operation": { "listTypeID": 5, "listIdentifier": "037c2811-ce62-4381-b3d2-1936e51fbf4d", "listKey": "037c2811-ce62-4381-b3d2-1936e51fbf4d", "expectedListCount": 1, "deleteType": "ContactAndAttributes", "deleteListOnCompleted": false, "operationID": 2, "eID": 12345, "mID": 12345, "employeeID": 30980, "operationRequestID": "21d0d10d-a15a-413c-bc3e-8b43b185e551", "status": "Completed", "scheduledTime": "2016-06-14T16:01:58.107", "retryCount": 0, "createdDate": "2016-06-14T16:02:00", "createdBy": 30980, "modifiedDate": "2016-06-14T16:02:00", "modifiedBy": 30980 }, "requestServiceMessageID": "93631be1-107f-4239-a8b7-cdae245d7403", "resultMessages": [], "serviceMessageID": "00e6add8-d79a-4bd6-9568-2f2a272538f0" } ``` In the delete phase, the backgroundOperationStatusID under the backgroundOperationsSummary node provides that status. If you're implementing this API, should use the backgroundOperationStatusID to determine whether or not the deletion has been fully processed. The notable values of backgroundOperationStatusID are: ``` Completed Aborted (this is usually done at customer's request - this means contacts were restored back to active after suppression phase was completed) Invalid ``` All other status values should be interpreted as "Processing". Developers often use this status in their API implementation layer. ### Example Response - GetStatusRoute: Delete Operations ``` { "operationMappings": [], "numberofRestorableDays": 14, "operation": { "contextType": 0, "isRestrictedForProcessing": false, "listTypeID": 1, "listIdentifier": "TestListInput", "listKey": "TestListInput.Key", "expectedListCount": 1, "deleteType": "ContactAndAttributes", "deleteListOnCompleted": false, "errorsOccurredInBatchProcess": false, "lastProcessedMilestone": "Completed", "operationID": 1, "eID": 10650003, "mID": 10650003, "employeeID": -1000, "requestID": "c79583e2-cc79-4a38-8378-52714b00eaa1", "status": "Pending", "scheduledDate": "2019-07-02T14:24:48.013", "startDate": "2019-07-02T14:24:48.013", "endDate": "2019-07-02T14:24:48.013", "retryCount": 0, "createdDate": "2019-07-02T14:25:00", "createdBy": -1000, "modifiedDate": "2019-07-02T14:25:00", "modifiedBy": -1000 }, "requestServiceMessageID": "450f5391-3850-4d00-a0d7-3f3bb55abee3", "responseDateTime": "2019-07-02T14:24:48.5030664-04:00", "resultMessages": [], "serviceMessageID": "99e75027-deed-4441-b94a-bdfd335e730f" } ``` ### Example - Operation Completed Suppression, within ‘Delete Phase’ / Processing ``` { "operationMappings": [], "backgroundOperationsSummary": [ { "backgroundOperationID": 1, "createdDate": "2019-07-02T14:27:42.4039", "backgroundOperationStatusID": "Processing" } ], "numberofRestorableDays": 14, "operation": { "contextType": 0, "isRestrictedForProcessing": false, "listTypeID": 1, "listIdentifier": "TestListInput", "listKey": "TestListInput.Key", "expectedListCount": 1, "deleteType": "ContactAndAttributes", "deleteListOnCompleted": false, "errorsOccurredInBatchProcess": false, "lastProcessedMilestone": "Completed", "operationID": 1, "eID": 10650003, "mID": 10650003, "employeeID": -1000, "requestID": "3b475bee-aa37-4aa4-9fcc-c58d2f9e6242", "status": "Completed", "scheduledDate": "2019-07-02T14:27:42.383", "startDate": "2019-07-02T14:27:42.383", "endDate": "2019-07-02T14:27:42.383", "retryCount": 0, "createdDate": "2019-07-02T14:28:00", "createdBy": -1000, "modifiedDate": "2019-07-02T14:28:00", "modifiedBy": -1000 }, "requestServiceMessageID": "e35a0144-8b75-4d9b-b75f-9c51037333d6", "responseDateTime": "2019-07-02T14:27:42.9189678-04:00", "resultMessages": [], "serviceMessageID": "e72e7086-3019-43e0-8858-088c7864d6c9" } ``` # GET /contacts/v1/contacts/actions/restrict/status?operationID= ## Overview Retrieves the status of the contact restrict operation. ### URL Parameters | Name | Type | | Description | | --------------- | ---- | ------------ | --------------------------------------------------- | | **operationID** | GUID | **Required** | ID of the operation you are checking the status of. | ### Responses | Status | Name | Type | Description | | ------- | ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Restrict request response** | |   | operationInitiated | boolean | System-initiated restrict operation. | |   | operationID | integer | Auto-generated restrict operation ID. Keep track of this ID because it allows you to check the status of a restriction and decide how to proceed if there is a failure. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | integer | The datetime restrict response is created in the system in GMT time. | |   | hasErrors | boolean | The requested operation is initiated with an error or not. | |   | resultMessages | array | Array of messages about the restrict operation. | |   | serviceMessageID | guid | Service message ID for the response. | |   |   |   |   | | **400** |   |   | **Bad restrict request response** | |   | operationInitiated | boolean | System-initiated restrict operation. | |   | operationID | integer | Auto-generated restrict operation ID. Keep track of this ID because it allows you to check the status of a restriction and decide how to proceed if there is a failure. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | integer | The datetime restrict response is created in the system in GMT time. | |   | hasErrors | boolean | The requested operation is initiated with error or not. For a 400 response this is true. | |   | resultMessages | array | Array of messages about the restrict operation, with details about the bad request, like resulttype and resultcode. | |   | serviceMessageID | guid | Service message ID for the response. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/contacts/actions/restrict/status?operationID=2105 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```json { "backgroundOperationsSummary": [], "numberofRestorableDays": -1, "operation": { "listTypeID": 5, "listIdentifier": "aa11b2cc-d6ea-4f46-bbfc-a4b7afa3f449", "listKey": "bb11c2dd-d6ea-4f46-bbfc-a4b7afa3f449", "listName": "Prestaged List", "expectedListCount": 1, "actualListCount": 1, "deleteType": "ContactAndAttributes", "deleteListOnCompleted": false, "errorsOccurredInBatchProcess": false, "isRestrictedForProcessing": true, "operationID": 2105, "eID": 55555555, "mID": 55555555, "employeeID": 12345678, "operationRequestID": "1a22b33c-daf1-4ff9-b381-18658d74c547", "status": "Completed", "scheduledTime": "2018-01-30T12:40:09.06", "startTime": "2018-01-30T18:40:11.293", "endTime": "2018-01-30T18:40:11.963", "retryCount": 0, "createdDate": "2018-01-30T18:40:00", "createdBy": 12345678, "modifiedDate": "2018-01-30T18:40:00", "modifiedBy": 10898158 }, "requestServiceMessageID": "a12345b6-5490-4ecf-bed1-cb2112eddd7b", "responseDateTime": "2018-01-30T12:42:05.819137-06:00", "resultMessages": [], "serviceMessageID": "ab11cd2e-1f74-489e-98fb-ff6d2c33a5e4" } ``` # GET /contacts/v1/contacts/analytics/deleterequests Retrieves details of contact delete requests for a date range. ## URL Parameters | Name | Type | | Description | | ---------------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------- | | **startdateutc** | datetime | **Required** | Start date and time in UTC of the date range. | | **enddateutc** | datetime | **Required** | End date and time in UTC of the date range. | | **statusid** | int | | Delete request status ID. Use it to filter delete requests by status. Valid values are 1 - Processing, 5 - Completed, and 7 - Invalid. | | **$pagesize** | int | | Number of records per page. | | **$page** | int | | Page number to retrieve. | | **$orderBy** | string | | Determines which property to use for sorting and the direction in which to sort the data. | ## Responses | Status | Name | Type | Description | | ------- | --------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Retrieved contact delete requests details.** | |   | startDateUtc | datetime | Start date and time in UTC of the date range. | |   | endDateUtc | datetime | End date and time in UTC of the date range. | |   | pageSize | integer | Page size of results retrieved. | |   | pageNumber | integer | Page number of results retrieved. | |   | operations | array | Contact delete request information. | |   | operations\:operationid | int | Contact delete request ID. | |   | operations\:receiveddateutc | datetime | Date and time in UTC when the contact delete request was created. | |   | operations\:status | string | Status of the contact delete request. | |   | operations\:totalcontactcount | int | Total number of contacts in the contact delete request. | |   | operations\:completedcontactcount | int | Number of contacts that were deleted in the delete request. | |   | operations\:laststatusdateutc | datetime | Date and time in UTC when the delete request’s status was most recently modified. | |   | operations\:deletemethod | string | Method used to delete the contacts. | |   | statusasofdateutc | datetime | Date and time in UTC when the status was retrieved. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | datetime | Date and time in UTC when the response was created in the system. | |   | resultMessages | array | Array of messages about the request. Includes details, such as resulttype and resultcode, about a bad request. | |   | serviceMessageID | guid | Service message ID for the response. | |   |   |   |   | | **400** |   |   | **The request is missing a required parameter or contains an invalid parameter.** | |   | startDateUtc | datetime | Start date and time in UTC of the date range. | |   | endDateUtc | datetime | End date and time in UTC of the date range. | |   | pageSize | integer | Page size of results retrieved. | |   | pageNumber | integer | Page number of results retrieved. | |   | statusasofdateutc | datetime | Date and time in UTC when the status of the contact delete request was retrieved. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | datetime | Date and time in UTC when the response was created in the system. | |   | resultMessages | array | Array of messages about the request. Includes details, such as resulttype and resultcode, about a bad request. | |   | serviceMessageID | guid | Service message ID for the response. | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET contacts/v1/contacts/analytics/deleterequests?startdateutc=2019-02-18T00%3A00%3A00&enddateutc=2019-03-19T00%3A00%3A00&%24page=1&%24pagesize=20&%24orderby=operationId%20desc&statusid=5 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "startDateUtc":"2019-02-18T00:00:00", "endDateUtc":"2019-03-19T00:00:00", "statusAsOfDateUtc":"2019-03-19T19:33:17.496471Z", "pageNumber":1, "pageSize":20, "operations":[ { "operationId":22944, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-03-04T22:42:00", "status":"Completed", "lastStatusDateUtc":"2019-03-19T04:47:40.293", "deleteMethod":"Contact Key/ID" }, { "operationId":22943, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-03-04T22:41:00", "status":"Completed", "lastStatusDateUtc":"2019-03-19T04:47:40.293", "deleteMethod":"Contact Key/ID" }, { "operationId":22625, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T23:26:00", "status":"Completed", "lastStatusDateUtc":"2019-03-13T10:10:17.9", "deleteMethod":"Contact Key/ID" }, { "operationId":22624, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T23:25:00", "status":"Completed", "lastStatusDateUtc":"2019-03-13T10:10:17.9", "deleteMethod":"Contact Key/ID" }, { "operationId":22598, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T16:22:00", "status":"Completed", "lastStatusDateUtc":"2019-03-13T00:41:55.317", "deleteMethod":"Contact Key/ID" }, { "operationId":22597, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T16:21:00", "status":"Completed", "lastStatusDateUtc":"2019-03-13T00:41:55.317", "deleteMethod":"Contact Key/ID" }, { "operationId":22594, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T04:34:00", "status":"Completed", "lastStatusDateUtc":"2019-03-12T13:36:48.677", "deleteMethod":"Contact Key/ID" }, { "operationId":22593, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-26T04:33:00", "status":"Completed", "lastStatusDateUtc":"2019-03-12T13:36:48.677", "deleteMethod":"Contact Key/ID" }, { "operationId":22544, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-25T17:03:00", "status":"Completed", "lastStatusDateUtc":"2019-03-11T23:06:49.167", "deleteMethod":"Contact Key/ID" }, { "operationId":22543, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-25T17:02:00", "status":"Completed", "lastStatusDateUtc":"2019-03-11T23:06:49.167", "deleteMethod":"Contact Key/ID" }, { "operationId":22535, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-25T16:00:00", "status":"Completed", "lastStatusDateUtc":"2019-03-11T22:06:33.593", "deleteMethod":"Contact Key/ID" }, { "operationId":22534, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-25T15:59:00", "status":"Completed", "lastStatusDateUtc":"2019-03-11T22:06:33.593", "deleteMethod":"Contact Key/ID" }, { "operationId":22409, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-22T20:05:00", "status":"Completed", "lastStatusDateUtc":"2019-03-09T08:49:36.62", "deleteMethod":"Contact Key/ID" }, { "operationId":22408, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-22T20:04:00", "status":"Completed", "lastStatusDateUtc":"2019-03-09T08:49:36.62", "deleteMethod":"Contact Key/ID" }, { "operationId":22313, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-21T05:02:00", "status":"Completed", "lastStatusDateUtc":"2019-03-07T11:04:41.687", "deleteMethod":"Contact Key/ID" }, { "operationId":22312, "totalContactCount":1, "completedContactCount":1, "receivedDateUtc":"2019-02-21T05:01:00", "status":"Completed", "lastStatusDateUtc":"2019-03-07T11:04:41.687", "deleteMethod":"Contact Key/ID" } ], "requestServiceMessageID":"e1198208-6432-40fd-b5ae-172c9d9bc44a", "responseDateTime":"2019-03-19T13:33:18.2141124-06:00", "resultMessages":[ ], "serviceMessageID":"ef7d833c-509f-4dbc-8f99-060aac3c0382" } ``` # GET /contacts/v1/contacts/analytics/deleterequests/summary ## Overview Retrieves a summary of contact delete requests for a date range. ### URL Parameters | Name | Type | | Description | | ---------------- | -------- | ------------ | --------------------------------------------- | | **startdateutc** | datetime | **Required** | Start date and time in UTC of the date range. | | **enddateutc** | datetime | **Required** | End date and time in UTC of the date range. | ### Responses | Status | Name | Type | Description | | ------- | ----------------------------- | -------- | -------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Retrieved summary of contact delete requests.** | |   | startDateUtc | datetime | Start date and time in UTC of the date range. | |   | endDateUtc | datetime | End date and time in UTC of the date range. | |   | statusasofdateutc | datetime | Date and time in UTC when the status was retrieved. | |   | interval | integer | Interval of the time series. 0 indicates hourly intervals, and 1 indicates daily intervals. | |   | itemcount | integer | Number of items in the time series. | |   | totaltimeseries | array | Time series with information about total contact delete requests. | |   | totaltimeseries.requestcount | integer | Number of contact delete requests submitted for the date range. | |   | totaltimeseries.minvalue | integer | The lowest number of contact delete requests made during the time series. | |   | totaltimeseries.maxvalue | integer | The most contact delete requests made during the time series. | |   | totaltimeseries.items | array | Array of items with the number of contact delete requests made during the interval. | |   | totaltimeseries.items.time | datetime | Interval’s beginning date and time in UTC. | |   | totaltimeseries.items.value | integer | Number of contact delete requests made during the interval. | |   | statustimeseries | array | Time series with information about contact delete requests based on status. | |   | statustimeseries.status | string | Status of the time series item. | |   | statustimeseries.requestcount | integer | Number of contact delete requests made for the date range. | |   | statustimeseries.minvalue | integer | The lowest number of contact delete requests made during the time series. | |   | statustimeseries.maxvalue | integer | The most contact delete requests made during the time series. | |   | statustimeseries.items | array | Array of items with the number of contact delete requests made during the interval. | |   | statustimeseries.items.time | datetime | Interval's beginning date and time. | |   | statustimeseries.items.value | integer | Number of contact delete requests made during the interval. | |   |   |   |   | | **400** |   |   | **The request is missing a required parameter or contains an invalid parameter.** | |   | startDateUtc | datetime | Start date and time in UTC of the date range. | |   | endDateUtc | datetime | End date and time in UTC of the date range. | |   | interval | integer | Interval of the time series. 0 indicates hourly intervals, and 1 indicates daily intervals. | |   | statusasofdateutc | datetime | Date and time in UTC when the status was retrieved. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | datetime | Date and time in UTC when the response was created in the system. | |   | resultMessages | array | Array of messages about the request. Includes details, such as resulttype and resultcode, about a bad request. | |   | serviceMessageID | guid | Service message ID for the response. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com POST /contacts/analytics/deleterequests/summary?startdateutc=2018-01-15T00:00:00Z&enddateutc=2018-01-15T05:00:00Z Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js { "startdateutc":"2018-01-15T00:00:00Z", "enddateutc":"2018-01-15T04:30:00Z", "statusofdateutc": "2018-01-17T04:30:00Z", "interval":"0", "itemcount":5, "totaltimeseries":[ { "requestcount":500, "minvalue":100, "maxvalue":100, "items":[ {time:"01-15-2018 00:00:00","value":100}, {time:"01-15-2018 01:00:00","value":100}, {time:"01-15-2018 02:00:00","value":100}, {time:"01-15-2018 03:0000:","value":100}, {time:"01-15-2018 04:00:00","value":100} ] }], "statustimeseries":[ { "statusid": 5, "status": "Completed" "requestcount":350, "minvalue":0, "maxvalue":100, "items":[ {time:"01-15-2018 00:00:00","value":100}, {time:"01-15-2018 01:00:00","value":100}, {time:"01-15-2018 02:00:00","value":100}, {time:"01-15-2018 03:00:00","value":50}, {time:"01-15-2018 04:00:00","value":0} ] }, { "statusid": 1, "status": “Processing” "requestcount":100, "minvalue":0, "maxvalue":75, "items":[ {time:"01-15-2018 00:00:00","value":0}, {time:"01-15-2018 01:00:00","value":0}, {time:"01-15-2018 02:00:00","value":0}, {time:"01-15-2018 03:00:00","value":25}, {time:"01-15-2018 04:00:00","value":75} ] }, { "statusid": 7, "Status": "Invalid", "requestcount":50, "minvalue":0, "maxvalue":50, "items":[ {time:"01-15-2018 00:00:00","value":0}, {time:"01-15-2018 01:00:00","value":0}, {time:"01-15-2018 02:00:00","value":0}, {time:"01-15-2018 03:00:00","value":25}, {time:"01-15-2018 04:00:00","value":25} ] }] } ``` # GET /contacts/v1/contacts/deleteOperations ## Overview Retrieves the list of contact delete operations. ## Responses | Status | Name | Type | Description | | ----------- | ------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Successfully retrieved list of contact delete operations** | |   | items | array | Array of retrieved contact delete operations. | |   | items.operationID | long | Operation ID of the contact delete operation. Keep track of this ID because it allows you to check the status of a deletion and decide how to proceed if there is a failure. | |   | items.eid | long | ID for the top-level enterprise account associated with the business unit. | |   | items.mid | long | Account ID of the account user. | |   | items.employeeID | long | Employee ID of the user who created the contact delete operation. | |   | items.OperationRequestID | guid | Request ID of the contact delete operation. | |   | items.status | string | Current status of the contact delete operation PendingProcessing Cancelling Cancelled Failed Completed CompletedWithErrors. | |   | items.scheduledTime | datetime | Date the contact delete operation is scheduled to start. | |   | items.startTime | datetime | Date the contact delete operation started. | |   | items.endTime | datetime | Date the contact delete operation ended. | |   | items.listTypeID | Short | Type of list used in the contact delete operation. | |   | items.listIdentifier | string | Identifier of list used in the contact delete operation. | |   | items.listKey | string | ListKey of list used in the contact delete operation. | |   | items.listName | string | Name of list used in the contact delete operation. | |   | items.expectedListCount | long | Estimated number of contacts to delete in the contact delete operation. | |   | items.actualListCount | long | Actual number of contacts to delete in the contact delete operation. | |   | items.successCount | long | Number of contacts successfully deleted in the contact delete operation. | |   | items.errorCount | long | Number of contacts that errored out in the contact delete operation. | |   | items.deleteType | string | Type of delete performed: None ContactAndAttributes AttributesOnly | |   | items.operationName | string | Name of the contact delete operation. | |   | items.restorableUntilDate | datetime | Deadline to restore contacts deleted by contact delete operation. | |   | items.createdDate | datetime | Creation date of contact delete operation. | |   | items.createdBy | long | Employee ID of the user who created the contact delete operation. | |   | pageNumber | integer | Requested page number of results. | |   | pageSize | integer | Requested page size of results. | |   | count | integer | Total count of contact delete operation. | |   | resultMessages | array | Array of returned error messages generated while processing request. | |   | requestservicemessageid | guid | Service message ID for the request. | |   | servicemessageid | guid | Service message ID for the response. | |   |   |   |   | | **default** |   |   | **Unexpected error** | |   | pageNumber | integer | Requested page number of results | |   | pageSize | integer | Requested page size of results | |   | count | integer | Total count of contact delete operation | |   | resultMessages | array | Array of returned error messages generated while processing request | |   | requestservicemessageid | guid | Service message ID for the request | |   | servicemessageid | guid | Service message ID for the response | # GET /contacts/v1/contacts/id:{contactId}/Preferences ## Overview Retrieves consent management information from contact records by contact ID for data protection and privacy concerns. GET requests might display values that are reserved for future use and don't perform any actions at this time. Use only the parameters documented here. ### URL Parameters | Name | Type | | Description | | ------------- | ------ | ------------ | -------------------------- | | **contactId** | string | **Required** | Unique ID for the contact. | ### Responses | Status | Name | Type | Description | | ------- | ------------------------- | ------- | -------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Retrieved contact preferences by contact ID.** | |   | value | object | Contains the contact ID and other properties to add. | |   | value.contactID | long | Unique ID for the contact. | |   | value.hasOptedOutTracking | boolean | Indicates whether a contact opted out of tracking information. | |   | rowsAffected | integer | Number of rows returned. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | integer | Date and time of the retry response in UTC. | |   | resultMessages | array | Array of messages about the request. Includes details, such as resulttype and resultcode, about a bad request. | |   | serviceMessageID | guid | Service message ID for the response. | ## Usage These permissions are required. - Assets, Upload - Assets, Publish ### Required Scope - Documents and Images, Read and Write - Saved Content, Read and Write ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/contacts/id:1234/Preferences Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK { "value":{ "contactID":1234, "hasOptedOutTracking":false }, "rowsAffected":1, "requestServiceMessageID":"315871d9-7ac3-4452-85ea-1b82e7912ec9", "responseDateTime":"2019-01-22T16:16:14.6290807-06:00", "resultMessages":[ ], "serviceMessageID":"31be4073-0d58-467e-8c2e-9e5d0851c5fd" } ``` # GET /contacts/v1/contacts/key:{contactKey}/Preferences ## Overview Retrieves consent management information from contact records by contact key. GET requests might display values that are reserved for future use and don't perform any actions at this time. Use only the parameters documented here. For best performance, use batches of contact ID values whenever possible. ### URL Parameters | Name | Type | | Description | | -------------- | ------ | ------------ | -------------------------------- | | **contactKey** | string | **Required** | Primary address for the contact. | ### Responses | Status | Name | Type | Description | | ------- | ------------------------- | ------- | -------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Retrieved contact preferences by contact key.** | |   | value | object | Contains the contact ID and other properties to add. | |   | value.contactID | long | Unique ID for the contact. | |   | value.hasOptedOutTracking | boolean | Indicates whether a contact opted out of tracking information. | |   | rowsAffected | integer | Number of rows returned. | |   | requestServiceMessageID | guid | Service message ID for the request. | |   | responseDateTime | integer | Date and time of the retry response in UTC. | |   | resultMessages | array | Array of messages about the request. Includes details, such as resulttype and resultcode, about a bad request. | |   | serviceMessageID | guid | Service message ID for the response. | ## Usage These permissions are required. - Assets, Upload - Assets, Publish ### Required Scope - Documents and Images, Read and Write - Saved Content, Read and Write ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com get /contacts/v1/contacts/key:1ab2/Preferences Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK { "value":{ "contactID":123456, "hasOptedOutTracking":false }, "rowsAffected":1, "requestServiceMessageID":"105d74f2-9eab-450f-b799-6a845ebe4a4b", "responseDateTime":"2019-01-24T10:44:12.2334945-06:00", "resultMessages":[ ], "serviceMessageID":"0bfd9831-58cd-4db1-99bc-2f499e43a026" } ``` # GET /contacts/v1/customObject/{id}/isUsedInContacts ## Overview Retrieves information about whether the contact model for an account uses the custom object. ### URL Parameters | Name | Type | | Description | | ------ | ---- | ------------ | ------------------------------------- | | **id** | guid | **Required** | ID of the custom object as GUID value | ### Responses | Status | Name | Type | Description | | ------- | ----------------------- | ------- | -------------------------------------------------------- | | **200** |   |   | **A validation response** | |   | isUsedByContacts | boolean | Indicates whether a contact model uses the custom object | |   | requestServiceMessageID | guid | Service message ID for the request | |   | resultMessages | array | Array of returned messages regarding custom objects | |   | serviceMessageID | guid | Service message ID for the response | ## Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/customObject/unique-UUID-from-SFMC/isUsedInContacts Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "isUsedByContacts": true "requestServiceMessageID": "unique-GUID-from-SFMC" "resultMessages": [0] "serviceMessageID": "unique-GUID-from-SFMC" } ``` # GET /contacts/v1/customobjectfield/{id}/relationships ## Overview Retrieves relationship details for a customobjectfield that is registered in the contacts model. ## URL Parameters | Name | Type | | Description | | ---- | ---- | -------- | ------------------------------------- | | id | guid | Required | ID of the custom object as GUID value | ## Responses | Status | Name | Type | Description | | ------- | ------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- | | **200** |   |   | **Contact model relationship detail for a custom object field** | |   | customobjectFieldId | guid | Requested CustomObjectFieldID | |   | requestServiceMessageID | guid | Service message ID value of the request | |   | resultMessages | array | Array of returned messages generated while processing the request | |   | serviceMessageID | guid | Service message ID value of the response | |   | customObjectFieldRelationships | array | Array of relationship detail for the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo | object | Contact attribute and parent attribute set info of the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo.parentAttributeSet | object | AttributeSet info of the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo.parentAttributeSet.definitionID | guid | Definition ID value of the attribute set that the requested CustomObjectField belongs to | |   | customObjectFieldRelationships.attributeInfo.parentAttributeSet.definitionName | guid | Definition Name value of the attribute set that the requested CustomObjectField belongs to | |   | customObjectFieldRelationships.attributeInfo.parentAttributeSet.definitionKey | guid | Customer key value of the attribute set that the requested CustomObjectField belongs to | |   | customObjectFieldRelationships.attributeInfo.AttributeDefinitionEntity | object | Attribute Info of the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo.AttributeDefinitionEntity.definitionID | guid | Definition ID value of the attribute of the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo.AttributeDefinitionEntity.definitionName | guid | Definition Name value of the attribute of the requested CustomObjectField | |   | customObjectFieldRelationships.attributeInfo.AttributeDefinitionEntity.definitionKey | guid | Customer key value defined of the attribute of the requested CustomObjectField | |   | customObjectFieldRelationships.attributegroups | array | Array of AttributeGroups the requested CustomObjectField is associated with | |   | customObjectFieldRelationships.attributegroups.definitionID | guid | Definition ID value of the attribute group that the requested CustomObjectField belongs to | |   | customObjectFieldRelationships.attributegroups.definitionName | guid | Definition Name value of the attribute group that the requested CustomObjectField belongs to | |   | customObjectFieldRelationships.attributegroups.definitionKey | guid | Customer Key value defined for the attribute group that the requested CustomObjectField belongs to | |   |   |   |   | | **400** |   |   | **CustomObjectFieldID is a required field** | |   | message | string | The request must contain a valid CustomObjectFieldID | # GET /contacts/v1/schema ## Overview Retrieves the collection of all contact data schemas contained in the current account. ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/schema Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js 200 (OK) Content-Type: application/json { "links": { "self": { "href": "/v1/schema" } }, "page": 0, "pageSize": 0, "count": 0, "items": [ { "id": "71c1f974-9812-e411-9ef0-08edb9ddebf0", "enterpriseID": 10650001, "availableBusinessUnits": [ 10650001 ], "version": 16, "schemaType": "Contacts", "links": { "self": { "href": "/v1/schemas/71c1f974-9812-e411-9ef0-08edb9ddebf0" }, "attributeGroups": { "href": "/v1/schemas/71c1f974-9812-e411-9ef0-08edb9ddebf0/attributeGroups" }, "attributeSetDefinitions": { "href": "/v1/schemas/71c1f974-9812-e411-9ef0-08edb9ddebf0/attributeSetDefinitions" } } } ], "requestServiceMessageID": "ec7c40b0-22f7-11e4-bf2e-ffbc219b0f06", "resultMessages": [], "serviceMessageID": "1fa77ba6-0fb1-4ae1-914a-ef0166318f03" } ``` # GET /contacts/v1/schemas/{schemaId}/attributeGroups ## Overview Retrieves all attribute groups associated with a specified contact data schema. ### URL Parameters | Name | Type | | Description | | ------------ | ------ | ------------ | -------------------- | | **schemaId** | string | **Required** | The ID of the schema | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/schemas/36E001F0-6B8F-E311-A274-08EDB9DDEBF0/attributeGroups Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js 200 (OK) { "count": 2, "page": 1, "pageSize": 25, "links": { "self": {"href": "/schemas/{schemaId}/attributeGroups" }, "schema": {"href": "/schemas/{schemaId}" }, }, "items": [{ "links": { "self": {"href": "/attributeGroups/{id}" } }, "id": "4de15aca-2c17-e311-bb14-00237d5401ce", "key": "com.exacttarget.mobilepush.ETMobilePush", "name": "ExactTarget MobilePush", "parentId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0" }, { "links": { "self": {"href": "/attributeGroups/{id}" } }, "id": "4de15aca-2c17-e311-bb14-00237d5401ce", "key": "com.exacttarget.mobilepush.ETMobilePush", "name": "ExactTarget MobilePush", "parentId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0" }] } ``` # GET /contacts/v1/schemas/{schemaId}/attributeGroups/{id} ## Overview Retrieves a specified attribute group (by ID, key, or name) associated with a specified contact data schema. ### URL Parameters | Name | Type | | Description | | ------------ | ------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | | **schemaId** | string | **Required** | The ID of the schema | | **id** | string | **Required** | The ID of the attribute group expressed in the form of a GUID (UUID). Required if not using key or name. | | **key** | string | **Required** | Key of the attribute group. Prefix the parameter with **key:**. For example, **/attributeGroups/key:{key}**. Required if not using ID or name. | | **name** | string | **Required** | Name of the attribute group. Prefix the parameter with **name:**. For example, **/attributeGroups/name:{name}**. Required if not using ID or key. | ### Usage **Example Request by ID** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/schemas/36E001F0-6B8F-E311-A274-08EDB9DDEBF0/attributeGroups/36E001F0-6B8F-E311-A274-08EDB9DDEBF0 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js 200 (OK) { "attributeGroup": { "links": { "self": {"href": "/schemas/{parentReferenceId}/attributeGroups/{id}" }, "schema": {"href": "/schemas/{parentReferenceId}" }, "attributeSetDefinitions": {"href": "/schemas/{parentReferenceId}/attributeGroups/{id}/attributeSetDefinitions" }, "id": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0", "key": "com.exacttarget.mobilepush.ETMobilePush", "name": "ExactTarget MobilePush", "schemaId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0", "isSystemDefined": true, "applicationID": "131975ED-E859-4CC9-B479-62A615BC6C8A", "applicationKey": "com.exacttarget.mobilepush", "templateID": 100, "fullyQualifiedName": "com.exacttarget.mobilepush.ETMobilePush", "attributeGroupType": "standard", }, } } ``` **Example Request by Key** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/schemas/36E001F0-6B8F-E311-A274-08EDB9DDEBF0/attributeGroups/key:com.exacttarget.mobilepush.ETMobilePush Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js 200 (OK) { "attributeGroup": { "links": { "self": {"href": "/schemas/{schemaId}/attributeGroups/{id}" }, "schema": {"href": "/schemas/{schemaId}" }, "attributeSetDefinitions": {"href": "/schemas/{schemaId}/attributeGroups/{id}/attributeSetDefinitions" } }, "id": "4de15aca-2c17-e311-bb14-00237d5401ce", "key": "com.exacttarget.mobilepush.ETMobilePush", "name": "ExactTarget MobilePush", "schemaId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0", "isSystemDefined": true, "applicationID": "131975ED-E859-4CC9-B479-62A615BC6C8A", "applicationKey": "com.exacttarget.mobilepush", "templateID": 100, "fullyQualifiedName": "com.exacttarget.mobilepush.ETMobilePush", "attributeGroupType": "standard" } } ``` **Example Request by Name** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /contacts/v1/schemas/36E001F0-6B8F-E311-A274-08EDB9DDEBF0/attributeGroups/name:ExactTarget%20MobilePush Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js 200 (OK) { "attributeGroup": { "links": { "self": {"href": "/schemas/{schemaId}/attributeGroups/{id}" }, "schema": {"href": "/schemas/{schemaId}" }, "attributeSetDefinitions": {"href": "/schemas/{schemaId}/attributeGroups/{id}/attributeSetDefinitions" } }, "id": "4de15aca-2c17-e311-bb14-00237d5401ce", "key": "com.exacttarget.mobilepush.ETMobilePush", "name": "ExactTarget MobilePush", "schemaId": "36E001F0-6B8F-E311-A274-08EDB9DDEBF0", "isSystemDefined": true, "applicationID": "131975ED-E859-4CC9-B479-62A615BC6C8A", "applicationKey": "com.exacttarget.mobilepush", "templateID": 100, "fullyQualifiedName": "com.exacttarget.mobilepush.ETMobilePush", "attributeGroupType": "standard" } } ``` # GET /hub/v1/approvals-v2 Retrieves all approval items that belong to the current user. To filter the results, use the request parameters and supported operators. For example, GET ../approvals?f[objecttype][undefined]=CMSAsset1,JobUrl1&f[objectid][undefined]=1 retrieves all approval items where Objecttype equals to CMSAsset or JobUrl AND where objectId equals 1. The response includes details of the approval and workflow items, with the current state and the transitions available for the current user’s roles. Use the GET /approvals-v2/{id} resource with available `objectType` and `objectId` values to retrieve a single approval item. ## URL Parameters | Name | Type | Description | | ------------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `f[workflowState]` | String | The state of the workflow. Possible values: `draft`, `submitted`, `reviewed`, `returned`, `approved`, `defining`. This filter supports `eq` and `not` operators. | | `f[workflowType]` | String | Type of workflow. This filter supports `eq` and `not` operators. | | `f[objectType]` | String | Object type. This filter supports `eq` and `not` operators. | | `f[cmsAssetType]` | String | Asset type. This filter supports `eq` and `not` operators. | | `f[objectId]` | String | The ID of the object. This filter supports `gt`, `gte`, `lt`, `lte`, `eq`, and `not` operators. | | `f[deadline]` | String | Deadline for approval. This filter supports `gt`, `gte`, `lt`, `lte`, `eq`, and `not` operators. For example, GET ../approvals?f[deadline][undefined]='2015-12-08T12:00Z' retrieves all approval items where the deadline is greater than or equal to 2015-12-08, with a time offset of 12:00Z. | | `$pageSize` | Int | The number of records to return in each page of results. | | `$page` | Int | The current page number. | | `sort` | String | The sorting method to apply to results. Specify a field name and a sort order (`ASC` or `DESC`). Possible field names: `Name`, `CreatedDate`, `WorkflowState`, `Deadline`. | ## Responses | Status | Name | Type | Description | | ---------------------------- | ----------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------- | | **200** |   |   | **Response includes a list of approval items.** | |   | count | String | Number of records retrieved | |   | page | String | Current page number | |   | pageSize | String | Number of records on each page | |   | commentCounts | Object | Comment counts | |   | commentCounts.open | String | Number of comments that are open | |   | commentCounts.addressed | String | Number of comments that are addressed | |   | commentCounts.completed | String | Number of comments that are completed | |   | commentCounts.total | String | Total number of comments | |   | items | Array | List of approval items | |   | items.approvalItemId | String | Id for approval item | |   | items.objectType | String | Object type for approval item | |   | items.objectId | String | Unique Id of the object associated with the approval item | |   | items.name | String | Name of the approval item | |   | items.description | String | Description of the approval item | |   | items.workflowItemId | String | Id of the workflow item | |   | items.workflowState | String | Workflow state of the approval item | |   | items.workflowType | String | Type of the workflow | |   | items.workflowName | String | Name of the workflow | |   | items.deadline | Array | Deadline for the approval item | |   | items.commentCounts | Object | Comment counts | |   | items.commentCounts.open | String | Number of comments that are open | |   | items.commentCounts.addressed | String | Number of comments that are addressed | |   | items.commentCounts.completed | String | Number of comments that are completed | |   | items.commentCounts.total | String | Total number of comments | |   | items.workflowItem | Object | Workflow item object | |   | items.workflowItem.workflowItemId | String | Workflow item id | |   | items.workflowItem.workflowRound | String | Workflow round | |   | items.workflowItem.type | String | Workflow type | |   | items.workflowItem.currentState | Object | Current state of the workflow | |   | items.workflowItem.currentState.stateId | String | Id of the current state | |   | items.workflowItem.currentState.stateName | String | Current state name | |   | items.workflowItem.currentState.isEndState | String | Is the current state the final state? | |   | items.workflowItem.currentState.modifiedDate | String | Date the workflow item is modified | |   | items.workflowItem.availableTransitions | Array | Collection of available workflow states | |   | items.workflowItem.availableTransitions.id | String | Id of the available workflow state | |   | items.workflowItem.availableTransitions.name | String | Name of the available workflow state | |   | items.workflowItem.availableTransitions.isPersistable | String | Defines if the workflow item is persistable | |   | items.blocked | String | Defines if emails will be sent out. If blocked = true, then emails won't be sent. | |   |   |   |   | | **400_OrderByInvalid** |   |   | **The GET request parameter - \$OrderBy is invalid and thus the request can't be processed.** | |   | message | String | The GET request parameter - \$OrderBy is invalid and thus the request can't be processed. | |   | errorcode | String | Error code for the exception (10000) | |   |   |   |   | | **400_OperatorNotSupported** |   |   | **The operator 'neq' isn't supported.** | |   | message | String | The operator 'neq' isn't supported. | |   | errorcode | String | Error code for the exception (10000) | |   |   |   |   | | **400_FilterInvalid** |   |   | **The GET request filter parameter is invalid and thus the request can't be processed.** | |   | message | String | The GET request filter parameter is invalid and thus the request can't be processed | |   | errorcode | String | Error code for the exception (10000) | # GET /hub/v1/approvals-v2/{id} Retrieves an approval item that belongs to the current user. The response includes details of the approval and workflow item, with the current state and the transitions available for the current user's roles. To retrieve all active approval items, perform a GET request on the /approvals resource. ## URL Parameters | Name | Type | Description | | ---- | ------ | ---------------------------------------- | | `id` | string | Required. The unique ID of the approval. | ## Responses | Status | Name | Type | Description | | ------- | ----------------------------------------------- | ------ | --------------------------------------------------------------------------------- | | **200** |   |   | **Response includes details about the approval item.** | |   | approvalItemId | string | The ID of the approval item | |   | objectType | string | The object type for the approval item | |   | objectId | string | The unique ID of the object associated with the approval item | |   | name | string | Name of approval item | |   | description | string | Description of the approval item | |   | workflowItemId | string | The ID of the workflow item | |   | workflowState | string | Workflow state of the approval item | |   | workflowType | string | Type of workflow | |   | workflowName | string | Name of the workflow | |   | deadline | array | Deadline for the approval item | |   | commentCounts | object | The number of comments in the approval item | |   | commentCounts.open | string | Number of comments that are open | |   | commentCounts.addressed | string | Number of comments that are addressed | |   | commentCounts.completed | string | Number of comments that are completed | |   | commentCounts.total | string | Total number of comments | |   | workflowItem | object | Workflow item object | |   | workflowItem.workflowItemId | string | Workflow item ID | |   | workflowItem.workflowRound | string | Workflow round | |   | workflowItem.type | string | Workflow type | |   | workflowItem.currentState | object | Current state of the workflow | |   | workflowItem.currentState.stateId | string | ID of the current state | |   | workflowItem.currentState.stateName | string | Current state name | |   | workflowItem.currentState.isEndState | string | Specifies whether the workflow item is in the final state | |   | workflowItem.currentState.modifiedDate | string | The date the workflow item is modified | |   | workflowItem.availableTransitions | array | Collection of available workflow states | |   | workflowItem.availableTransitions.id | string | ID of the available workflow state | |   | workflowItem.availableTransitions.name | string | Name of the available workflow state | |   | workflowItem.availableTransitions.isPersistable | string | Defines if the workflow item is persistable | |   | blocked | string | Defines if emails will be sent out. If blocked = true, then emails won't be sent. | |   |   |   |   | | **400** |   |   | **id is a required field** | |   | message | string | id is a required field. | |   | errorcode | string | Error code for the exception (10002) | |   |   |   |   | | **404** |   |   | **No active approval with the given id exists.** | |   | message | string | No active approval with the given ID exists. | |   | errorcode | string | Error code for the exception (30003) | # GET /hub/v1/approvals-v2/{id}/roles ## Overview Retrieves a list of roles for a given approval item as well as the users assigned to those roles. ## URL Parameters | Name | Type | | Description | | ---- | ------ | -------- | ---------------- | | id | string | Required | Approval item ID | ## Responses | Status | Name | Type | Description | | ------- | -------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Response includes details about the roles, and users assigned to those roles, for an approval item.** | |   | workflowRoleInstanceId | string | ID of workflowRoleInstance record | |   | workflowRoleDefinitionId | string | ID of WorkflowRoleDefinition record | |   | RoleId | string | Unique ID of the role | |   | key | string | Unique key for the role | |   | users | array | List of users for a specific role | |   | users.workflowRoleInstanceUserId | string | ID of the workflowRoleInstanceUser record | |   | users.workflowItemId | string | ID of the workflow item | |   | users.workflowRoleInstanceId | string | ID of the workflowRoleInstance record | |   | users.userId | string | ID of the user | |   | users.userName | string | Name of the user | |   | users.memberId | string | Member ID (MID) | |   | users.enterpriseId | string | Enterprise ID (EID) | |   | users.isActive | string | Indicates if user is active | # GET /hub/v1/approvals-v2/settings ## Overview Retrieves the approvals settings based on the current user context. ## Responses | Result | Reason | Name | Type | Description | | ------ | ---------------------------------------------------------- | ----------------------------------------------------- | ---- | ----------- | | 200 | Response includes approvals settings for the current user. | | key | string | Key for the EnableEmailApprovals setting | | value | string | True/false value for the EnableEmailApprovals setting | # GET /hub/v1/nestedtags ## Overview Returns an array of tags owned by the requesting client. ### URL Parameters | Name | Type | | Description | | --------- | ------ | --- | ----------------------------------------------------------------- | | **depth** | number | | The number of nesting levels to retrieve. The default depth is 0. | ### Responses | Status | Name | Type | Description | | ------- | ----------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Response includes an array of tags owned by the client, including each tag’s properties and nested tags at the level specified by the depth parameter.** | |   | id | integer | TagId of the tag. | |   | name | string | Name of the tag. | |   | description | string | Description of the tag. | |   | parentId | string | TagId of the parent tag. This field is null or zero if no parent tag exists. | |   | tags | object | A list of the tag’s nested tags. Add and modify nested tags using the Update Nested Tags or Patch Nested Tags requests. | ## Usage ### Example Request This example gets a collection of all root tags but none of their nested tags. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /hub/v1/nestedtags Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK [ { "id": 14, "name": "Membership Level", "description": "", "modifiedDate": "2019-06-14T11:07:00", "parentId": 0, "tags": [] }, { "id": 19, "name": "Colors", "description": "", "modifiedDate": "2019-06-14T13:10:00", "parentId": 0, "tags": [] } ] ``` ### Example Request This example gets a collection of all tags and includes their nested tags one level deep. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /hub/v1/nestedtags?depth=1 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK [ { "id": 14, "name": "Membership Level", "description": "", "modifiedDate": "2019-06-14T11:07:00", "parentId": 0, "tags": [ { "id": 15, "name": "Bronze", "description": "Bronze Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 16, "name": "Gold", "description": "Gold Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 17, "name": "Silver", "description": "Silver Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 18, "name": "Platinum", "description": "Platinum Membership Level", "modifiedDate": "2019-06-14T11:58:00", "parentId": 14, "tags": [] } ] }, { "id": 19, "name": "Colors", "description": "", "modifiedDate": "2019-06-14T13:10:00", "parentId": 0, "tags": [ { "id": 20, "name": "Bronze", "description": "", "modifiedDate": "2019-06-14T13:10:00", "parentId": 19, "tags": [] }, { "id": 21, "name": "Gold", "description": "", "modifiedDate": "2019-06-14T13:10:00", "parentId": 19, "tags": [] }, { "id": 22, "name": "Silver", "description": "", "modifiedDate": "2019-06-14T13:10:00", "parentId": 19, "tags": [] } ] } ] ``` # GET /hub/v1/nestedtags/{tagId} ## Overview Returns the tag associated with the specified tagId. ### URL Parameters | Name | Type | | Description | | --------- | ------ | --- | ----------------------------------------------------------------- | | **depth** | number | | The number of nesting levels to retrieve. The default depth is 0. | ### Responses | Status | Name | Type | Description | | ------- | ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Response includes the specified tag and all of its properties, including nested tags at the level specified by the depth parameter.** | |   | id | integer | TagId of the tag. | |   | name | string | Name of the tag. | |   | description | string | Description of the tag. | |   | parentId | string | TagId of the parent tag. This field is null or zero if no parent tag exists. | |   | tags | object | A list of the tag’s nested tags. Add and modify nested tags using the Update Nested Tags or Patch Nested Tags requests. | ## Usage ### Example Request This example gets a tag by ID. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /hub/v1/nestedtags/14 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK { "id": 14, "name": "Membership Level", "description": "", "modifiedDate": "2019-06-14T11:07:00", "parentId": 0, "tags": [] } ``` ### Example Request This example gets a tag by ID and includes its nested tags one level deep. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /hub/v1/nestedtags/14?depth=1 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK { "id": 14, "name": "Membership Level", "description": "", "modifiedDate": "2019-06-14T11:07:00", "parentId": 0, "tags": [ { "id": 15, "name": "Bronze", "description": "Bronze Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 16, "name": "Gold", "description": "Gold Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 17, "name": "Silver", "description": "Silver Membership Level", "modifiedDate": "2019-06-14T11:07:00", "parentId": 14, "tags": [] }, { "id": 18, "name": "Platinum", "description": "Platinum Membership Level", "modifiedDate": "2019-06-14T11:58:00", "parentId": 14, "tags": [] } ] } ``` # GET /hub/v1/workflowteams/{objecttype} ## Overview Retrieves a list of active workflow teams. Depending on the query string parameters, the result includes one or both filtered results: role user information for each workflow item or workflow items to which the current user is assigned. ## URL Parameters | Name | Type | | Description | | ---------- | ------ | -------- | -------------------------------------------------------------------------------------------------- | | objecttype | string | Required | Specify the workflow object type to retrieve or use (@all to retrieve all workflow object types. | | assignee | string | | If assignee=@current, this resource retrieves workflow teams that the current user is assigned to. | | extra | string | | If extra=roleusers, then each item in the response includes role user information as a collection. | ## Responses | Status | Name | Type | Description | | ------- | ---------------------------------- | ------ | ---------------------------------------------------------------------- | | **200** |   |   | **Response contains a list of workflow teams.** | |   | count | string | Number of records retrieved | |   | page | string | Current page number | |   | pageSize | string | Number of records on each page | |   | objectType | string | Workflow type | |   | Items | array | List of workflow items | |   | Items.id | string | Workflow Id | |   | Items.objectType | string | Workflow object type | |   | Items.name | string | Workflow name | |   | Items.description | string | Description of the workflow | |   | Items.roleUsers | array | List of role users | |   | Items.roleUsers.id | string | Unique Id for the association between role and users | |   | Items.roleUsers.TeamId | string | Team Id the role user is associated with | |   | Items.roleUsers.roleDefinitionId | string | Role definition Id | |   | Items.roleUsers.roleDefinitionName | string | Role definition name | |   | Items.roleUsers.employeeId | string | Id of the user assigned to the role | |   | Items.roleUsers.employeeName | string | Name of the user assigned to the role | |   | Items.roleUsers.roleId | string | Id of the role | |   |   |   |   | | **404** |   |   | **404 Not Found** | |   | message | string | No workflow teams found for workflow object type: [workflowObjectType] | |   | errorcode | string | Error code for the exception (30003) | # GET /interaction/v1/async/events/status Retrieve the status of contacts that were inserted into a journey using the [POST method](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_interaction/enterContactsIntoJourneyInBatches.md). Use this operation for troubleshooting batch insertion requests. To export large amounts of data, use the [Download History API](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/downloadJourneyHistory.html) instead. ## Query Parameters | Name | Type | Description | | ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | type | string | The type of events to retrieve. Accepted values: `errored`, `queued`, or `processed`. | | contactKey | string | A contact key to retrieve event data for. | | requestId | string | A request ID to retrieve event data for. | | eventInstanceId | string | An event instance ID to retrieve event data for. This field name is reserved for system use. If you have a field in your payload with the same name, the data value for it is ignored, and a random GUID is logged to the data extension. | | eventDefinitionKey | string | An event definition key to retrieve event data for. | | $page | string | The page of results to retrieve. Each page includes the number of records specified by the `$pageSize` parameter. You can retrieve additional pages by incrementing this number in subsequent calls. | | $pageSize | string | The number of records to return on each page of results. The default value is 50. | | startDate | string | The starting date and time for your query. By default, the API retrieves the last 30 days of data. | | endDate | string | The end date and time for your query. | | $orderBy | string | The field and sort method to use to sort the results. You can sort based on the `modifiedDate` in ascending (ASC) or descending (DESC) order. Order by timestamp. If you specify this parameter, you must also specify `requestId`, `contactKey`, or `eventInstanceId`. The default value is `modifiedDate`. | **important:** Your request must specify one or more of these parameters: - type - contactKey - requestId - eventInstanceId - eventDefinitionKey If your request doesn’t include any of these parameters, the API returns an error. ## Response | Name | Type | Description | | -------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | page | string | The current page of results. | | pageSize | string | The number of records in the current page of results. | | count | int | The total number of events in the response. If the value of `count` is greater than `pageSize`, you can issue additional GET requests to retrieve additional information. Increment the `$page` value in each subsequent request. | | items | array | An array that contains the events that were retrieved. | | items.eventCategoryType | string | The status of the event. Possible values: `Queued`, `Processed`, or `Errored` | | items.timestamp | string | Time the event occurred in Central Standard Time. | | items.eventDefinitionKey | string | The eventDefinitionKey associated with this event. | | items.requestId | string | The request ID from the original POST response. | | items.info | object | An object that contains information about the contact or instance. | | items.info.contactKey | string | Unique identifier for a subscriber. | | items.info.eventInstanceId | string | Unique identifier for the instance of processing in the batch, used to track end-to-end progress. | | items.info.errorcode | string | An error code. The response only includes this property if there was an error in processing an event instance. | | items.info.message | string | An error message associated with the error code. The response only includes this property if there was an error in processing an event instance. | ## Error Codes | Error Code | Scenario | Message | | ---------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 10001 | Get Request Contains Invalid Parameter | Request contains invalid parameter. Remove the parameter: {variable} | | 10001 | Get Request Contains Extra or Duplicate Parameter | Request contains duplicate parameter. Remove the duplicate parameter: {variable} | | 10001 | Get Request Contains Invalid Sort Parameter | Request contains invalid sort or order parameter value. Remove the parameter value: {variable} | | 10002 | Get Request Sorting Required Param Missing | Enter a required filter parameter and try again. When sorting or ordering, at least one of these parameters is required: contactKey, eventInstanceId, or requestId. | | 10005 | Get Request Page Size Exceeded Limit | Enter a valid pageSize and try again. Request pageSize must be between 1 and 10000 | | 10005 | Get Request Exceeded Search Limit | Request exceeds search limit. Reduce page or pageSize to not exceed a search depth of more than 10000 total records. | ## Response Example A successful request includes the information shown in this example. ```json { "page": 1, "pageSize": 50, "count": 2, "items": [ { "eventCategoryType": "Processed", "timestamp": "2023-08-05T13:41:18.55-06:00", "eventDefinitionKey": "BatchJourneyExample", "requestId": "c77598e6-cae3-4244-913b-6231e6e8a17b", "info": { "contactKey": "5b78e18e-9249-4392-a18f-da46b7198015", "eventInstanceId": "56277a0a-2781-4730-bdfa-7e2f91e33b9d" } }, { "eventCategoryType": "Queued", "timestamp": "2023-08-05T13:42:19.82-06:00", "eventDefinitionKey": "BatchJourneyExample", "requestId": "c77598e6-cae3-4244-913b-6231e6e8a17b", "info": { "contactKey": "acc4935f-327a-4d51-bd39-f42071009c54", "eventInstanceId": "0b06685d-ada0-474b-86f9-2630a75537eb" } } ] } ``` # GET /interaction/v1/eventDefinitions Retrieve a collection of event definitions. ## URL Parameters | Name | Type | Description | | ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `$page` | Number | The page number of results to retrieve. The default value is 1. | | `$pageSize` | Number | The number of results to return on a page. The default and maximum is 50. This value is only honored if the query string also specifies the `$page` parameter. | | `name` | String | Filter results by the name of the event definition. The API searches the entire name of the event definition for the value that you specify here. | ## Usage To retrieve event definitions, issue a GET request to the `/interaction/v1/eventDefinitions` endpoint. You can optionally filter and paginate the results by using query string parameters. ``` GET /interaction/v1/eventDefinitions?$pageSize=2&$page=2&name=welcome HTTP/1.1 Host: YOUR_DOMAIN.rest.marketingcloudapis.com Authorization: Bearer YOUR_BEARER_TOKEN Content-Type: application/json ``` The response includes an `items` array. Each object in this array contains information about event definitions that match the criteria in the query string. ```json { "count": 4, "page": 2, "pageSize": 1, "links": {}, "items": [ { "id": "858f98c7-7d0c-4c42-95ee-a142852e96c9", "type": "DateEvent", "name": "Welcome Series", "description": "Welcome Series", "createdDate": "2025-06-12T12:33:41.82", "createdBy": 998877665, "modifiedDate": "2025-06-12T12:55:34.033", "modifiedBy": 998877665, "mode": "Production", "eventDefinitionKey": "DateEvent", "dataExtensionId": "a94b1dd1-b5c3-e211-abdb-1cc1de75f674", "dataExtensionName": "_PushAddress", "sourceApplicationExtensionId": "1169744d-c5c2-4ebd-869a-7f897db61112", "filterDefinitionId": "00000000-0000-0000-0000-000000000000", "filterDefinitionTemplate": "", "iconUrl": "/events/images/icon_journeyBuilder-event-DateBased-blue.svg", "arguments": { "serializedObjectType": 1, "contactAttributeGroup": "PushDemographics", "contactAttributeName": "CreatedDate", "dataExtensionId": "a94b1dd1-b5c3-e211-abdb-1cc1de75f674", "eid": 987654, "mid": 987654, "eventDefinitionId": "858f98c7-7d0c-4c42-95ee-a142852e96c9", "eventDefinitionKey": "DateEvent", "criteria": "", "useHighWatermark": false, "contactAttributeId": "18f35cd5-f1c1-e311-a1e0-e83935a85380", "dateType": "yearly", "dateOffset": 0, "dateOffsetUnit": "days", "automationId": "845441e4-ac9f-4400-9ba6-c1a6ede6ff59" }, "metaData": { "criteriaDescription": "", "attributeName": "Created Date", "customAttributeName": "Created Date", "formattedDate": "on Created Date", "formattedTime": "12:00 AM", "timeZone": "(GMT-06:00) Central Time (US & Canada)", "automationData": { "id": "NUVGVWhKLXNBRVNicHNHbTdlYl9XUToyNTow", "key": "07b9ab2e-1f24-4ddd-aee3-93705737304b", "createdDate": "2025-06-12T18:33:43Z", "updateInProgress": false, "name": "JB Event Welcome Series", "description": "Event Definition Automation", "createdBy": { "id": "MTA5NzcxNjU6NDow", "name": "D'Angelo Cunningham", "email": "dcunningham@example.com" }, "modifiedDate": "2025-06-12T18:33:52Z", "status": "Scheduled", "memberId": 987654, "processes": [ { "id": "UDJjRURNY3BZRUMySXhWekpUb1JXUToyNzow", "name": "", "description": "", "sequence": 0, "workers": [ { "id": "Vkd5MWdEaDRSa0tFTUhuc0pDakpaUToyOTow", "key": "faf2d852-4ad6-467d-a002-8837092794d5", "sequence": 0, "name": "InteractionStudio", "description": "", "activityObjectId": "858f98c7-7d0c-4c42-95ee-a142852e96c9", "objectTypeId": 733, "serializedObject": "{\"SerializedObjectType\":1,\"criteria\":null,\"useHighWatermark\":false,\"contactAttributeId\":\"18f35cd5-f1c1-e311-a1e0-e83935a85380\",\"dateType\":\"yearly\",\"dateOffset\":0,\"dateOffsetUnit\":\"days\",\"ContactAttributeGroup\":\"PushDemographics\",\"ContactAttributeName\":\"CreatedDate\",\"DataExtensionId\":\"a94b1dd1-b5c3-e211-abdb-1cc1de75f674\",\"Eid\":987654,\"Mid\":987654,\"EventDefinitionId\":\"858f98c7-7d0c-4c42-95ee-a142852e96c9\",\"EventDefinitionKey\":\"DateEvent\"}", "selectedObject": [ { "categoryId": -1 } ], "guidId": "80b56c54-7838-4246-8430-79ec2428c965" } ], "guidId": "0c04673f-29c7-4060-b623-1573253a1159" } ], "scheduledTime": "2025-06-13T05:00:00Z", "schedule": "http://rest.s1.exacttarget.com/rest//beta/automations/schedule/R19KM1hjUWhMVUN2WjcybEhOdkNXQTozNjow", "isPlatformObject": true, "notifications": "http://rest.s1.exacttarget.com/rest//beta/hub/notifications/NUVGVWhKLXNBRVNicHNHbTdlYl9XUToxMjow", "automationType": "scheduled", "categoryId": 1157180, "folderPath": "my automations", "lastSaveDate": "2025-06-12T18:33:43Z", "lastSavedBy": { "id": "MTA5NzcxNjU6NDow", "name": "D'Angelo Cunningham", "email": "dcunningham@example.com" }, "selectedCategoryId": [ { "categoryId": 11335577 } ], "scheduleObject": { "id": "R19KM1hjUWhMVUN2WjcybEhOdkNXQTozNjow", "key": "7d13dd40-2be0-4dfe-a3aa-9ef66e100d78", "createdDate": "2025-06-12T18:34:00Z", "createdBy": "http://rest.s1.exacttarget.com/rest//beta/organization/user/MTA5NzcxNjU6NDow", "lastUpdated": "2025-06-12T18:34:00Z", "lastUpdatedBy": "http://rest.s1.exacttarget.com/rest//beta/organization/user/MTA5NzcxNjU6NDow", "name": "", "description": "Will run every day, effective 6/13/2025 at 12:00 AM through Monday, June 13, 2027", "startDate": "2025-06-13T06:00:00Z", "iCalRecur": "FREQ=DAILY;UNTIL=20270613T050000;INTERVAL=1", "timeZone": "Central Standard Time", "timeZoneId": 79, "scheduleStatus": "active" }, "guidId": "845441e4-ac9f-4400-9ba6-c1a6ede6ff59" } }, "schedule": { "startDateTime": "2025-06-13T00:00:00", "endDateTime": "2027-06-13T05:00:00", "timeZone": "Central Standard Time", "occurrences": 18263, "endType": "EndDate", "frequency": "Daily", "recurrencePattern": "Interval", "interval": 1 }, "interactionCount": 0, "isVisibleInPicker": true, "isPlatformObject": false, "category": "Event", "publishedInteractionCount": 0, "automationId": "5860e177-b030-4674-9084-3de5444ff839", "disableDEDataLogging": false } ] } ``` # GET /interaction/v1/eventDefinitions/{id} ## Overview Retrieves an individual event definition by ID or key. ## URL Parameters | Name | Type | | Description | | ---- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | | id | string | Required | The ID of the event definition expressed in the form of a GUID (UUID). Required if not using a key. | | key | string | Required | The key of the event definition. Required if not using an ID. Prefix the parameter with key:. For example, /eventDefinitions/key:{key}. | # GET /interaction/v1/interactions Retrieve a list of journeys. ## Required Permission Scope To use this endpoint to search for journeys, you must have the `Automation | Journeys | Read` scope. ## URL Parameters This table lists the URL parameters that you can specify to filter or enhance the search results. | Name | Type | Description | | -------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `$orderBy` | String | The field and sort method to use to sort the results. You can sort on these fields:
  • `ModifiedDate`
  • `Name`
  • `Performance`
You can sort these fields in ascending (`ASC`) or descending (`DESC`) order. The default value is `modifiedDate DESC`. | | `$page` | Number | The page number of results to retrieve. The default value is `1`. | | `$pageSize` | Number | The number of items to return on a page of results. The default and maximum value is `50`. | | `definitionType` | String | The type of definition to retrieve. The only accepted value is `transactional`, which retrieves all transactional send definitions. | | `extras` | String | Additional information to include in the response. Possible values are:
  • `activities`: Provides configuration details for each activity in the journey.
  • `outcome`: Provides detailed information about the outcomes of the goals in the journey.
  • `stats`: Provides detailed statistics related to the population of the journey.
  • `all`: Provides all the extra details that are available.
When you specify the `all` value for this parameter, the response includes a large amount of data. The volume of this data has a negative impact on the performance of this query. | | `key` | String | The external key of a journey to retrieve. | | `id` | String | The ID of a journey to retrieve. When you specify an ID, the API returns all versions of that journey. | | `mostRecentVersionOnly` | Boolean | Use this parameter to specify whether to return the most recent version of each journey that matches the filter criteria. The default value is `true`. | | `nameOrDescription` | String | A search string to apply to the request. The API searches the name and description of each journey for this string, and returns all matching journeys. | | `specificApiVersionNumber` | Number | The version number of the `workflowApiVersion` value to retrieve. The default value is `1`. | | `status` | String | A journey status value to use to filter the results. Possible values are:
  • `Deleted`
  • `Draft`
  • `Paused`
  • `Published`
  • `ScheduledToPublish`
  • `Stopped`
  • `Unpublished`
The `ScheduledToSend`, `Sent`, and `Stopped` statuses exist only in single-send journeys.
If you don’t specify a status value, the API returns all journeys regardless of their statuses. | | `tag` | String | A tag to use to filter the results. When you specify this parameter, the API returns only journeys with the specified tag. | | `versionNumber` | Number | The version number of the journey to retrieve. The default value is the currently published version or the latest version number that meets the other search criteria. | ## Example Request This sample request retrieves all journeys. The request uses the `extras` parameter to retrieve the activities for each journey. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions?$page=2&$pageSize=2&extras=activities Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ## Example Response A successful request returns a `200 OK` response that contains data about the journeys that match the search criteria. ```json { "count": 1, "page": 1, "pageSize": 50, "links": {}, "items": [ { "id": "40308698-7581-4b2a-855b-0f8231c6478e", "key": "2c25c791-4e6e-4e7e-844e-ed098fc3a8ba", "name": "5 Day Follow-Up", "lastPublishedDate": "0001-01-01T00:00:00", "description": "", "version": 1, "workflowApiVersion": 1, "createdDate": "2024-08-17T10:21:38.98", "modifiedDate": "2024-08-17T10:22:22.01", "activities": [ { "id": "cc1996c1-473d-4bcd-9ea7-27ad8adcd11f", "key": "WAIT-2", "name": "", "description": "", "type": "WAIT", "arguments": {}, "configurationArguments": { "waitDuration": 1, "waitUnit": "DAYS" }, "metaData": { "waitType": "duration" }, "schema": { "arguments": { "endDate": { "dataType": "Date", "isNullable": false, "direction": "Out", "readOnly": false, "access": "Hidden" }, "waitDefinitionId": { "dataType": "Text", "isNullable": false, "direction": "In", "readOnly": false, "access": "Hidden" }, "waitForEventId": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "executionMode": { "dataType": "Text", "isNullable": false, "direction": "In", "readOnly": false, "access": "Hidden" }, "startActivityKey": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "waitQueueId": { "dataType": "LongNumber", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" } } } }, { "id": "394097d6-c3a3-4820-b9e3-8788b548da80", "key": "EMAILV2-1", "name": "", "description": "", "type": "EMAILV2", "arguments": {}, "configurationArguments": {}, "metaData": {}, "schema": { "arguments": { "emailSubjectDataBound": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": true, "access": "Hidden" }, "contactId": { "dataType": "Number", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "contactKey": { "dataType": "Text", "isNullable": false, "direction": "In", "readOnly": false, "access": "Hidden" }, "emailAddress": { "dataType": "Text", "isNullable": false, "direction": "In", "readOnly": false, "access": "Hidden" }, "sourceCustomObjectId": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "sourceCustomObjectKey": { "dataType": "LongNumber", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "fieldType": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "eventData": { "dataType": "Text", "isNullable": true, "direction": "In", "readOnly": false, "access": "Hidden" }, "customObjectKey": { "dataType": "LongNumber", "isNullable": true, "direction": "In", "readOnly": true, "access": "Hidden" } } } } ], "triggers": [], "goals": [], "tags": [{ "name": "Fun Run" }, { "name": "5K" }], "stats": { "currentPopulation": 0, "cumulativePopulation": 0, "metGoal": 0, "goalPerformance": 0 }, "entryMode": "SingleEntryAcrossAllVersions", "defaults": { "email": [""] }, "executionMode": "Production", "status": "Draft", "definitionId": "e6c045e9-ecf6-4336-8e64-d691974e9908" } ] } ``` # GET /interaction/v1/interactions/{id} ## Overview Retrieves a single journey by ID or key. To call this resource, assign your API Integration the Automation | Interactions | Read scope. ### URL Parameters | Name | Type | | Description | | ----------------- | ------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------- | | **id** | string | **Required** | ID of version 1 of the journey in the form of a GUID (UUID). Required if not using a key. | | **key** | string | **Required** | The key of the journey. Required if not using ID. Prefix the parameter with **key:**. For example, **/interactions/key:{key}**. | | **versionNumber** | number | | Version number of the journey to retrieve. If not provided, the latest version is returned. | | **extras** | string | | A list of additional data to fetch. Available values are: all, activities, outcomes, and stats. Default is ''. | ### Usage **Example Request** This request retrieves a single journey object for version 2 of the journey specified by the ID. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions/{id}?versionNumber=2 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ``` HTTP/1.1 200 { "id": "00a0a000-9988-e111-9ef0-88aaa9dddaa0", "key": "journey_key", "name": "Welcome email series", "description": "This welcome email journey contains an entry event, goal, activities, and tags", "version": 2, "workflowApiVersion": 1, "createdDate": "2014-06-17T10:29:43.673", "modifiedDate": "2014-06-17T11:53:22.477", "triggers": [ { "key": "first-activity", "name": "First activity. The starting point.", "type": "ContactDecision", "eventDefinitionKey": "my-entry-event-key", "arguments": { "criteria": "" } } ], "activities": [ { "id": "11b1b111-9988-e111-9ef0-88aaa9dddbb1", "key": "send-welcome-email", "name": "Welcome email", "type": "Email", "outcomes": [ { "key": "sent-welcome-email-then-random-split", "next": "random-split" } ], "arguments": { "emailToSend": "394911", "emailAddress": "" } }, { "id": "22c2c222-9988-e111-9ef0-88aaa9dddcc2", "key": "random-split", "name": "Random split", "type": "RandomSplit", "outcomes": [ { "key": "random-split-then-send-sms", "next": "send-sms", "arguments": { "percentage": 90 } }, { "key": "random-split-then-10-percent-end", "next": "send-sms2", "arguments": { "percentage": 10 } } ] } ], "tags": [ {"name": "Fun Run"}, {"name": "5K"} ], "status": "Draft", "definitionId": "33d3d333-9988-e111-9ef0-88aaa9eeedd3" } ``` # GET /interaction/v1/interactions/{id}/audit/{action} Retrieves an audit log for one or all versions of a journey by specifying its ID. You can specify different actions to see history related to the creation, modification, activation, deactivation, stopping, and deletion of a journey. ## URL Parameters Specify these parameters in the URL. | Name | Type | Description | | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `action` | String | Required. The actions to include in the audit log. Specify `all` to return all actions. Possible values:
  • `all`
  • `create`
  • `modify`
  • `publish`
  • `unpublish`
  • `delete`
| | `id` | String | Required. The ID of the journey to retrieve audit logs for. The response includes the audit log for all versions of the journey, unless you specify the `versionNumber` query parameter. | ## Query Parameters Use these optional query parameters to further refine the results. | Name | Type | Description | | -------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `$page` | Integer | The page number of results to return. The default value is `1`. | | `$pageSize` | Integer | The number of items to return in a page of results. The default value is `50`. The minimum value is `1` and the maximum is `50`. This value is only honored if the query string also specifies the `$page` parameter. | | `mostRecentVersionOnly` | Boolean | If `true`, the response includes an audit log for the most recent version of the journey. Don't specify this parameter if you specify the `versionNumber` parameter or if `mostRecentVersionOrRunningOnly` is `true`. | | `mostRecentVersionOrRunningOnly` | Boolean | If `true`, the response includes an audit log for the running version of the journey and the next draft version, if one exists. Don't specify this parameter if you specify the `versionNumber` parameter or if `mostRecentVersionOnly` is `true`. | | `status` | String | A journey status value to filter the results by. Possible values are:
  • `Deleted`
  • `Draft`
  • `None`
  • `Paused`
  • `Pausing`
  • `Published`
  • `Resuming`
  • `ScheduledToPublish`
  • `ScheduledToSend`
  • `ScheduledToStop`
  • `Sent`
  • `Stopped`
  • `Unpublished`
| | `versionNumber` | Integer | The version number of the journey to retrieve audit logs for. If you don't specify this parameter, the response includes audit logs for all versions of the journey. | ## Usage To retrieve audit logs, determine which type of action you want to view. This example returns all actions for version 2 of the specified journey. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions/YOUR_JOURNEY_ID/audit/all?versionNumber=2 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response is a log that includes these elements: - The current page number of results. - The number of items returned in each page of results. - The total number of items that meet the request parameters. - An `Items` array. The array includes an object for each action. All objects in the array include these elements: - The ID, key, name, and description of the journey - The original definition ID - The date and time when the action occurred - The name and ID of the user who performed the action This example shows an `Items` array that contains `Create`, `Modify`, `Publish`, and `Stop` actions. ```json { "Page": 1, "PageSize": 50, "Count": 5, "Items": [ { "action": "Create", "key": "some-journey-key", "versionNumber": 2, "id": "838e10a4-5082-4c93-8455-4c7be5d0b0da", "originalDefinitionId": "c1e1e38e-128b-41b6-9710-f5e942ce2660", "name": "Complete journey", "description": "This journey contains a trigger, goal, and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "UserId": 1234 }, "executionMode": "Production", "sourceInteraction": { "id": "####-####-####-####-####", "version": 3, "key": "My journey" } }, { "action": "Modify", "key": "some-journey-key", "versionNumber": 2, "id": "af388fb2-233a-4ab4-ad78-89fd00bc7827", "originalDefinitionId": "ce74fdea-7530-46b2-84d4-f76d464da460", "name": "Complete journey", "description": "This journey contains a trigger, goal, and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "UserId": 1234 }, "executionMode": "Production" }, { "action": "Publish", "key": "some-journey-key", "versionNumber": 2, "id": "1e5bffca-0bcb-4655-84fb-f3e0a7635ec0", "originalDefinitionId": "9fcebdec-262a-4b9b-92d7-f790d9a265c9", "name": "Complete journey", "description": "This journey contains a trigger, goal, and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 2", "userId": 5678 }, "executionMode": "Production", "publishStatus": "Error", "PublishRequestId": "e31c0c6f-f51a-41c7-9ef9-15039bb8e21c", "errors": [ { "ErrorDetail": "An activity must be created and configured before activation can be successful", "ErrorCode": "VALIDATE_GENERAL_EXCEPTION" }, { "ErrorDetail": "An entry event must be configured before activation can be successful", "ErrorCode": "VALIDATE_GENERAL_EXCEPTION" } ] }, { "action": "Publish", "key": "some-journey-key", "versionNumber": 2, "id": "3163a736-1895-4e46-a247-472777c2b8be", "originalDefinitionId": "24ad56e3-c7a7-43a4-9c63-eb3cd10e6975", "name": "Complete journey", "description": "This journey contains a trigger, goal, and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 2", "userId": 5678 }, "executionMode": "Production", "publishStatus": "PublishCompleted", "publishRequestId": "191514ac-37a1-4674-b70c-029d1a5ffa4c" }, { "action": "Stop", "key": "some-journey-key", "versionNumber": 2, "id": "5a5c23a7-58aa-4a5a-9b66-1f4cdd5f43e6", "originalDefinitionId": "65bd6ea2-df07-4232-89ba-330b1ca8e5f9", "name": "Complete journey", "description": "This journey contains a trigger, goal, and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "userId": 1234 }, "ContactsEjected": 20 } ] } ``` ## See Also - [Get Journey Audit Logs by Key](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_interaction/getInteractionAuditLogByKey.md) # GET /interaction/v1/interactions/journeyhistory/freshness Provides an estimate of the amount of time that journey history events trail behind actual journey events. ## Usage To obtain a journey freshness estimate, send a GET request to the `/interaction/v1/interactions/journeyhistory/freshness` endpoint. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions/journeyhistory/freshness Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response includes the amount of time in seconds that journey history events trail behind actual events. For example, this response indicates that results trail actual events by 1200 seconds, or 20 minutes. If a subscriber entered a journey 30 minutes ago and exited it 10 minutes ago, you can only retrieve a partial history of the journey activities the subscriber completed. ``` HTTP/1.1 200 { "secondsBehind" : 1200 } ``` # GET /interaction/v1/interactions/key:{key}/audit/{action} Retrieves an audit log for one or all versions of a journey by specifying its external key. You can specify different actions to see history related to the creation, modification, activation, deactivation, stopping, and deletion of a journey. ## URL Parameters Specify these parameters in the URL. | Name | Type | Description | | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `action` | String | Required. The actions to include in the audit log. Specify `all` to return all actions. Possible values:
  • `all`
  • `create`
  • `modify`
  • `publish`
  • `unpublish`
  • `delete`
| | `key` | String | Required. The external key of the journey to retrieve audit logs for. Specify the key in this format `/interactions/key:{key}/audit/{action}`. | ## Query Parameters Use these optional query parameters to further refine the results. | Name | Type | Description | | -------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `$page` | Integer | The page number of results to return. The default value is `1`. | | `$pageSize` | Integer | The number of items to return in a page of results. The default value is `50`. The minimum value is `1` and the maximum is `50`. This value is only honored if the query string also specifies the `$page` parameter. | | `mostRecentVersionOnly` | Boolean | If `true`, the response includes an audit log for the most recent version of the journey. Don't specify this parameter if you specify the `versionNumber` parameter or if `mostRecentVersionOrRunningOnly` is `true`. | | `mostRecentVersionOrRunningOnly` | Boolean | If `true`, the response includes an audit log for the running version of the journey and the next draft version, if one exists. Don't specify this parameter if you specify the `versionNumber` parameter or if `mostRecentVersionOnly` is `true`. | | `status` | String | A journey status value to filter the results by. Possible values are:
  • `Deleted`
  • `Draft`
  • `None`
  • `Paused`
  • `Pausing`
  • `Published`
  • `Resuming`
  • `ScheduledToPublish`
  • `ScheduledToSend`
  • `ScheduledToStop`
  • `Sent`
  • `Stopped`
  • `Unpublished`
| | `versionNumber` | Integer | The version number of the journey to retrieve audit logs for. If you don't specify this parameter, the response includes audit logs for all versions of the journey. | ## Usage To retrieve audit logs, determine which type of action you want to view. This example returns all actions for version 2 of the specified journey. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions/key:YOUR_JOURNEY_KEY/audit/all?versionNumber=2 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response is a log that includes these elements: - The current page number of results. - The number of items returned in each page of results. - The total number of items that meet the request parameters. - An `Items` array. The array includes an object for each action. All objects in the array include these elements: - The ID, key, name, and description of the journey - The original definition ID - The date and time when the action occurred - The name and ID of the user who performed the action This example shows an `Items` array that contains `Create`, `Modify`, `Publish`, and `Stop` actions. ```json { "Page": 1, "PageSize": 50, "Count": 5, "Items": [ { "action": "Create", "key": "some-journey-key", "versionNumber": 2, "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "originalDefinitionId": "b2c3d4e5-f6g7-8901-bcde-f23456789012", "name": "Complete journey", "description": "This journey contains a trigger, goal and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "UserId": 1234 }, "executionMode": "Production", "sourceInteraction": { "id": "c3d4e5f6-g7h8-9012-cdef-345678901234", "version": 3, "key": "My journey" } }, { "action": "Modify", "key": "some-journey-key", "versionNumber": 2, "id": "d4e5f6g7-h8i9-0123-def0-456789012345", "originalDefinitionId": "e5f6g7h8-i9j0-1234-ef01-567890123456", "name": "Complete journey", "description": "This journey contains a trigger, goal and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "UserId": 1234 }, "executionMode": "Production" }, { "action": "Publish", "key": "some-journey-key", "versionNumber": 2, "id": "f6g7h8i9-j0k1-2345-f012-678901234567", "originalDefinitionId": "g7h8i9j0-k1l2-3456-0123-789012345678", "name": "Complete journey", "description": "This journey contains a trigger, goal and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 2", "userId": 5678 }, "executionMode": "Production", "publishStatus": "Error", "PublishRequestId": "h8i9j0k1-l2m3-4567-1234-890123456789", "errors": [ { "ErrorDetail": "An activity must be created and configured before activation can be successful", "ErrorCode": "VALIDATE_GENERAL_EXCEPTION" }, { "ErrorDetail": "An entry event must be configured before activation can be successful", "ErrorCode": "VALIDATE_GENERAL_EXCEPTION" } ] }, { "action": "Publish", "key": "some-journey-key", "versionNumber": 2, "id": "i9j0k1l2-m3n4-5678-2345-901234567890", "originalDefinitionId": "j0k1l2m3-n4o5-6789-3456-012345678901", "name": "Complete journey", "description": "This journey contains a trigger, goal and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 2", "userId": 5678 }, "executionMode": "Production", "publishStatus": "PublishCompleted", "publishRequestId": "k1l2m3n4-o5p6-7890-4567-123456789012" }, { "action": "Stop", "key": "some-journey-key", "versionNumber": 2, "id": "l2m3n4o5-p6q7-8901-4567-234567890123", "originalDefinitionId": "m3n4o5p6-q7r8-9012-5678-345678901234", "name": "Complete journey", "description": "This journey contains a trigger, goal and activities", "timeStamp": "2025-10-30T11:49:55.99", "user": { "name": "Test User 1", "userId": 1234 }, "ContactsEjected": 20 } ] } ``` ## See Also - [Get Journey Audit Logs by ID](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_interaction/getInteractionAuditLog.md) # GET /interaction/v1/interactions/publishStatus/{statusId} Checks the status of a publication. ## URL Parameters | Name | Type | Description | | ---------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `statusId` | string | Required. The statusId provided by a successful POST request to [schedule](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_interaction/postPublishInteractionById.md) for a specific version of a journey. | ## Usage This request retrieves the publishing status for the specified statusId provided while making a `publishAsync` request. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/interactions/publishStatus/{statusId} Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` Journey Builder returns one of these statuses. - PublishInProcess - PublishCompleted - Error ```js HTTP/1.1 200 { "statusId": "bd93502a-773c-4588-81d9-d3c7ca0cc10a", "status": "PublishInProcess", "errors": [] } ``` If any errors are encountered during the publishing process, they're listed as elements in the `errors` array. # GET /interaction/v1/rest ## Overview Retrieves the discovery document for the collection of journey resources. To call this resource, assign your API Integration the Automation | Interactions | Read scope. ### Usage **Example Request** This request retrieves the Journey API discovery document. This document allows developers to quickly identify all methods available for the Journey service. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /interaction/v1/rest Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js HTTP/1.1 200 { "methods": { "discovery": { "path": "rest", "httpMethod": "get", "description": "Returns discovery document", "parameters": {} }, "postInteraction": { "path": "interactions", "httpMethod": "post", "description": "Create or save a journey", "parameters": {} }, "updateInteraction": { "path": "interactions", "httpMethod": "put", "description": "Update a journey version", "parameters": {} }, "updateInteractionByKey": { "path": "interactions/key:{key}", "httpMethod": "put", "description": "Update a journey version", "parameters": {} }, "updateInteractionById": { "path": "interactions/{id}", "httpMethod": "put", "description": "Update a journey version", "parameters": {} }, "publishInteractionById": { "path": "interactions/publishAsync/{id}", "httpMethod": "post", "description": "Publish a journey version asynchronously", "parameters": {} }, "publishInteractionByKey": { "path": "interactions/publishAsync/key:{key}", "httpMethod": "post", "description": "Publish a journey version asynchronously", "parameters": {} }, "publishStatus": { "path": "interactions/publishStatus/{id}", "httpMethod": "get", "description": "Check the status of a publication", "parameters": {} }, "stop": { "path": "interactions/stop/{id}", "httpMethod": "post", "description": "Stops a running journey.", "parameters": {} }, "stopByKey": { "path": "interactions/stop/key:{key}", "httpMethod": "post", "description": "Stops a running journey.", "parameters": {} }, "getGoalStatistics": { "path": "goalstatistics/{id}", "httpMethod": "get", "description": "Retrieve goal statistics for a journey", "parameters": { "id": "String id of the journey" } }, "postGoalStatistics": { "path": "goalstatistics/clear/{id}", "httpMethod": "post", "description": "Clear goal statistics for a journey", "parameters": { "id": "String id of the journey" } }, "getInteraction": { "path": "interactions/{id}", "httpMethod": "get", "description": "Retrieve a journey.", "parameters": {} }, "deleteInteraction": { "path": "interactions/{id}", "httpMethod": "delete", "description": "Delete a journey.", "parameters": {} }, "deleteInteractionByKey": { "path": "interactions/key:{key}", "httpMethod": "delete", "description": "Delete a journey.", "parameters": {} }, "getInteractionCollection": { "path": "interactions", "httpMethod": "get", "description": "Retrieve a collection of journeys.", "parameters": {} }, "getWaitStatistics": { "path": "waitstatistics/{id}", "httpMethod": "get", "description": "Retrieve wait activity counts for a journey", "parameters": { "id": "String id of the journey" } }, "getJourneyMap": { "path": "map", "httpMethod": "get", "description": "Get a Journey Map.", "parameters": {} }, "createUpdateJourneyMap": { "path": "map", "httpMethod": "post", "description": "Create/update a Journey Map.", "parameters": {} }, "searchTraceEvents": { "path": "interactions/traceevents/search", "httpMethod": "post", "description": "Search for trace events stored in ElasticSearch", "parameters": {} }, "getTriggerStatistics": { "path": "triggerstats/{eventDefinitionID}", "httpMethod": "get", "description": "Retrieve trigger statistics", "parameters": { "eventDefinitionID": "Event definition Id" } }, "createTriggerTest": { "path": "interactions/triggerTest/{eventDefinitionId}", "httpMethod": "post", "description": "Create a trigger test", "parameters": {} }, "updateTriggerTest": { "path": "interactions/triggerTest/{eventDefinitionId}", "httpMethod": "put", "description": "Update a trigger test", "parameters": {} }, "deleteTriggerTest": { "path": "interactions/triggerTest/{eventDefinitionId}", "httpMethod": "delete", "description": "Delete a trigger test", "parameters": {} }, "postEventDefinition": { "path": "eventDefinitions", "httpMethod": "post", "description": "Create an event definition", "parameters": {} }, "updateEventDefinitionById": { "path": "eventDefinitions/{id}", "httpMethod": "put", "description": "Update an event definition by ID", "parameters": {} }, "updateEventDefinitionByKey": { "path": "eventDefinitions/key:{key}", "httpMethod": "put", "description": "Update an event definition by key", "parameters": {} }, "getEventDefinitionByKey": { "path": "eventDefinitions/key:{key}", "httpMethod": "get", "description": "Get an event definition by key", "parameters": {} }, "getEventDefinitionById": { "path": "eventDefinitions/{id}", "httpMethod": "get", "description": "Get an event definition by id", "parameters": {} }, "getEventDefinitionCollection": { "path": "eventDefinitions", "httpMethod": "get", "description": "Retrieve a collection of event definitions.", "parameters": {} }, "deleteEventDefinitionById": { "path": "eventDefinitions/{id}", "httpMethod": "delete", "description": "Delete an event definition by id", "parameters": {} }, "deleteEventDefinitionByKey": { "path": "eventDefinitions/key:{key}", "httpMethod": "delete", "description": "Delete an event definition by key", "parameters": {} }, "postInteractionsEvents": { "path": "events", "httpMethod": "post", "description": "Post an event to journeys", "parameters": {} }, "getHistory": { "path": "history", "httpMethod": "get", "description": "Retrieve a collection of history", "parameters": {} } } } ``` If successful, the API returns a 200 OK response. If unsuccessful, the API returns a 400 with more details on the error. # GET /messaging/v1/email/seed-list-account ## Overview Reads account data for a seed-list. The MID is used from authentication. Returns the partner list and auto-seed options that are in place for the MID. ## Response | **Status** | **Name** | **Type** | **Description** | | ---------- | --------------------- | -------- | ---------------------------------------------------------------------------- | | 200 |   |   | Successful read of account data. | |   | autoSeedListID | string | A globally unique identifier (GUID). | |   | autoSeedListThreshold | integer | The threshold for auto-seeding. | |   | autoSeedEnabled | boolean | A true or false value indicating if auto-seed is enabled. | |   | autoSeedListName | string | The name of the seed-list. | | 200 |   |   | Successful read but an empty response when there's no SeedListAccount entry. | ### Validation Failure Scenarios | **HTTP Status** | **Description** | **Notes** | | --------------- | --------------------------------------------------- | ----------------- | | 400 | No active auto-seed-list mapping for the given MID. | Error code: 10000 | | 429 | API rate limit throttling is preventing success. | Yet to be added. | ## Usage ### Example Request ```json GET /messaging/v1/email/seed-list-account ``` ### Example Response Data exists: ```js 200 OK { "autoSeedListID": "f21cec40-0227-4e46-8a0e-a4223c0ec1ea", "autoSeedThreshold": 500000, "autoSeedEnabled": false, "autoSeedListName": "SeedListName" } ``` No data exists: ```js 200 OK {} ``` ## Related Items - [Seed-List in Rest Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/routes.md#seed-list) - [Seed-List Management API](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/messageSeedListManagement.md) # GET /messaging/v1/email/seed-lists ## Overview Read all seed lists for an account. The MID and partner appId are used from authentication. The View user permission is required. ## Response | **Status** | **Name** | **Type** |   |   |   |   | **Description** | | ---------- | -------- | --------------- | --------------- | -------- | -------- | -------- | --------------------------------------------------------------------------------------------- | | 200 |   |   |   |   |   |   | Successful response indicating the request passed validations. | |   | count | integer |   |   |   |   | The count of seed-lists. | |   | page | integer |   |   |   |   | The page number. | |   | pageSize | integer |   |   |   |   | The maximum of seed-lists allowed on a page under the current pagination settings. | |   | links | object |   |   |   |   | An object containing relevant links as name\:value pairs, the values are objects. | |   |   |   | **Name** | **Type** |   |   |   | |   |   |   | self | object |   |   | The name `self` is a default object name, with the nested object. | |   |   |   |   |   | **Name** | **Type** |   | |   |   |   |   |   | href | string | The string value is the path of the calling url. | |   | items | list of objects |   |   |   |   | The container for the `items`. | |   |   |   | **Name** | **Type** |   |   |   | |   |   |   | id | string |   |   | A globally unique identifier (GUID). | |   |   |   | name | string |   |   | The name of a seed-list, assigned at creation or update. | |   |   |   | description | string |   |   | The description of a seed-list, assigned at creation or update. | |   |   |   | activeSeedCount | integer |   |   | The count of seeds (email addresses) in the seed-list. | | 200 |   |   |   |   |   |   | Successful response but with an empty object, indicating no seed-lists for the partner appID. | ### Validation Failure Scenarios | **HTTP Status** | **Description** | | --------------- | ------------------------------------------------ | | 429 | API rate limit throttling is preventing success. | ## Usage ### Example Request ```url GET /messaging/v1/email/seed-lists ``` ### Example Responses Data exists: ```json 200 OK { "count": 3, "page": 1, "pageSize": 50, "links": { "self": { "href": "/v1/email/seed-lists" } "items":[ { "id": "fb9a8b12-a088-4999-b9ce-f8cd3fe06386", "name": "seedList1Name1", "description": "A description of seedList1Name1", "activeSeedCount": 20 }, { "id": "3b379c49-c01a-4fb4-a5dc-13a63c735c1d", "name": "seedList1Name2", "description": "some description2", "activeSeedCount": 2 }, { "id": "20e173cd-12aa-45e5-bd1f-b425730f39c6", "name": "seedList1Name2", "description": "some description2", "activeSeedCount": 0 } ] } ``` No data exists: ```json 200 OK {} ``` ## Related Items - [Seed-List in Rest Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/routes.md#seed-list) - [Seed-List Management API](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/messageSeedListManagement.md) # GET /messaging/v1/email/seed-lists/{id} ## Overview Read a single seed list for an account. The MID and partner appId is used from authentication. Ensure the MID is activated for MCSeedList. This query verifies that the seed-list GUID given as the value for `id` belongs to the appID. If so, it returns the active seed-list for the `id`. ## Response | **Status** | **Name** | **Type** |   |   | **Description** | | ---------- | ----------- | --------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------- | | 200 |   |   |   |   | Successful response indicating the request passed validations | |   | id | string |   |   | The globally unique id (GUID) assigned inception. | |   | name | string |   |   | The description given at creation or update. | |   | description | string |   |   | The description of the seed-list given at creation or update. | |   | seeds | list of objects |   |   | The objects in the list each consist of a single name\:value pair. | |   |   |   | **Name** | **Type** |   | |   |   |   | email | string | An email address. | | 200 |   |   |   |   | Successful response but with an empty object, indicating no active seed-lists for the partner appID. | ### Validation Failure Scenarios | **HTTP Status** | **Description** | | --------------- | ------------------------------------------------ | | 401 | Seed-list doesn't belong to the partner appID. | | 429 | API rate limit throttling is preventing success. | ## Usage ### Example Request ```url GET /messaging/v1/email/seed-lists/{id} ``` ### Example Responses Data exists: ```json 200 OK { "id": "fb9a8b12-a088-4999-b9ce-f8cd3fe06386", "name": "seedList1Name", "description": "Seed list description", "seeds": [ {"email": "address1@example.com"}, {"email": "address2@example.com"}, {"email": "address3@example.com"} ] } ``` No data exists: ```json 200 OK {} ``` ## Related Items - [Seed-List in Rest Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/routes.md#seed-list) - [Seed-List Management API](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_seedlist/messageSeedListManagement.md) # GET /messaging/v1/messageDefinitionSends/key:{key}/deliveryRecords ## Overview Gets the delivery details of an email sent using the MessageDefinitionSends. ### URL Parameters | Name | Type | Description | | ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ObjectID` | String | Required. The ID of the entry event send definition, included in URL as an ID. Either this property or the external key is required. | | `key` | String | Required. External key of the entry event send definition. Either this property or the `ObjectID` is required. | | `RecipientSendId` | String | Required. The `RecipientSendId` value returned from the `/messageDefinitionSends` send service, which is the unique identifier for a single email send. | ### Usage **Example Request Using Send ID** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/messageDefinitionSends/dfa5ab87-1b0f-e211-b71b-9c8e9920e9fc/deliveryRecords/a7038ea5-51b7-4574-ac22-183654378dd2 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Request Using Send ID** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/messageDefinitionSends/key:external_key/deliveryRecords/a7038ea5-51b7-4574-ac22-183654378dd2 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js HTTP/1.1 200 OK { "deliveryTime": "2014-09-18T07:38:34.943", "id": "bd52a488-2f5c-de11-92ee-001cc494ae9e", "messageId": "a7038ea5-51b7-4574-ac22-183654378dd2", "status": "Sent", "to": { "address": "example@example.com", "id": 195711367, "key": "example@example.com" } } ``` **Example Queued Response** ```js HTTP/1.1 200 OK { "id": "bd52a488-2f5c-de11-92ee-001cc494ae9e", "messageId": "ea0ebbe0-59fa-4f4d-a0fb-eda2fbda1052", "status": "Queued" } ``` **Example Error Response** ```js HTTP/1.1 200 OK { "id": "bd52a488-2f5c-de11-92ee-001cc494ae9e", "messageId": "d74f4d52-e5d9-42ef-9999-8d24a68be89b", "status": "Error", "to": { "address": "", "id": 0, "key": "" }, "messageErrors": [{"messageErrorStatus": "The subscriber was excluded by List Detective."}] } ``` # GET /messaging/v1/securityHeaders ## Overview Get a list of the security headers applied to a business unit's SAP-branded `view` and `click` domains. ### JSON Parameters | Name | Type | Description | | ----------- | ------ | ----------------------------------------------------------------------- | | `data` | array | An array of objects described in [the `data` object](#the-data-object). | | `requestId` | string | A string formatted as a GUID. | #### The `data` Object | Name | Type | Description | | ----------------- | ------ | --------------------------------------------------------------------------------------------- | | `securityHeaders` | array | An array of objects described in [the `securityHeaders` object](#the-securityheaders-object). | | `pageType` | string | The string value is `view` or `click`. | #### The `securityHeaders` Object | Name | Type | Description | | ------ | ------- | ------------------------- | | `id` | integer | The security header id. | | `name` | string | The security header name. | ## Usage ### Example Request ```bash Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/securityHeaders Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```json HTTP/1.1 200 { "data": [ { "securityHeaders": [ { "id": 6, "name": "Cache-control" }, { "id": 3, "name": "X-Content-Type-Options" }, { "id": 5, "name": "Strict-Transport-Security" } ], "pageType": "view" }, { "securityHeaders": [ { "id": 6, "name": "Cache-control" }, { "id": 3, "name": "X-Content-Type-Options" } ], "pageType": "click" } ], "requestId": "52b8733f-f0fd-4179-8cb9-f5a6a0f8b72e" } ``` ## Related Items - [HTTP Security Headers Overview](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-overview.md) - [Get All HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-get-all.md) - [Update HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-update.md) - [Delete HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-delete.md) # GET /messaging/v1/securityHeaders/all ## Overview Get the list of all available security headers with their default values. ## Usage ### Example Request ```bash Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/securityHeaders/all Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```json HTTP/1.1 200 { "data": [ { "value": "no-cache, must-revalidate, max-age=0, no-store, private", "id": 6, "name": "Cache-Control" }, { "value": "default-src 'self'; frame-ancestors 'self'", "id": 1, "name": "Content-Security-Policy" }, { "value": "geolocation=(self), microphone=()", "id": 8, "name": "Permissions-Policy" }, { "value": "origin-when-cross-origin", "id": 4, "name": "Referrer-Policy" }, { "value": "strict", "id": 9, "name": "Set-Cookie" }, { "value": "max-age=31536000; includeSubDomains", "id": 5, "name": "Strict-Transport-Security" }, { "value": "nosniff", "id": 3, "name": "X-Content-Type-Options" }, { "value": "SAMEORIGIN", "id": 2, "name": "X-Frame-Options" }, { "value": "1; mode=block", "id": 7, "name": "X-XSS-Protection" } ], "requestId": "f8d089f9-604b-42d0-a6da-1f92ad081b4d" } ``` ## Related Items - [HTTP Security Headers Overview](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-overview.md) - [Get HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-read.md) - [Update HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-update.md) - [Delete HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-delete.md) # GET /messaging/v1/sms/definitions **note:** The number of records returned by this function is based on the `$pageSize` and `$page` parameters. It doesn't necessarily return all the records in one call. ## Overview Get a list of SMS send definitions. ### URL Parameters | Name | Type | Description | | --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **`$filter`** | string | Filter by status type. Accepted values are `active`, `inactive`, or `deleted`. Valid operations are `eq` and `neq`. | | **`$pageSize`** | integer | In the array called `definitions`, each element is an object representing a send definition. This parameter controls the number of such objects that are returned per page. | | **`$page`** | integer | Page number to return. | | **`$orderBy`** | string | Sort by a dimension. You can sort by only one dimension. Accepted values are `definitionKey`, `name`, `createdDate`, `modifiedDate`, and `status`. | ## Responses | Status | Name | Type | Description | | --------- | ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **`200`** |   |   | **Success** | |   | requestId | string | The unique identifier of this request. | |   | name | string | Name of the definition. | |   | definitionKey | string | Unique, user-generated key to access the definition object. | |   | status | string | Operational state of the definition: `active`, `inactive`, or `deleted`. A message sent to an active definition is processed and delivered. A message sent to an inactive definition isn’t processed or delivered. Instead, the message is queued for later processing for up to three days. | |   | createdDate | string | Date the definition was created. | |   | modifiedDate | string | Date and time of the most recent definition change. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/sms/definitions/?$filter=status%20eq%20active&$pageSize=10&$page=1&$orderBy=name Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 OK { "requestId": "ba9633fa-5c8d-4c42-8efa-a16412ac0c53", "definitions": [ { "definitionKey": "account-reset", "status": "Active", "name": "Using new SMS Transactional API", "createdDate": "2018-07-18T19:52:00", "modifiedDate": "2018-07-18T19:52:00" } ], "count": 1, "page": 1, "pageSize": 10 } ``` ### HTTP Responses | Response | Reason | | ------------------ | --------------------------------- | | `200` OK | Success. Review example response. | | `400` Bad Request | Invalid request | | `403` Forbidden | Failed to pass authorization. | | `500` Server Error | Internal error | # GET /messaging/v1/sms/definitions/{definitionKey} Retrieves the send definition configuration details for a definition key. ## URL Parameters | Name | Type | Description | | --------------- | ------ | ------------------------------------------------------- | | `definitionKey` | string | Required. The unique identifier of the send definition. | ## Responses | Status | Name | Type | Description | | ------- | ------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **200** | | | OK | | | requestId | string | The unique identifier of this request. | | | name | string | Name of the definition. | | | definitionKey | string | A unique, user-generated key to access the definition object. | | | definitionId | string | A unique Marketing Cloud Engagement object identifier. | | | description | string | A user-provided description of the send definition. | | | status | string | The status of the definition. Possible values include `active`, `inactive`, or `deleted`. Messages that you send to an active definition are processed for delivery. Messages that you send to an inactive definition aren’t processed or delivered. Instead, the message is queued for later processing for up to three days. | | | createdDate | string | The date the definition was created. | | | modifiedDate | string | The date and time the definition was most recently changed. | | | content.message | string | The message content to send with each message. Use substitution strings and AMPscript to personalize the message. | | | subscriptions.shortCode | string | The short or long code to use to send messages with this send definition. | | | subscriptions.countryCode | string | The country code associated with the short code. Don't specify this value for long codes unless your account configuration requires it. | | | subscriptions.keyword | string | An SMS keyword that is used to track messages. | | | subscriptions.autoAddSubscriber | boolean | If you set this value to `true`, recipients are added as subscribers to the short code. If you set the value to `false`, the message is rejected if the contact doesn’t exist as a subscriber. The default value is `true`. | | | subscriptions.updateSubscriber | boolean | If you set this value to `true`, the system updates the subscriber data to include the mobile number. Default is `true`. | | | options.urlShortenerOptions.IsLinkShorteningEnabled | boolean | Indicates if URL shortening is enabled for URLs in the message body. The values are `true` and `false`. | | | options.urlShortenerOptions.isSubscriberTrackingEnabled | boolean | Indicates if subscriber level tracking is enabled for URLs in the message body. The values are `true` and `false`. The value is `true` if the value of shortenerType is `SFMC`. | | | options.urlShortenerOptions.shortenerType | string | The type of URL shortener. The value is `SFMC`. | | | options.SmsMessageRegulatoryAuthorityTemplateId | string | The ID of the DLT template used in the SMS. This attribute is available only for customers in India. | ## Usage ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/sms/definitions/SEND_DEFINITION_KEY Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ## Example Response ```js HTTP/1.1 200 Success { "requestId": "582bec09-6d04-4222-bbba-cea616495596", "name": "account-reset", "definitionKey": "account-reset", "description": "Using SMS Transactional API", "status": "Active","status": "Active", "createdDate": "2024-07-10T04:20:00", "modifiedDate": "2024-07-10T04:20:00", "content": { "message": "Shortening the URL" }, "subscriptions": { "shortCode": "519000242", "countryCode": "US", "autoAddSubscriber": true, "updateSubscriber": true, "keyword": "API" }, "options": { "urlShortenerOptions": { "isLinkShorteningEnabled": true, "isSubscriberTrackingEnabled": true, "shortenerType": "SFMC" }, "smsMessageRegulatoryAuthorityTemplateId": "1107170833298425627" } } ``` # GET /messaging/v1/sms/definitions/{definitionKey}/queue Retrieves metrics for the messages associated with a send definition, including messages that haven't been processed yet. ## URL Parameters | Name | Type | Description | | ----------------- | ------ | -------------------------------------------------- | | **definitionKey** | string | Required. The unique identifier of the definition. | ## Usage This example checks the queue depth and age of the oldest record that hasn't been processed. If you set a definition to inactive and continue to send message requests to it, the count and age increase. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/sms/definitions/{definitionKey}/queue Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` If the request is successful, the response includes a unique ID for the request. It also includes the number of records that are waiting to be processed in the queue and the age of the oldest unprocessed record in the queue. ```js HTTP/1.1 200 OK { "requestId": "ba9633fa-5c8d-4c42-8efa-a16412ac0c53", "count": 22, "ageSeconds": 45 } ``` # GET /messaging/v1/sms/messages/?type=notSent Gets a paginated list of messages that weren't sent, ordered from oldest to newest. ## URL Parameters | Name | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `type` | string | Required. Only notSent is supported. | | `$pageSize` | integer | Number of messageKeys (array elements) to return per response page. | | `lastEventId` | integer | Event ID from which you want the response to start. To obtain the initial event ID, submit a request without a lastEventId. The events in the response are listed top to bottom from oldest to newest. | ### Responses | Status | Name | Type | Description | | ------- | ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | **Success. Review example response.** | |   | lastEventID | integer | Event ID from which you want the response to start. To obtain the initial event ID, submit a request without a lastEventId. The events in the response are listed top to bottom from oldest to newest. | |   | statusCode | integer | Integer value of the reason the send didn't complete. Review Send Error Codes for more information. | |   | statusMessage | string | The reason the send didn't complete. Review Send Error Codes for more information. | |   | eventCategoryType | string | TransactionalSendEvent event type. SMSSent indicates that the message was sent for delivery. SMSNotSent indicates that the message wasn't sent and includes the reason. SMSQueued indicates that the SMS hasn't yet been processed for sending. | |   | timestamp | string | Time the event occured in Central Standard Time without daylight saving time applied. | |   | definitionKey | string | Unique identifier of the definition. | |   | eventID | integer | Numeric identifier of the event. | |   | messageKey | string | Unique identifier to track message send status. | |   | contactKey | string | Unique identifier for a subscriber. | |   | to | string | Channel address of the recipient. For SMS, it’s the recipient's mobile address. | ## Usage This sample request shows how to retrieve unsent SMS messages for a specified SMS event. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/sms/messages/?type=notSent&$pagesize=20&lastEventId=35759 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response is an HTTP 200 response that contains information about the unsent messages. ```json { "lastEventID": 35774, "messages": [ { "statusCode": 24, "statusMessage": "Error Message", "eventCategoryType": "TransactionalSendEvents.SMSNotSent", "timestamp": "2018-12-17T13:05:40.947", "definitionKey": "account-reset", "eventID": 35760, "info": { "messageKey": "2iQNfGHj2UqTalK9x2gPow", "contactKey": "example1" } } ], "count": 1 } ``` ## HTTP Responses | Response | Reason | | ------------------ | --------------------------------- | | 200 `OK` | Success. Review example response. | | 400 `Bad Request` | Invalid request | | 401 `Unauthorized` | Failed to pass authorization. | | 500 `Server Error` | Internal error | # GET /messaging/v1/sms/messages/{messageKey} Retrieves the send status for an SMS message. Requests to this endpoint are rate limited. To monitor message statuses in real time, subscribe to transactional send events using the [Event Notification Service](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_transactional_messaging_sms/ens.md). ## URL Parameters | Name | Type | Description | | ------------ | ------ | ------------------------------------------------ | | `messageKey` | string | Required. The unique identifier for the message. | **note:** When you [send a message](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_transactional_messaging_sms/sendSMSMessageSingleRecipient.md), you must provide a `messageKey` that’s unique among all of the keys used in your business unit over the last 2 days. You can use this GET request to retrieve statuses for messages that are up to 3 days old. If more than one message was sent using the same message key, the API returns the status of the message that was sent most recently. For real-time tracking of message statuses and other events, we recommend that you subscribe to transactional send events using [Event Notification Service](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_transactional_messaging_sms/ens.md). ## Responses | Status | Name | Type | Description | | ------- | ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **200** |   |   | OK | |   | requestId | string | The unique identifier of the request. | |   | eventCategoryType | string | The status of the message. A status of `SMSSent` indicates that the SMS was sent to the SMS provider. `SMSNotSent` indicates that the message wasn’t sent and includes the reason. `SMSQueued` indicates that the message hasn’t yet been processed for sending. | |   | timestamp | string | The time the event occurred in Central Standard Time. Daylight saving time (DST) isn’t applied. | |   | messageKey | string | A unique identifier to track the status of the message. | |   | compositeId | string | An internal ID. If you contact Salesforce Support to troubleshoot SMS delivery issues, provide this ID. | |   | contactKey | string | The unique Marketing Cloud Engagement identifier for the subscriber. | |   | to | string | The recipient's mobile number. | ## Usage ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /messaging/v1/sms/messages/MESSAGE_KEY Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response includes an ID for the request. The `eventCategoryType` property indicates whether the message was sent to the outbound SMS service for delivery. If the message was sent, this property has a value of `TransactionalSendEvents.SMSSent`. ```js HTTP/1.1 200 OK { "requestId": "77431635-1b6b-44db-a16d-420361a43dc1", "eventCategoryType": "TransactionalSendEvents.SMSSent", "timestamp": "2018-08-03T13:41:18.55", "compositeId": "1F3631D4-5497-E811-80E4-1402EC6B9540.214435.228431.1.231481617", "info": { "messageKey": "bcX0qaEp0USGciEnUJTW0w", "contactKey": "Astro25", } } ``` If the message is queued for processing, the `eventCategoryType` property has a value of `TransactionalSendEvents.SMSQueued`. ```js HTTP/1.1 200 OK { "requestId": "fcdbb2f9-438b-4d52-a380-2eade2f46396", "eventCategoryType": "TransactionalSendEvents.SMSQueued", "timestamp": "2018-08-16T10:44:41.2196" } ``` If the message wasn't sent, the `eventCategoryType` property has a value of `TransactionalSendEvents.SMSNotSent`. The `statusMessage` property in the `info` object provides the reason that the message wasn't sent. ```js HTTP/1.1 200 OK { "requestId": "30486456-ed41-46ba-96eb-06c4ff3b95d9", "eventCategoryType": "TransactionalSendEvents.SMSNotSent", "timestamp": "2018-07-24T06:26:58.463", "compositeId": "56941A9F-3A8F-E811-80E0-1402EC6B9529.4647028.622338.1.318768528", "info": { "messageKey": "9a-zUvWf3UKxLpwwIrqTmQ", "contactKey": "ec25a8c8-6d4e-42f0-84c3-4ea23564cbe5", "statusCode": 16, "statusMessage": "InvalidAttributeValue" } } ``` # GET /ott/v1/registration/{platform} ## Overview Retrieves paginated collection of registered OTT properties by OTT Platform. ### URL Parameters | Name | Type | | Description | | ------------- | ------ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | **platform** | string | **Required** | OTT Platform Name of property | | **$page** | number | | Page number to return from the paged results. Start with 1 and continue until you get zero results. Typically provided along with the $pagesize parameter. | | **$pagesize** | number | | Number of results per page to return. Typically provided along with the $page parameter. | ### Responses | Status | Name | Type | Description | | ------- | ------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- | | **200** |   |   | **success** | |   | count | string | Total count of the number of resources registered for a specific OTT network. | |   | page | string | Page Number of the results returned. | |   | pageSize | string | Page size of the results returned. | |   | links | object | Pagination links. | |   | links.self | object | Link to the current page of result set. | |   | links.self.href | string | URL to the current page of the result set. | |   | links.previous | object | Link to the previous page of result set. | |   | links.previous.href | string | URL to the previous page of the result set. | |   | links.next | object | Link to the next page of result set. | |   | links.next.href | string | URL to the next page of the result set. | |   | items | array | Indicates the name of the OTT network the resource is being registered with values: line, messenger. | |   | items.ottPlatformName | string | Indicate the name of the OTT network the resource is being registered with values: line, messenger. | |   | items.ottPlatformAttributes | object | Object containing OTT platform attributes. | |   | items.ottPlatformAttributes.applicationId | string | Facebook Application Id. Required for registering Messenger resource. | |   | items.ottPlatformAttributes.pageId | string | Facebook Page Id. Required for registering Messenger resource. | |   | items.ottPlatformAttributes.pageName | string | Facebook Page Name. Required for registering Messenger resource. | |   | items.ottPlatformAttributes.endpointUrl | string | Send API url of the OTT network. | |   | items.ottPlatformAttributes.isActive | integer | Indicate if the OTT resource is active with values: 0 (Inactive), 1 (Active). | |   | items.ottPlatformAttributes.channelId | string | LINE channel Id. Required for registering LINE resource. | |   | items.ottPlatformAttributes.channelName | string | LINE channel name. Required for registering LINE resource. | |   | items.ottPlatformAttributes.isTransactional | integer | Indicate if LINE channel is Transactional or Reseller with values: 0 (Reseller), 1 (Transactional). | |   | items.ottPlatformAttributes.isTestChannel | integer | Indicate if LINE channel is a Test channel with values: 0 (Not a test channel), 1 (test channel). | |   |   |   |   | | **400** |   |   | **Bad Request** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | |   | validationErrors | array | Validation errors in the request payload. | |   |   |   |   | | **403** |   |   | **Forbidden** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | |   |   |   |   | | **404** |   |   | **Not Found** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | ## Usage ### Example Request: Retrieve Messenger Resource Collection ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /ott/v1/registration/messenger Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response: Retrieve Messenger Resource Collection ``` HTTP/1.1 200 OK { "count": 2, "page": 1, "pageSize": 50, "links": { "self": { "href": "/v1/registration/messenger?%24page=1&%24pagesize=50" }, "next": { "href": "/v1/registration/messenger?%24page=2&%24pagesize=50" } }, "items": [ { "ottPlatformName" : "messenger", "ottPlatformAttributes" : { "applicationId" : "34234534532453", "pageId" : "2343543434231436453", "pageName" : "SFMC Engineers", "endpointUrl" : "https://example.com/23534564423435", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } }, { "ottPlatformName" : "messenger", "ottPlatformAttributes" : { "applicationId" : "1232134234", "pageId" : "21342354235", "pageName" : "Some Awesome Page", "endpointUrl" : "https://example.com/3124234234", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } } ] } ``` ### Example Request: Retrieve LINE Resource Collection ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /ott/v1/registration/line?$page=1&$pagesize=50 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response: Retrieve LINE Resource Collection ``` HTTP/1.1 200 OK { "count": 2, "page": 1, "pageSize": 50, "links": { "self": { "href": "/v1/registration/line?%24page=1&%24pagesize=50" }, "next": { "href": "/v1/registration/line?%24page=2&%24pagesize=50" } }, "items": [ { "ottPlatformName" : "line", "ottPlatformAttributes" : { "channelId" : "342135435345", "channelName" : "SFMC Engineers", "endpointUrl" : "https://example.com/213234231213", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } }, { "ottPlatformName" : "line", "ottPlatformAttributes" : { "channelId" : "324345436452342345", "channelName" : "Some Awesome Channel", "endpointUrl" : "https://example.com/3124325345234234", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } } ] } ``` # GET /ott/v1/registration/{platform}/{ottPropertyId} ## Overview Retrieves information about a registered OTT property by Platform and ID. ### URL Parameters | Name | Type | | Description | | ----------------- | ------ | ------------ | ---------------------------------- | | **platform** | string | **Required** | OTT Platform Name of the property. | | **ottPropertyId** | string | **Required** | ID of the OTT property | ### Responses | Status | Name | Type | Description | | ------- | ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- | | **200** |   |   | **Success** | |   | ottPlatformName | string | Indicates the name of the OTT network the resource is being registered with values: line, messenger. | |   | ottPlatformAttributes | object | Object containing OTT platform attributes. | |   | ottPlatformAttributes.applicationId | string | Facebook Application Id. | |   | ottPlatformAttributes.pageId | string | Facebook Page Id. | |   | ottPlatformAttributes.pageName | string | Facebook Page Name. | |   | ottPlatformAttributes.endpointUrl | string | Send API url of the OTT network. | |   | ottPlatformAttributes.isActive | integer | Indicates if the OTT resource is active with values: 0 (Inactive), 1 (Active). | |   | ottPlatformAttributes.channelId | string | LINE channel Id. Required for registering LINE resource. | |   | ottPlatformAttributes.channelName | string | LINE channel name. Required for registering LINE resource. | |   | ottPlatformAttributes.isTransactional | integer | Indicates if LINE channel is Transactional or Reseller with values: 0 (Reseller), 1 (Transactional). | |   | ottPlatformAttributes.isTestChannel | integer | Indicates if LINE channel is a Test channel with values: 0 (Not a test channel), 1 (test channel). | |   |   |   |   | | **400** |   |   | **Bad Request** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | |   | validationErrors | array | Validation errors in the request payload. | |   |   |   |   | | **403** |   |   | **Forbidden** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | |   |   |   |   | | **404** |   |   | **Not Found** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | ## Usage ### Example Request: Retrieve a Messenger Resource ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /ott/v1/registration/messenger/1732555047025799 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response: Retrieve a Messenger Resource ``` HTTP/1.1 200 OK { "ottPlatformName" : "messenger", "ottPlatformAttributes" : { "applicationId" : "1093076390764037", "pageId" : "1732555047025799", "pageName" : "SFMC Engineers", "endpointUrl" : "https://example.com/1732555047025799", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } } ``` ### Example Request: Retrieve a LINE Resource ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /ott/v1/registration/line/1093076390764037 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response: Retrieve a LINE Resource ``` HTTP/1.1 200 OK { "ottPlatformName" : "line", "ottPlatformAttributes" : { "channelId" : "1093076390764037", "channelName" : "SFMC Engineers", "endpointUrl" : "https://example.com/1732555047025799", "isTransactional" : true, "isTestChannel": false, "isActive": true, "apiVersion" : "v2.0" } } ``` # GET /ott/v1/send/{messageId} ## Overview Retrieves all the information about an existing OTT send message request. ### URL Parameters | Name | Type | | Description | | ------------- | ------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | | **messageId** | string | **Required** | Id of the send request to be retrieved. Id can be user-defined MessageKey or ottRequestId returned as a response to send message request. | ### Responses | Status | Name | Type | Description | | ------- | -------------------- | -------- | ------------------------------------------------------------------------------- | | **200** |   |   | **success** | |   | requestBody | object | Returns the request body. | |   | status | array | Status of the message send request. | |   | status.event | string | Indicates the type of event with values: Created, Queued, Sent, Error (if any). | |   | status.eventDateTime | datetime | Timestamp indicating when the event occured. | |   |   |   |   | | **403** |   |   | **Forbidden** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | |   |   |   |   | | **404** |   |   | **Not Found** | |   | message | string | Error message. | |   | errorcode | number | Error code. | |   | documentation | string | Documentation for the error code. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /ott/v1/send/812ed7d7-f11c-43dd-9eaa-b32ca3264278 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response: Retrieve a Send Message Request to Messenger ``` HTTP/1.1 200 OK { "requestBody": { "messageKey": "e1c3514160f969e52b0d", "ottRequestId": "942adfff-817e-4276-bca6-c1cbcd7b6241", "from": { "senderType": "messenger", "senderId": "200012913364042" }, "to": { "ottId": "1061820367222105" }, "message": { "subject": "Message Name", "contents": [ { "type": "text", "text": "Hello, Messenger World!", "duration": 0, "isReusable": false } ], "customKeys": [ { "messagingType": "RESPONSE" } ] }, "validityPeriod": 30 }, "status": [ { "event": "Created", "eventDateTime": "2018-05-24T13:36:52.747" }, { "event": "Queued", "eventDateTime": "2018-05-24T13:37:01.29" }, { "event": "Sent", "eventDateTime": "2018-05-24T13:37:01.337" } ] } ``` ### Example Response: Retrieve Send Message Request to LINE ``` HTTP/1.1 200 OK { "requestBody": { "messageKey": "e1c35141-6e5c-4bc2-813b-60f969e52b0d", "ottRequestId": "2dd53e4a-56a5-497a-b5f2-1a34187e1641", "from": { "senderType": "line", "senderId": "1415451353" }, "to": { "ottId": "U0098560c6da67ea9cab11d4405e3c018" }, "message": { "subject": "Message Name", "contents": [ { "type": "text", "text": "Hello, LINE World!", "duration": 0, "isReusable": false } ], "customKeys": [] }, "validityPeriod": 30 }, "status": [ { "event": "Created", "eventDateTime": "2018-05-24T14:58:14.36" }, { "event": "Queued", "eventDateTime": "2018-05-24T14:58:15.01" }, { "event": "Sent", "eventDateTime": "2018-05-24T14:58:15.337" } ] } ``` # GET /platform/v1/ens-callbacks Retrieves details about all registered callbacks. ## Usage To retrieve information about callbacks, issue a GET request to the `/platform/v1/ens-callbacks` endpoint. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /platform/v1/ens-callbacks Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about all of the callbacks in the account. ```js HTTP/1.1 200 Success [{ "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d", "callbackName": "cb1", "url": "https://example1.com/", "maxBatchSize": 1000, "status": "verified", "statusReason": "none" }, { "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057e", "callbackName": "cb2", "url": "https://example2.com/", "maxBatchSize": 750, "status": "verified", "statusReason": "none" }] ``` ## HTTP Responses This table lists the possible responses for this endpoint. | Response | Reason | | ------------------ | ------------------------------------------------------------------------------------------------------ | | `200 Success` | The request to retrieve the callbacks succeeded. | | `400 Bad Request` | The request was invalid. Make sure the request includes all the required headers. | | `403 Forbidden` | The request couldn't be authorized. Make sure the request headers include a valid authorization token. | | `500 Server Error` | An internal error occurred. Try your request again later. | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # GET /platform/v1/ens-callbacks/{callbackId} ## Overview Retrieves details about a registered callback. ### URL Parameters | Name | Type | | Description | | -------------- | ------ | ------------ | ---------------------------------- | | **callbackId** | string | **Required** | Unique identifier of the callback. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /platform/v1/ens-callbacks/65b885ab-c2b4-46fe-85d0-d6cb8be8057d Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 Success { "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d", "callbackName": "cb1", "url": "https://example.com/", "maxBatchSize": 1000, "status": "verified", "statusReason": "none" } ``` ### HTTP Responses | Response | Reason | | --------------- | -------------------------------------------- | | 200 Success | Callback retrieved. Review example response. | | 400 Bad Request | Unable to process the request. | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Callback ID doesn't exist. | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # GET /platform/v1/ens-subscriptions-by-cb/{callbackId} ## Overview Retrieves details for all subscriptions associated with a callback. ### URL Parameters | Name | Type | | Description | | -------------- | ------ | ------------ | ---------------------------------- | | **callbackId** | string | **Required** | Unique identifier of the callback. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /platform/v1/ens-subscriptions-by-cb/65b885ab-c2b4-46fe-85d0-d6cb8be8057d Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 Success [{ "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d", "callbackName": "cbName", "url": "https://example.com/", "maxBatchSize": 1000, "subscriptionId": "d89c87c4-70f8-43d6-be1e-f01dce97fe4c", "subscriptionName": "subscriptionName", "eventCategoryTypes": ["TransactionalSendEvents.EmailNotSent", "TransactionalSendEvents.EmailSent"], "filters": ["definitionKey=12345"], "status": "active", "statusReason": "" }, { "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d", "callbackName": "cbName", "url": "https://example.com/", "maxBatchSize": 1000, "subscriptionId": "55afe59f-8d20-46fd-a2d1-ff01453abe90", "subscriptionName": "subscriptionName2", "eventCategoryTypes": ["TransactionalOpenEvents.EmailOpen", "TransactionalOpenEvents.EmailNotOpen"], "filters": ["definitionKey=12345"], "status": "active", "statusReason": "" }] ``` ### HTTP Responses | Response | Reason | | ---------------- | --------------------------------------- | | 200 Success | Callback subscriptions retrieved. | | 400 Bad Request | Invalid request | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Callback ID doesn’t exist for this MID. | | 500 Server Error | Internal error | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # GET /platform/v1/ens-subscriptions/{subscriptionId} ## Overview Retrieves details for a subscription. ### URL Parameters | Name | Type | | Description | | ------------------ | ------ | ------------ | --------------------------------------- | | **subscriptionId** | string | **Required** | Unique identifier for the subscription. | ## Usage ### Example Request ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /platform/v1/ens-subscriptions/d89c87c4-70f8-43d6-be1e-f01dce97fe4c Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` ### Example Response ```js HTTP/1.1 200 Success { "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d", "callbackName": "cb1", "url": "https://example.com/", "maxBatchSize": 1000, "subscriptionName": "subscriptionName", "eventCategoryTypes": ["TransactionalSendEvents.EmailNotSent", "TransactionalSendEvents.EmailSent"], "subscriptionId": "d89c87c4-70f8-43d6-be1e-f01dce97fe4c", "filters": ["definitionKey=12345"], "status": "active", "statusReason": "none" } ``` ### HTTP Responses | Response | Reason | | ---------------- | ----------------------------------- | | 200 Success | Callback subscription is retrieved. | | 400 Bad Request | Invalid request | | 403 Forbidden | Failed to pass authorization. | | 404 Not Found | Subscription ID doesn’t exist. | | 500 Server Error | Internal error | ## See Also - [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.html) # GET /sms/v1/automation/importSend/{tokenid}/status ## Overview Retrieves the status of a ImportSend automation. ### URL Parameters | Name | Type | | Description | | ----------- | ------ | ------------ | ------------------------------------------------ | | **tokenID** | string | **Required** | The ID provided in the ImportSend REST response. | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/automation/importSend/bzZ0cENGam1FZUtNX0poTDRYZzhlQTo2Mzow/status Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "status": "Complete", "lastUpdate": "2013-08-22T00:20:27.117Z", "createdTime": "2013-08-22T00:12:38.317Z", "startTime": "2013-08-22T00:12:38.31Z", "completedTime": "2013-08-22T00:20:27.113Z", "lastRunTime": "2013-08-22T00:12:38.31Z", "source": "PracticeReminder.csv", // New in January 2014 Release "inserted": 15, //number of new records in _MobileSubscription, new in January 2014 release "updated": 0, // number of updated records, new in January 2014 release "invalid": 0 // number of invalid rows in the import file, new in January 2014 release } ``` # GET /sms/v1/contacts/queueImport/{id}/status/{tokenId} ## Overview Retrieves the status of an import job. ### URL Parameters | Name | Type | | Description | | ----------- | ------ | ------------ | ----------------------------------------------------------- | | **ListID** | string | **Required** | The ID of the List found in the MobileConnect interface | | **TokenID** | string | **Required** | The unique ID returned when using the ImportQueue operation | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/contacts/queueImport/UEhwdktFWXpFZUs3Z3hRUW45R2dBQTo2Mzow/status/NzY2MTU6NDI6MA Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js HTTP/1.1 202 Accepted { "tokenId": "NzY2MTU6NDI6MA", "status": "Completed", "createdDate": "2012-12-19T14:16:16.270Z", "type": "Import" } ``` # GET /sms/v1/contacts/refreshList/{id}/status/{tokenId} Retrieves the refresh list status. ## URL Parameters | Name | Type | Description | | --------- | ------ | --------------------------------------------------------------------- | | `ListID` | String | Required. The ID of the list found in the MobileConnect interface | | `TokenID` | String | Required. The unique ID returned when using the RefreshList operation | ## Usage This sample request shows how to retrieve the status of a list. ``` Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/contacts/refreshList/LIST_ID/status/TOKEN_ID Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about the specified list. ```json { "tokenId": "NDo8NDow", "publishDate": "2012-12-18T15:42:15.080Z" } ``` If the request wasn't valid, the API returns a 400 response that includes details about the error that occurred. # GET /sms/v1/messageContact/{messageId}/deliveries/{tokenId} Retrieves the overall delivery status of a message to a contact and the standard SMS status codes and descriptions. Standard SMS status codes are universal regardless of where messages are sent. This API returns status codes in the order received from carriers. It's possible for Marketing Cloud Engagement to receive codes after the delivered or undelivered status has been returned. Infer the final message status from the status code with the highest numerical value. ## URL Parameters | Name | Type | Description | | ----------- | ------ | --------------------------------------------------------- | | `messageId` | String | Required. The message ID provided for the messageContact. | | `tokenId` | String | Required. The token ID for the messageContact. | ## Usage This sample request shows how to retrieve the status of an SMS send. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/messageContact/MESSAGE_ID/deliveries/TOKEN_ID Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The API returns an HTTP `200` response that includes information about the specified send. ```json { "message": "Test Delivery Receipt", "count": 1, "createDate": "2013-04-25T15:01:04.147", "completeDate": "2013-04-25T15:01:55.197", "status": "Finished", "tracking": [ { "mobileNumber": "15555555510", "statusCode": "20", "message": "NA" "standardStatusCode": "3000", "description": "Message enroute" }, { "mobileNumber": "15555555510", "statusCode": "200", "message": "Carrier Success", "standardStatusCode": "4000", "description": "Delivered to handset" }, { "mobileNumber": "15555555510", "statusCode": "20", "message": "Message sent to carrier", "standardStatusCode": "3001", "description": "Message Sent to Carrier" }, { "mobileNumber": "15555555510", "statusCode": "0", "message": "DELIVERED TO Air2Web", "standardStatusCode": "2000", "description": "Message was Delivered to Aggregator" } ] } ``` The response includes this information about the send: - `message` - : The message text sent in the SMS message - `count` - : The total number of mobile numbers included in the send request minus the number of unsubscribed recipients - `createdDate` - : Date when the MessageContact send was submitted, returned in Central Standard Time (CST) - `createdDate` - : Date when the send completed, returned in CST - `status` - : The status of the send. Possible values: - `Finished` - `Error` - `New` - `Queuing` - `Started` If the request includes an invalid messageId or tokenId, the API returns an HTTP `400` response that describes the error. ```js { "errors" : ["Message id cI217sdksi3 is not valid."] } ``` | Message | Details | | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Message id {0} isn't valid. | The messageID value provided in the URL wasn't in a valid format. | | "Token id {0} isn't valid." | The tokenId value provided in the URL wasn't in a valid format. | | Token id {0} isn't valid for this client. | The tokenId value provided is valid but was created for another client. | | TokenId {0} isn't valid for MessageId {1}. | The tokenId value provided is valid for your account but not for the MessageId provided. | | An unexpected error occurred, please contact Customer Support with reference id {0}. | If this unexpected error is presented when making a call, please take note of the reference id value returned in the error and contact ExactTarget Global Support for more information. | # GET /sms/v1/messageContact/{messageId}/history/{tokenId}/mobileNumber/{mobileNumber} ## Overview Retrieves the last message sent to a mobile number. ### URL Parameters | Name | Type | | Description | | ---------------- | ------ | ------------ | ------------------------------------------ | | **messageId** | string | **Required** | Message Id provided for the messageContact | | **tokenId** | string | **Required** | Token Id returned for the messageContact | | **mobileNumber** | string | **Required** | Mobile number for the messageContact | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/messageContact/MTA3ODo3ODow/history/MENqMHZHV2x3a0M1dG1iOHVnam9LZzo3OTow/mobileNumber/1120816001 Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "count": 1, "createDate": "2017-12-19T14:35:35.51", "status": "Active", "history": [ { "type": "MT", "message": "Send your first name!", "date": "2013-12-19T14:35:35.51" } ] } ``` # GET /sms/v1/messageList/{id}/deliveries/{tokenId} Returns status for a message sent to a group of mobile numbers. ## URL Parameters | Name | Type | Description | | ----------- | ------ | --------------------------------------- | | `messageId` | String | Message Id provided for the messageList | | `tokenId` | String | Token Id returned for the messageList | ## Usage This sample request shows how to retrieve the status of an SMS send. ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/messageList/MESSAGE_ID/deliveries/TOKEN_ID Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` The response contains information about the specified send. ```json { "message": "Test Delivery Receipt", "count": 1, "createDate": "2013-04-25T15:01:04.147", "completeDate": "2013-04-25T15:01:55.197", "status": "Finished", "tracking": [ { "mobileNumber": "15555555510", "statusCode": "20", "message": "NA" } ] } ``` The response includes this information about the send: - `message` - : The message text sent in the SMS message - `count` - : The total number of mobile numbers included in the send request subtracting the number of unsubscribed recipients - `createdDate` - : Date when the MessageContact send was submitted, returned in CST - `createdDate` - : Date when the send completed, returned in CST - `status` - : The status of the send. Possible values: - `Finished` - `Error` - `New` - `Queuing` - `Started` If the request includes an invalid messageId or tokenId, the API returns an HTTP `400` response that describes the error. ```js { "errors" : ["Message id cI217sdksi3 is not valid."] } ``` | Message | Details | | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Message id {0} isn't valid. | The messageID value provided in the URL wasn't in a valid format. | | "Token id {0} isn't valid." | The tokenId value provided in the URL wasn't in a valid format. | | Token id {0} isn't valid for this client. | The tokenId value provided is valid but was created for another client. | | TokenId {0} isn't valid for MessageId {1}. | The tokenId value provided is valid for your account but not for the MessageId provided. | | An unexpected error occurred, please contact Customer Support with reference id {0}. | If this unexpected error is presented when making a call, please take note of the reference id value returned in the error and contact ExactTarget Global Support for more information. | # GET /sms/v1/queueMO/deliveries/{tokenId} ## Overview Retrieves the delivery status of a queued MO. ### URL Parameters | Name | Type | | Description | | ----------- | ------ | ------------ | ----------------------------------- | | **tokenId** | string | **Required** | Token Id returned for the queued MO | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/queueMO/deliveries/OXFoN2ZtT2xWazJLSFZkOVY3MGNZQTo3Njow Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "tracking": [ { "mobileNumber": "15555555555", "statusCode": "200", "message": "Carrier Success" } ] } ``` # GET /sms/v1/queueMO/history/{tokenId} ## Overview Retrieves the tracking history of a queued MO. ### URL Parameters | Name | Type | | Description | | ----------- | ------ | ------------ | ----------------------------------- | | **tokenId** | string | **Required** | Token Id returned for the queued MO | ### Usage **Example Request** ```js Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com GET /sms/v1/queueMO/history/OXFoN2ZtT2xWazJLSFZkOVY3MGNZQTo3Njow Content-Type: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` **Example Response** ```js { "count": 5, "createDate": "2013-12-19T14:35:35.51", "status": "Active", "history": [ { "type": "MT", "message": "Send your first name!", "date": "2013-12-19T14:35:35.51" }, { "type": "MO", "message": "Anna", "date": "2013-12-19T14:36:36.04" }, { "type": "MT", "message": "Text your ZIP code!", "date": "2013-12-19T14:36:36.6" }, { "type": "MO", "message": "46202", "date": "2013-12-19T14:37:03.8" }, { "type": "MT", "message": "Thanks!", "date": "2013-12-19T14:37:03.88" } ] } ``` # Get a List of Flows Retrieve a list of flows using the [Flow object](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_visual_workflow.htm) in Metadata API. ## Prerequisite This procedure uses the Salesforce CLI to interact with Metadata API. Before you begin, complete these prerequisite steps. 1. [Install the Salesforce CLI](https://developer.salesforce.com/tools/salesforcecli). 2. [Create a project](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_create_new.htm). 3. [Authorize your org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm). ## Step 1: Create a Manifest File Before you can retrieve data from Metadata API, you must create a manifest file. This file specifies the type of information that you want to interact with. 1. In your project directory, create a file called `package.xml`. 2. Paste this code into the file. ```xml * Flows 60.0 ``` ## Step 2: Retrieve the Flows After you create the manifest file, you can execute a command to retrieve the flows. The Salesforce CLI connects to your target org and downloads the objects that are specified in the manifest file. 1. At the command line, run this command to retrieve the flows in your org. ``` sf project retrieve start --manifest package.xml ``` The CLI connects to Metadata API and begins to retrieve content. 2. In your project directory, go to the `force-app/main/default/flows` directory. The directory contains an XML file for each flow in your org. Flows that are associated with campaigns follow the naming format `flow_{campaignId}_{epochTimeMs}.flow-meta.xml`. In this naming format, `{campaignId}` is the unique ID of the campaign ID that the flow is associated with. `{epochTimeMs}` is the date and time when the campaign was created, expressed as a Unix timestamp with milliseconds. # Get a List of Identity Resolution Rulesets for Marketing Cloud Retrieve a list of data resolution rulesets using the [Data 360 Identity Resolution Rulesets](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_cdp_ssot_identity_resolutions.htm) endpoint in Connect API. ## Prerequisite Before you send a request to Connect API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve a list of identity resolution rulesets, send a GET request to the `/services/data/{apiVersion}/ssot/identity-resolutions` endpoint. ``` GET /services/data/{apiVersion}/ssot/identity-resolutions HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body lists the identity resolution rulesets in your org. ```json { "identityResolutions": [ { "anonymousUnifiedProfiles": 0, "configurationType": "individual", "consolidationRate": 0.0, "dataSpaceName": "default", "doesRunAutomatically": true, "id": "1ir1Q0000004CKHQA2", "knownUnifiedProfiles": 15, "label": "My Ruleset", "lastJobCompleted": "2024-02-03T01:23:36.000Z", "lastJobStatus": "SKIPPED", "matchRules": [ { "criteria": [ { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__FirstName__c", "matchMethodType": "fuzzy", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__LastName__c", "matchMethodType": "exact", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__ContactPointEmail__dlm", "fieldName": "ssot__EmailAddress__c", "matchMethodType": "exactnormalized", "shouldMatchOnBlank": false } ], "label": "My Ruleset" } ], "matchedSourceProfiles": 0, "objectApiName": "Individual", "reconciliationRules": [ { "entityName": "ssot__Individual__dlm", "fields": [], "linkDmoName": "IndividualIdentityLink__dlm", "ruleType": "lastupdated", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedIndividual__dlm" }, { "entityName": "ssot__ContactPointEmail__dlm", "fields": [], "linkDmoName": "ContactPointEmailIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointEmail__dlm" }, { "entityName": "ssot__ContactPointAddress__dlm", "fields": [], "linkDmoName": "ContactPointAddressIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointAddress__dlm" } ], "rulesetStatus": "PUBLISHED", "sourceProfiles": 15, "totalUnifiedProfiles": 15 } ] } ``` # Get an Access Token for Legacy Packages The first step in any API-based integration is getting an OAuth access token to authenticate your calls. This information applies only to API integrations in legacy packages. To get an access token for OAuth 2.0 API integrations, review [Set Up Your Development Environment for Enhanced Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/mc-dev-setup-enhanced.md). Using the client ID and secret from the installed package, call the Auth service to obtain an OAuth access token for authenticating your API calls. This sample call demonstrates how to POST to that resource to acquire an access token. ```js POST https://YOUR_SUBDOMAIN.auth.marketingcloudapis.com/v1/requestToken Content-Type: application/json { "clientId": "YOUR_CLIENT_ID", "clientSecret": "YOUR_CLIENT_SECRET" } ``` The response contains your access token. ```js 200 OK { "accessToken": "YOUR_ACCESS_TOKEN" "expiresIn": 3600 } ``` Specify the access token to authenticate all other REST API calls via the `Authorization` header field with the `Bearer` HTTP authorization scheme. ``` GET https://www.YOUR_SUBDOMAIN.rest.marketingcloudapis.com/platform/v1/endpoints Accept: application/json Authorization: Bearer YOUR_ACCESS_TOKEN ``` This example uses the same access token to authenticate with the SOAP API. ```xml YOUR_ACCESS_TOKEN ... ``` ## Refresh an Access Token Access tokens expire one hour after they're issued. If you attempt to use an expired token, you receive a `401 Unauthorized` HTTP response. If this happens, refresh your access token by calling `requestToken` again. ## Important Considerations Follow these considerations when using the API. 1. Don't request a new access token for every API call you make. Each access token is good for an hour and is reusable. Making two API calls for every one operation is inefficient and can lead to throttling. 2. Keep your credentials secure. Never expose your client ID or secret on the client side or store them in a mobile app. ## Related Items - [requestToken Reference](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/requestToken.md) - [Your Subdomain and Your Tenant's Endpoints](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/your-subdomain-tenant-specific-endpoints.md) # Get Batch Status ## Overview This API resource checks the status of a batch of privacy settings changes. The call returns the status of each change made to the profiles. ## Method and Endpoint `GET https://app.igodigital.com/api/v2/organization/{customer_mid}/privacy/{batch_id}` ## URL Parameters | Name | Type | Description | | ---- | ---- | ----------- | | customer_mid | string | ID for the account. | | batch_id | string | ID generated when creating a batch of privacy setting changes. | ## Example Request ``` Host: https://app.igodigital.com GET /api/v2/organization/12345678/privacy/af417962-c188-4110-adc2-7ea67590e254 Content-Type: application/json Authorization: Bearer YOUR_API_KEY ``` ## Example Response Status values for a change can be `initiated`, `success`, `failed` or `cancelled`. ``` [ { "date_initiated": "2018-03-12 18:45:17 UTC", "profile_id": "hashed-id-01", "action": "add_do_not_track", "source": "api", "status": "success", "batch_id": "af417962-c188-4110-adc2-7ea67590e254", "date_completed": "2018-03-12 18:45:17 UTC" }, { "date_initiated": "2018-03-12 18:45:17 UTC", "profile_id": "hashed-id-08", "action": "remove_do_not_profile", "source": "api", "status": "initiated", "batch_id": "af417962-c188-4110-adc2-7ea67590e254", "date_completed": "2018-03-12 18:45:17 UTC" } ] ``` # Get Daily Selection and Click Event Reports Fetch a link to the daily report of asset selections and clicks for the provided date. The link is valid for 300 seconds. Days are defined in the UTC time zone. Visit Salesforce Help to learn more about [report formats](https://help.salesforce.com/s/articleView?id=mktg.mc_pb_einstein_daily_events_report.htm). Reports dated 2021-12-14 and earlier end in _.csv. Reports dated 2021-12-15 and after are compressed and end in _.csv.gz. ## Method and Endpoint ``` GET "/ecs/ecs/external/api/v1/report/selection_click/" ``` ## Example Request ``` GET "/ecs/ecs/external/api/v1/report/selection_click/2021-12-16" ``` ## Example Response ``` { "report": "https://ecs-tenant-reports.s3.us-west-2.amazonaws.com/daily-raw/mid%3D/date%3D2021-12-16/part-.c000.csv.gz?response-content-disposition=attachment%3B%20filename%3D%22ecs_selection_click_report__2021-12-16.csv.gz%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=%2F20220110%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220110T154143Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=" } ``` # Get Details of an Identity Resolution Ruleset for Marketing Cloud Retrieve information about a data resolution ruleset using the [Data 360 Identity Resolution Ruleset](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_cdp_ssot_identity_resolution.htm) endpoint in Connect API. ## Prerequisite Before you send a request to Connect API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve information about an identity resolution ruleset, send a GET request to the `/services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionId}` endpoint, where `{identityResolutionId}` is the unique ID of the ruleset. ``` GET /services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionId} HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body contains details of the ruleset. ```json { "anonymousUnifiedProfiles": 0, "configurationType": "individual", "consolidationRate": 0.0, "dataSpaceName": "default", "doesRunAutomatically": true, "id": "1ir1Q0000004CKHQA2", "knownUnifiedProfiles": 15, "label": "My Ruleset", "lastJobCompleted": "2024-02-03T01:53:36.000Z", "lastJobStatus": "SKIPPED", "matchRules": [ { "criteria": [ { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__FirstName__c", "matchMethodType": "fuzzy", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__LastName__c", "matchMethodType": "exact", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__ContactPointEmail__dlm", "fieldName": "ssot__EmailAddress__c", "matchMethodType": "exactnormalized", "shouldMatchOnBlank": false } ], "label": "My Ruleset" } ], "matchedSourceProfiles": 0, "objectApiName": "Individual", "reconciliationRules": [ { "entityName": "ssot__Individual__dlm", "fields": [], "linkDmoName": "IndividualIdentityLink__dlm", "ruleType": "lastupdated", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedIndividual__dlm" }, { "entityName": "ssot__ContactPointEmail__dlm", "fields": [], "linkDmoName": "ContactPointEmailIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointEmail__dlm" }, { "entityName": "ssot__ContactPointAddress__dlm", "fields": [], "linkDmoName": "ContactPointAddressIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointAddress__dlm" } ], "rulesetStatus": "PUBLISHED", "sourceProfiles": 15, "totalUnifiedProfiles": 15 } ``` # Get Marketing Cloud Next Records Using REST API Retrieve individual records using the [get sObject rows](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve_get.htm) endpoints in REST API. ## Record Types You can use REST API to retrieve many types of records. This table shows the record types that are most relevant to Marketing Cloud. | Record Type | API Name | | ------------------ | --------------------- | | Contact records | `Contact` | | Lead records | `Lead` | | Campaigns | `Campaign` | | Marketing segments | `MarketSegment` | | Flows | `FlowRecord` | | Content workspaces | `ManagedContentSpace` | | Content items | `ManagedContent` | ## Prerequisite Before you send a request to REST API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve a record, send a GET request to `/services/data/{apiVersion}/sobjects/OBJECT_API_NAME/RECORD_ID`. Replace `OBJECT_API_NAME` with the API name of the type of object that you want to retrieve, and replace `RECORD_ID` with the record ID. ``` GET /services/data/{apiVersion}/sobjects/OBJECT_API_NAME/RECORD_ID HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body varies depending on the object type of the record that you retrieved. This example shows a response body for a Flow record. ```json { "attributes": { "type": "FlowRecord", "url": "/services/data/{apiVersion}/sobjects/FlowRecord/2aF1Q000000PAvMUAW" }, "Id": "2aF1Q000000PAvMUAW", "OwnerId": "0051Q00000boglcQAA", "IsDeleted": false, "Name": "2023 Running Shoe Model Clearance Flow", "CreatedDate": "2024-01-18T22:20:35.000+0000", "CreatedById": "0051Q00000boglcQAA", "LastModifiedDate": "2024-01-18T22:20:35.000+0000", "LastModifiedById": "0051Q00000boglcQAA", "SystemModstamp": "2024-01-18T22:20:35.000+0000", "LastViewedDate": "2024-01-19T17:52:59.000+0000", "LastReferencedDate": "2024-01-19T17:52:59.000+0000", "FlowDefinition": "3001Q000000Dnpq", "AssociatedRecordId": "7011Q000001SXgxQAG", "Description": null, "SegmentId": null, "Type": "Segment", "ProgressStatus": "Draft", "ScheduledStartDate": "2024-01-18T22:20:35.000+0000", "ErrorCode": null, "ErrorDetails": null, "FlowCategory": null, "FlowSubcategory": null, "IsPaused": false, "FlowType": "SegmentTrig" } ``` # Get Marketing Cloud Next Segment Details Retrieve details of an individual segment using the [Data 360 Segment](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_cdp_ssot_segment.htm) endpoint in Connect API. ## Prerequisite Before you send a request to Connect API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve information about a segment, send a GET request to the `/services/data/{apiVersion}/ssot/segments/SEGMENT_API_NAME` endpoint. Replace `SEGMENT_API_NAME` with the API name of the segment that you want to retrieve details for. For additional information and code examples, see [getSegmentDetails](/docs/marketing/marketing-cloud-growth/references/mc-connect-segments?meta=getSegmentDetails). ``` GET /services/data/{apiVersion}/ssot/segments/SEGMENT_API_NAME HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body contains detailed information about the specified segment. ```json { "segments": [ { "apiName": "Running_Shoe_Promo_Audience", "dataSpace": "default", "displayName": "Running Shoe Promo Audience", "marketSegmentDefinitionId": "3HX1Q000000HxyZWAS", "marketSegmentId": "1sg1Q000000HxyZQAS", "publishInterval": "NO_REFRESH", "publishStatus": "SUCCESS", "segmentMembershipDmo": { "historyTable": "Individual_Unified_SMH_1234567890122__dlm", "latestTable": "Individual_Unified_SM_1234567890123__dlm" }, "segmentMembershipTable": "Individual_Unified_SMH_1234567890123__dlm", "segmentOnApiName": "UnifiedIndividual__dlm", "segmentOnId": "0gj1Q000000PQ3xYZG", "segmentStatus": "ACTIVE", "segmentType": "UI" } ] } ``` # Get Marketing Cloud Next Segment Members Retrieve a list of members in a segment by using the [Data 360 Segment Members](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_cdp_ssot_segment_members.htm) endpoint in Connect API. ## Prerequisite Before you send a request to Connect API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve a list of segment members, send a GET request to the `/services/data/{apiVersion}/ssot/segments/SEGMENT_API_NAME/members` endpoint. Replace `SEGMENT_API_NAME` with the API of the segment that you want to retrieve a list of members for. ``` GET /services/data/{apiVersion}/ssot/segments/SEGMENT_API_NAME/members HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body contains a list of segment members. ```json { "data": [ { "deltaType": "new", "id": "1175a1b5c71d8cc748449c309bd57965", "snapshotType": "F", "timestamp": "2024-01-23T18:25:02.924Z", "versionStamp": "2024-01-22T18:29:11.841Z" }, ... ], "endTime": "2024-01-24T19:57:24.000Z", "filter": "Delta_Type__c in ( new , existing )", "limit": 100, "offSet": 0, "orderBy": "Id__c asc", "rowCount": 15, "startTime": "2024-01-24T19:57:23.000Z", "totalCount": 15 } ``` You can filter, sort, and limit the results by adding query parameters. For information and code examples, see [getSegmentMembers](/docs/marketing/marketing-cloud-growth/references/mc-connect-segments?meta=getSegmentMembers). # Get Records in Marketing Cloud Use REST API to retrieve individual records synchronously. Bulk API 2.0 doesn’t include operations for retrieving specific records. However, you can use it to [perform queries that retrieve information about multiple records](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-manage-objects-query/mc-manage-objects-query.md). - [Get Records Using REST API](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/guide/mc-manage-objects-get-rest.md) # Get Segments in Marketing Cloud Retrieve a list of segments using the [Data 360 Segments](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_cdp_ssot_segments.htm) endpoint in Connect API. ## Prerequisite Before you send a request to Connect API, obtain a bearer token. For more information, see [Connect to REST-based APIs](https://developer.salesforce.com/docs/marketing/mc-connect-apis/mc-connect-apis-rest.md). ## Send the Request To retrieve a list of segments, send a GET request to the `/services/data/{apiVersion}/ssot/segments` endpoint. For additional information and code examples, see [getSegments](/docs/marketing/marketing-cloud-growth/references/mc-connect-segments?meta=getSegments). ``` GET /services/data/{apiVersion}/ssot/segments HTTP/1.1 Host: YOUR_SUBDOMAIN.my.salesforce.com Content-Type: application/json Authorization: Bearer YOUR_BEARER_TOKEN ``` If the request is successful, the response body contains a list of segments in your org. ```json { "batchSize": 20, "offset": 0, "orderByExpression": "[Name asc]", "segments": [ { "apiName": "Running_Shoe_Promo_Audience", "displayName": "Running Shoe Promo Audience", "marketSegmentDefinitionId": "3HX1Q000000HxyZWAS", "marketSegmentId": "1sg1Q000000HxyZQAS", "publishInterval": "NO_REFRESH", "publishStatus": "SUCCESS", "segmentMembershipTable": "Individual_Unified_SMH_1234567890123__dlm", "segmentOnId": "0gj1Q000000PQ3xYZG", "segmentStatus": "ACTIVE", "segmentType": "UI" }, ... ] } ``` # Get Started with AMPscript Development—Lesson 1 This lesson introduces you to the basics of using AMPscript in your messages. - Creating variables - Using variables to refer to values in a data extension - Displaying the value of a variable in a message Northern Trail Outfitters (NTO), the fictitious company that we refer to in this lesson, has a sendable data extension that contains several pieces of information about their subscribers. | Data Extension Column Name | Description | | -------------------------- | ---------------------------------------------------------------------------------------- | | `MemberID` | A unique member ID number for the subscriber | | `FirstName` | The subscriber’s first or given name | | `LastName` | The subscriber’s surname or family name | | `PrefName` | The subscriber’s preferred name | | `Address` | The subscriber’s street address | | `City` | The city that the subscriber lives in | | `State` | The state, province, or other subnational unit where the subscriber lives | | `PostalCode` | The subscriber’s postal code | | `MemPref` | The subscriber’s preferred outdoor activity | | `Plat` | A true or false value that indicates whether the subscriber is a platinum rewards member | ## Message Content This code example contains the message content for this lesson. ``` %%[ Var @memid, @fname, @lname, @prefname, @address, @zip, @mempref, @plat Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @postcode = PostalCode Set @mempref = MemPref Set @plat = Plat ]%% Hello %%= v(@fname) =%%! Here are your account details. First Name: %%= v(@fname) =%% Last Name:%%= v(@lname) =%% Preferred Name: %%= v(@prefname) =%% Address Address: %%= v(@address) =%% Postal Code: %%= v(@zip) =%% Member Preferences Shopping Preference: %%= v(@mempref) =%% Platinum Member: %%= v(@plat) =%% ``` If you’re new to AMPscript, it’s helpful to move through the AMPscript sample code line by line so that you can better understand how AMPscript works. ## AMPscript Block Opening Tag The example begins with `%%[`, which indicates the beginning of a block of AMPscript code. ## Variable Declaration The second line of the example begins with `Var`, followed by several names that begin with `@`. Each of these names is used as a variable later in the code example. The `@` sign is required at the beginning of each AMPscript variable. At this point, all of the variables have been declared, but the value for each one is `null`. ``` Var @memid, @fname, @lname, @prefname, @address, @zip, @mempref, @plat ``` ## Variable Assignments The next several lines begin with `Set`, followed by the name of one of the declared variables. These lines assign a value to each of the declared variables. The value of each variable is set to equal the corresponding column in the sendable data extension that this email targets. When the email is sent, the system retrieves the value in the specified column for each subscriber and assigns that value to the variable. ``` Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @postcode = PostalCode Set @mempref = MemPref Set @plat = Plat ``` ## AMPscript Block Closing Tag After the variable assignments is the string `]%%`. This string indicates the end of a block of AMPscript code. ## Message Text After the initial AMPscript block is closed, we see the first line of the message body. This line is the first that produces content that’s visible to the subscriber. This line contains the text `%%= v(@fname) =%%`. The `%%=` indicates the beginning of a string of inline AMPscript code, and the `=%%` indicates the end. Between these tags is the function `v(@fname)`. The [v() function](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-v.html) is a utility function that outputs the value of a variable. The function refers to the `@fname` variable. ``` Hello %%= v(@fname) =%%! Here are your account details. ``` When a subscriber receives an email that contains this code, their name appears in the text instead of the AMPscript code. ## Send a Test Email If you’re new to Marketing Cloud Engagement, see [Get Started with Email Studio](https://help.salesforce.com/s/articleView?id=mktg.mc_es_get_started_checklist_for_email_studio.htm) to learn more about creating an email. This lesson assumes that you’re familiar with creating an email and that you already set up Marketing Cloud Engagement to send emails. 1. In the Email Studio editor, paste the sample AMPscript into a content area. ![A sample message in the Email Studio content editor. The sample AMPscript code from this lesson is pasted into a content area in the message.](https://developer.salesforce.com/media/images/ampscript/mc-ampscript-guide-get-started-learning-lesson1-1.png) 1. When you finish editing the message content, click **Next**. 2. On the **Preview and Test** page, click the **Subscriber Preview** tab. 3. Click the folder icon. 4. Expand the **Data Extensions** folder, and then select a data extension that contains the data for your target subscribers. 5. Select a subscriber. When you send the email, that subscriber’s information is populated in the message body. ![The Subscriber Preview tab on the Preview and Send page. A folder structure on the left side shows an expanded folder labeled Data Extensions. Under that folder, a data extension called NTO Customer List is selected. A list of subscribers is shown on the right side of the page, and the third row of data is selected.](https://developer.salesforce.com/media/images/ampscript/mc-ampscript-guide-get-started-learning-lesson1-2.png) 7. On the Test Send tab, choose whether to send the test message to **Individuals** or to a **Test data extension**. If you choose to send to individuals, enter their email addresses. If you choose to send to a data extension, choose a testable data extension. 8. Click **Send Test**. 9. Review the test message. In the test message, the inline AMPscript code in the message body is replaced with subscriber data from the row you selected in the data extension. ![An image of the test email. The fields in the message, such as First Name and Last Name, are populated with values from the selected data extension.](https://developer.salesforce.com/media/images/ampscript/mc-ampscript-guide-get-started-learning-lesson1-3.png) # Get Started with AMPscript Development—Lesson 2 This lesson builds on [Lesson 1](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-get-started-learning-lesson-1.md), introducing you to more advanced AMPscript functionality. - Combining functions and variables - Dynamically changing the content of the message using `If`, `Else`, and `ElseIf` statements Northern Trail Outfitters (NTO), the fictitious company that we refer to in this lesson, has a sendable data extension that contains several pieces of information about their subscribers. | Data Extension Column Name | Description | | -------------------------- | ---------------------------------------------------------------------------------------- | | `MemberID` | A unique member ID number for the subscriber | | `FirstName` | The subscriber’s first or given name | | `LastName` | The subscriber’s surname or family name | | `PrefName` | The subscriber’s preferred name | | `Address` | The subscriber’s street address | | `City` | The city that the subscriber lives in | | `State` | The state, province, or other subnational unit where the subscriber lives | | `PostalCode` | The subscriber’s postal code | | `MemPref` | The subscriber’s preferred outdoor activity | | `Plat` | A true or false value that indicates whether the subscriber is a platinum rewards member | ## Message Content This code example contains the message content for this lesson. ``` %%[ Var @memid, @fname, @lname, @prefname, @address, @zip, @mempref, @plat, @greetingName Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @postcode = PostalCode Set @mempref = MemPref Set @plat = Plat Set @greetingName = Iif(Empty(@prefname),@fname,@prefname) ]%% Hello %%= v(@greetingName) =%%! Here are your account details. First Name: %%= v(@fname) =%% Last Name: %%= v(@lname) =%% %%[ if not Empty(@prefname) then ] %%Preferred Name: %%= v(@prefname) =%% %%[ endif ]%% Address: %%= v(@address) =%% City:%%= v(@city) =%% State: %%= v(@state) =%% Postal Code:%%= v(@postcode) =%% Shopping Preference: %%= v(@mempref) =%% Platinum Member: %%[ If @plat == "False" then ]%% %%= RedirectTo(Concat('http://example.com?s=',_subscriberkey)) =%% See if you're eligible %%[ ElseIf @plat == "True" ]%% Yes %%[ EndIf ]%% ``` This code resembles the example in [Lesson 1](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-get-started-learning-lesson-1.md), but includes some changes that further explore AMPscript functionality. ## Functions in Variable Assignments The AMPscript block at the beginning of the code example contains a new variable, `@greetingName`, with a value of `Iif(Empty(@prefname),@fname,@prefname)`. The [Iif()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-iif.html) function is a helpful tool for quickly evaluating a condition. When you use this function, you pass it a condition to test, followed by two values. If the condition is true, the function returns the first value. If the condition is false, the function returns the second value. ``` Set @greetingName = Iif(Empty(@prefname),@fname,@prefname) ``` In this case, the condition that we’re testing is `Empty(@fname)`. This condition calls another function, [Empty()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-empty.html). The `Empty()` function returns true if the specified value is null or an empty string. With one line of code, we called two functions and set the value of a variable based on the presence of subscriber data in a data extension. ## Preferred Name If-Else Statement Use [If statements](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-if-statements.md) to define more complex conditional logic in your AMPscript code. In our example, we use a basic `If` statement to test whether the subscriber has a preferred name that isn’t their first name. This condition uses the `not` operator and the `Empty()` function to test if the variable `@prefname` has a value—that is, the variable isn’t empty. If the subscriber has a preferred name, that value is included in the message. Otherwise, it’s omitted. ``` %%[ If not Empty(@prefname) then ] %%Preferred Name:%%= v(@prefname) =%% %%[ EndIf ]%% ``` When you use an `If` statement, you must denote the end of the statement by including an `EndIf` statement. ## Platinum Status If-ElseIf Statement The final section of AMPscript in the example performs another condition evaluation. Unlike the previous conditional evaluation, this one includes two tests. If the first condition is false, then the second condition is tested. In this section, the AMPscript code checks the value of the `@plat` variable for each subscriber—that is, it checks to see if they’re a platinum tier member. If they aren’t, they’re shown a link that they can click to learn more about the benefits of being a platinum member. If they’re a platinum member, they see a confirmation of their status. ``` Platinum Member: %%[ If @plat == "False" then ]%% %%= RedirectTo(Concat('http://example.com?s=',_subscriberkey)) =%% See if you're eligible %%[ ElseIf @plat == "True" ]%% Yes %%[ EndIf ]%% ``` ## Test Multiple Variations When you use AMPscript in your messages to perform conditional evaluation, it’s important to send test messages that cover as many conditions as possible. Choose multiple subscribers from your data extension and send yourself test messages that contain their data. Carefully compare the messages to make sure that the conditional evaluations were performed as expected. This image shows how the email appears to a subscriber who has a preferred name, and who is a platinum rewards member. ![An example email that includes the Preferred Name field. Next to Platinum Member, it says “Yes.”](https://developer.salesforce.com/media/images/ampscript/mc-ampscript-guide-get-started-learning-lesson2-1.png) A subscriber who doesn’t have a preferred name and who isn’t a platinum member sees a version of the email that resembles this example. ![An example email that doesn’t include the Preferred Name field. Next to Platinum Member, there’s a link that says “See if you're eligible.”](https://developer.salesforce.com/media/images/ampscript/mc-ampscript-guide-get-started-learning-lesson2-2.png) # Get Started with AMPscript Development—Lesson 3 This lesson builds on [Lesson 2](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-get-started-learning-lesson-2.md) by adding this advanced functionality: - Looking up content in a data extension - Using information from the row to populate multiple fields in the email - Using error checking to handle unexpected data In addition to the sendable data extension that we used in previous lessons, this lesson refers to a data extension called ShipTime, which contains the columns in this table. | Data Extension Column Name | Description | | -------------------------- | ------------------------------------------------------------------------------ | | `PostalCode` | A postal code | | `City` | The city associated with the postal code | | `State` | The state, province, or other subnational unit associated with the postal code | | `ShipTime` | The amount of time required to ship items to the postal code | Our fictitious company, Northern Trail Outfitters (NTO), uses this data extension to look up each subscriber’s city and other location details based on their postal code. The company also uses this data to provide subscribers with an estimated shipping time based on their location. ## Message Content This code example contains the message content for this lesson. ``` %%[ Var @memid, @fname, @lname, @prefname, @address, @city, @state, @postcode, @mempref, @plat, @rows, @row, @ship Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @postcode = PostalCode Set @mempref = MemPref Set @plat = Plat ]%% %%[ if not empty(@prefname) then ]%% %%= v(@prefname) =%% %%[ else ]%% %%= v(@fname) =%% %%[ endif ]%%, below are your account details %%[ if not Empty(@prefname) then ]%% %%[ endif ]%% /* Use the postal code to look up the city, state, and shipping time. */ %%[ If not Empty(@postcode) then /* Find the postal code in the ShipTimes Data Extension */ Set @rows = LookupRows("ShipTimes","PostalCode",@postcode) /* Make sure exactly one row of data was found */ if RowCount(@rows) == 1 then /* Set the row - This now exposes all columns to our variable */ Set @row = Row(@rows,1) /* Set the City */ Set @city = Field(@row,"city") /* Set the State */ Set @state = Field(@row,"state") /* Set the @ship variable to the ShipTime column */ Set @ship = Field(@row,"ShipTime") EndIf EndIf ]%%
First Name: %%= v(@fname) =%% Last Name: %%= v(@lname) =%%
Preferred Name: %%= v(@prefname) =%%
Address: %%= v(@address) =%%City: %%= v(@city) =%%
State: %%= v(@state) =%% Postal Code: %%= v(@postcode) =%%
%%[ If not Empty(@ship) then ]%% Shipping Time: %%= v(@ship) =%% %%[ If @ship > 1 then ]%% days %%[ Else ]%% day %%[ EndIf ]%% %%[ EndIf ]%%  
Shopping Preference: %%= v(@mempref) =%% Platinum Member: %%[ if @plat == "False" then ]%% See if you're eligible %%[ Else ]%% %%= v(@plat) =%% %%[ EndIf ]%%
``` ## Data Extension Lookup The block of AMPscript code under the Address field uses the `@postcode` variable to find the subscriber’s city, state, and estimated shipping time. It performs this lookup using the [LookupRows()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-lookup-rows.html) function to find the row in the ShipTimes data extension, for which the value in the PostalCode column equals the value of the `@postcode` variable. The `LookupRows()` function returns all rows that meet these criteria. The code example saves this data in the variable `@rows`. ``` %%[ If not Empty(@postcode) then /* Find the postal code in the ShipTimes Data Extension */ Set @rows = LookupRows("ShipTimes","PostalCode",@postcode) ``` ## Count the Number of Matching Rows from the Data Extension We assume that only one row in the data extension contains the specific postal code value. We use the [RowCount()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row-count.html) function to make sure that the variable only contains a single row of data. ``` /* Make sure exactly one row of data was found */ if RowCount(@rows) == 1 then ``` ## Parse Data from the Matching Row If the `RowCount()` function confirms that the `@rows` variable contains a single row of data, we set the variable `@row` to equal that row. ``` /* Set the row - This now exposes all columns to our variable */ Set @row = Row(@rows,1) ``` Now that we have a single row of data, we use the [Field()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-field.html) function to parse the data fields from that row. We set the value of the `@city` variable to equal the value found in the city column of the matching row and the `@state` value to equal the value in the state column. We also set a new variable, `@ship`, to equal the value found in the ShipTime column. ``` /* Set the City */ Set @city = Field(@row,"city") /* Set the State */ Set @state = Field(@row,"state") /* Set the @ship variable to the ShipTime column */ Set @ship = Field(@row,"ShipTime") EndIf ]%% ``` # Get Started with AMPscript Development—Lesson 4 This lesson expands on [Lesson 3](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-get-started-learning-lesson-3.md), exploring advanced AMPscript topics. - Using For loops - Dynamically changing the appearance of a message using AMPscript - Filtering message context In addition to the sendable data extension and ShipTime data extension from the previous lessons, this example refers to a data extension that contains information about a subscriber’s purchase history. ## Message Content This code example contains the message content for this lesson. ``` %%[ Var @memid, @fname, @lname, @prefname, @address, @city, @state, @postcode, @mempref, @plat, @rows, @row, @ship, @shipDays Set @memid = MemberID Set @fname = FirstName Set @lname = LastName Set @prefname = PrefName Set @address = Address Set @postcode = PostalCode Set @mempref = MemPref Set @plat = Plat ]%% /* Address the subscriber by their preferred name, if they have one. Otherwise, use their first name. */ Hello %%= Iif(Empty(@prefname), @fname, @prefname) =%%, here are your account details. Name First Name:%%= v(@fname) =%% Last Name:%%= v(@lname) =%% /* Include the PrefName field if it's populated. */ %%[ If not Empty(@prefname) then ]%% Preferred Name:%%= v(@prefname) =%% %%[ EndIf ]%% Address Address:%%= v(@address) =%% %%[ /* Check to see if the postal code field is populated. */ If not Empty(@postcode) then /* Find the postal code in the ShipTimes Data Extension */ Set @rows = LookupRows("ShipTimes","postcode",@postcode) /* Count the number of rows returned to make sure that there's only one match. */ If RowCount(@rows) == 1 then /* Expose all columns in the matching row to the @row variable. */ Set @row = Row(@rows,1) /* Set the @city variable to the value in the city column of the matching row. */ Set @city = Field(@row,"city") /* Set the @state variable to the value in the state column. */ Set @state = Field(@row,"state") /* Set the @ship variable to the value in the ShipTime column. */ Set @ship = Field(@row,"ShipTime") EndIf EndIf ]%% City:%%= v(@city) =%% State:%%= v(@state) =%% Postal Code:%%= v(@postcode) =%% %%[ /* If we found a shipping time, show it. */ If not Empty(@ship) then /* Iif(@ship > 1, Concat(@ship, " days"), Concat(@ship, " day")) ]%% Shipping Time: %%= v(@shipDays) =%% %%[ Else ]%% /* A shipping estimate wasn't available. */ We couldn't find a shipping preference. Update %%= RedirectTo(Concat('http://example.com?s=',_subscriberkey)) =%% update your profile. %%[ EndIf ]%% Member Preferences Shopping Preference: %%= v(@mempref) =%% /* Check the subscriber's platinum status and show the appropriate message. */ Platinum Member: %%[ If @plat == "N" then ]%% %%= RedirectTo(Concat('http://example.com?s=',_subscriberkey)) =%% Sign-Up %%[ Else ]%% %%= v(@plat) =%% %%[ EndIf ]%% Recent Purchases %%[ /* Declare additional variables for products. */ Var @prodID, @prodName, @prodDesc, @price, @indicator, @color, @totalPurchases, @decimalChar /* Set the total purchases to zero. */ Set @totalPurchases = 0 /* Set the CSS color indicator to odd. */ Set @indicator = "odd" /* Find all of the recent purchases for the current subscriber. Set the @rows variable to contain the resulting rowset. */ Set @rows = LookupRows("Purchases", "MemberID", @memID) /* Make sure that the lookup returned at least one row of products. */ If RowCount(@rows) >= 1 then /* Use a For loop to step through each row in the rowset. */ For @i = 1 to RowCount(@rows) do /* Set the @row variable to contain the data in the current row. */ Set @row = Row(@rows, @i) /* Set the product variables to equal the values in the current row. */ Set @prodID = Field(@row, "ProductID") Set @prodName = Field(@row, "ProductName") Set @prodDesc = Field(@row, "Description") Set @price = Field(@row, "Price") Set @totalPurchases = Add(@totalPurchases, Field(@row, "Price")) /* If the value of the indicator variable is "odd", use a white background color. After setting the color, change the indicator to "even".*/ If @indicator == "odd" then Set @color = "#FFFFFF" Set @indicator = "even" /* If the value of the indicator variable is "even", use a gray background color. After setting the color, change the indicator to "odd". */ Else Set @color = "#EEEEEE" Set @indicator = "odd" EndIf /* Bring in a content area to contain the recent purchase list. */ ]%% %%= TreatAsContent(ContentBlockByName("Content Builder\RecentPurchases")) =%% %%[ /* Go to the next row in the rowset. */ Next @i /* Determine if there are two characters after the decimal point. */ Set @decimalChar = Subtract(Length(@totalPurchases),IndexOf(@totalPurchases,".")) /* Handle the case where there's one character after the decimal point. */ If @decimalChar == 1 then Set @totalPurchases = Concat(@totalPurchases,"0") /* Handle the case where there's no decimal point. */ ElseIf @decimalChar == Length(@totalPurchases) then Set @totalPurchases = Concat(@totalPurchases,".00") EndIf ]%% Total Purchases:$%%= v(@totalPurchases) =%% %%[ EndIf ]%% ``` ## Create New Variables The first part of this code example is similar to the example in lesson 3. However, the second part inserts information about the subscriber’s previous purchases and total amount spent into the email. First, the code creates a set of variables to use in inserting product and price information into the email. ``` /* Declare additional variables for products. */ Var @prodID, @prodName, @prodDesc, @price, @indicator, @color, @totalPurchases, @decimalChar ``` Next, the code assigns values to the `@totalPurchases` and `@indicator` variables. The `@totalPurchases` variable stores the amount of the subscriber’s total purchases. The `@indicator` variable alternates the background color for each purchase. ``` /* Set the total purchases to zero. */ Set @totalPurchases = 0 /* Set the CSS color indicator to odd. */ Set @indicator = "odd" ``` ## Look Up Data in a Data Extension The code consults the Purchases data extension to find all of the subscriber’s previous purchases based on their member ID. ``` Set @rows = LookupRows("Purchases", "MemberID", @memID) ``` The `@rows` variable is set to the resulting rowset. ## Use a For Loop to Iterate through the Rowset If there aren’t any rows in the rowset, it means that there isn’t any purchase data to display. We want to be sure that the rowset contains at least one row, so we use the [RowCount()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row-count.html) function. ``` If RowCount(@rows) >= 1 then ``` Next, the code uses a [For loop](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/language-basics/mc-ampscript-guide-language-basics-for-loops.md) to step through the rowset that we obtained from the data extension. The For loop repeats an equal number of times to the number of rows in the rowset. ``` For @i = 1 to RowCount(@rows) do ``` The [row()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row.html) function obtains the data in all of the columns in the current row. ``` Set @row = Row(@rows, @i) ``` In each row, we use the [Field()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-field.html) function to set the values of the product variables. We also use the [Add()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-add.html) function to keep a running total of the amount of money the subscriber spent on their purchases. ``` Set @prodID = Field(@row, "ProductID") Set @prodName = Field(@row, "ProductName") Set @prodDesc = Field(@row, "Description") Set @price = Field(@row, "Price") Set @totalPurchases = Add(@totalPurchases, Field(@row, "Price")) ``` ## Change the Appearance of Each Row The cod sets the background color for the current row to white or gray depending on the background color of the previous entry. Odd-numbered entries have a white background, and even entries have a gray background. ``` If @indicator == "odd" then Set @color = "#FFFFFF" Set @indicator = "even" /* If the value of the indicator variable is "even", use a gray background color. After setting the color, change the indicator to "odd". */ Else Set @color = "#EEEEEE" Set @indicator = "odd" EndIf ``` ## Apply the Content to a Contact Area The code uses the [ContentBlockByName()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.html) function to retrieve an existing content block. The purchase data is formatted in the same manner as the content block. ``` %%= TreatAsContent(ContentBlockByName("Content Builder\RecentPurchases")) =%% ``` The code then instructs the For loop to proceed to the next row. ``` %%[ Next @i ]%% ``` ## Format the Currency Value The final part of the code makes sure that the numerical value in the `@totalPurchases` variable contains exactly two decimal places. It starts by determining the current number of decimal places by using the [IndexOf()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-index-of.html), [Length()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-length.html), and [Subtract()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-math/mc-ampscript-reference-math-subtract.html) functions. - The `IndexOf(@totalPurchases,".")` function returns the position in the value of the `@totalPurchases` variable where a decimal point (.) character occurs. If the variable doesn’t contain a decimal point, the function returns `0`. - The `Length(@totalPurchases)` function returns the number of characters in the value of the `@totalPurchases` variable. - The `Subtract(...)` function returns the result of subtracting the value returned by the `IndexOf(...)` function from the value returned by the `Length(...)` function. ``` Set @decimalChar = Subtract(Length(@totalPurchases),IndexOf(@totalPurchases,".")) ``` If the resulting value of this computation is `1`, it means that the value of the `@totalPurchases` contains a decimal point followed by one digit. Because we want to show the subscriber a currency value with two decimal places, we use the [Concat()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-concat.html) function to add a zero to the end of the value. ``` If @decimalChar == 1 then Set @totalPurchases = Concat(@totalPurchases,"0") ``` If the value of the `@decimalChar` variable equals the number of characters in the value of the `@totalPurchases` variable, it means that the `@totalPurchases` didn’t contain a decimal point. In this case, we can use the `Concat()` function to add a decimal point followed by two zeros. ``` ElseIf @decimalChar == Length(@totalPurchases) then Set @totalPurchases = Concat(@totalPurchases,".00") EndIf ``` # Get Started with Einstein Content Selection REST API Use this API to manage Einstein Content Selection assets, profiles, and configuration. Use the API for use cases that aren't possible using the Einstein Content Selection user interface or the CSV file batch import option. - A sports news service now can add content to Einstein Content Selection every time a new story is posted to its site. - A marketer can push assets from a digital asset management platform to Einstein Content Selection using the API. - Users can update subscriber profiles in Einstein Content Selection at the moment they change their attribute values, such as a location change or a preferred product category change. **See Also** [_Salesforce Help_: Einstein Content Selection](https://help.salesforce.com/s/articleView?id=mktg.mc_pb_einstein_content_selection.htm) Rights of ALBERT EINSTEIN are used with permission of The Hebrew University of Jerusalem. Represented exclusively by Greenlight. # Get Started with Engagement Mobile SDK Engagement Mobile SDK is a framework designed to allow future enhancements to performance, developer experience, functionality, and troubleshooting. Formerly known as Mobile SDK, it now unites two modules, MobilePush and Salesforce Data Cloud. This evolutionary step is more modular and extensible, allowing you to choose the specific functionality that you need. By using a single set of SDK methods and sharing Analytics and Identity, your implementation is streamlined across Salesforce. Events tracked within MobilePush can be used in Salesforce Data Cloud, and vice versa. The SDK also supports Template events, which are predefined schemas that you can implement to track your customers’ actions in your app. Use them to trigger in-app messages, and enter a customer into a Journey based on their activity within your mobile app. ## Prerequisites - Android requires a minimum API version of 21 - iOS requires a minimum deployment target of 10.0 ## Implementation - For the MobilePush Module, see: - [Marketing Cloud Engagement SDK Android](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/) - [Marketing Cloud Engagement SDK iOS](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/) - For the Salesforce Data Cloud Module, see [Engagement Mobile SDK](https://developer.salesforce.com/docs/atlas.en-us.c360a_api.meta/c360a_api/c360a_api_engagement_mobile_sdk.htm). ### Considerations for Implementing Both MobilePush and Data Cloud Modules If implementing both the MobilePush and Data Cloud modules, there are a few considerations while implementing the SDK during the initialization, and device and contact registration. **Initialization** From MobilePush v8.0.0 onwards, if you're also implementing the Data Cloud module, add the `cdpModuleConfig` along with the `pushModuleConfig` in the configure method. Android code example ```javascript fun initSalesforce(context: Context, pushConfig: MarketingCloudConfig, cdpConfig: CdpConfig) { SFMCSdk.configure(context, SFMCSdkModuleConfig.build { pushModuleConfig = pushConfig cdpModuleConfig = cdpConfig }) { // success/failure } } ``` iOS code example ```javascript func initSalesforce(pushConfig: PushConfig, cdpConfig: CdpConfig) { SFMCSdk.initializeSdk(ConfigBuilder() .setPush(config: pushConfig, onCompletion: { result in // success/failure }) .setCdp(config: pushConfig, onCompletion: {result in // success/failure }) .build()) } ``` **Device and Contact Registration** From MobilePush v8.0.0 onwards, if you're also implementing the Data Cloud module, add the specific module information to the `setProfileID` and `setProfileAttribute` methods. Android code sample ```js fun updateIdentity(user: User) { SFMCSdk.requestSdk { // explicitly set the profile for both PUSH & Data Cloud (CDP) it.identity.setProfile(user.email, user.favorites, ModuleIdentifier.PUSH, ModuleIdentifier.CDP) } } ``` iOS code sample ```js func updateIdentity(email: String) { SFMCSdk.identity.setProfileId(email, [.cdp, .push]) } ``` ## See Also - [Salesforce Help: Mobile Push](https://help.salesforce.com/s/articleView?id=mktg.mc_mp_mobilepush.htm) # Get Started with Event Notification Service To begin using Event Notification Service (ENS), complete the prerequisites, and then configure your system to receive notifications. ## Prerequisites [Set up your development environment](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-getting-started/get-started-index.md) to use Marketing Cloud Engagement APIs. Next, in Installed Packages, [create an API integration](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/api-integration.md) to get a client ID and client secret. Use these permission settings for the API integration: - **Event Notifications | Callbacks**: Read, Create, Update, Delete - **Event Notifications | Subscriptions**: Read, Create, Update, Delete **important:** Store your client ID and secret securely. Never hard-code these values into your apps or integrations. ## Set Up the Event Notification Service API 1. Supply an HTTPS callback URL, also known as a webhook, for your application. 2. [Register](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createCallback.md) and [verify](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/verifyCallback.md) your callback URL. 3. [Create a subscription](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createSubscription.md) that requests notification events. A subscription indicates which event types to receive notifications for and which callback URL to receive them on. 4. Prepare your system for the possibility of receiving a notification event more than one time. ENS delivers notifications at least one time per event. To stop receiving notifications, pause the subscription. If you resume the subscription, ENS delivers only the event notifications that are generated after you resumed the subscription. ## Related Items - _Knowledge Article_: [Salesforce IP Addresses and Domains to Allow](https://help.salesforce.com/s/articleView?id=000384438&type=1) - _Salesforce Help_: [Event Notification Service](https://help.salesforce.com/articleView?id=mktg.mc_overview_ens.htm) # Get Started with Marketing Cloud Engagement APIs and Programmatic Languages Use the APIs to create apps that integrate with Marketing Cloud Engagement, or build custom apps and components on top of Marketing Cloud Engagement. **tip:** If you're new to REST APIs, start with the [Marketing Cloud Engagement APIs](https://trailhead.salesforce.com/content/learn/modules/marketing-cloud-apis) module on Trailhead. ## Packages A package is your starting point for all developer activity. Create packages to connect to the API. You can also extend Marketing Cloud Engagement with packages containing custom apps or custom Journey Builder activities and events. Your organization or business partners build these customizations, or they’re installed from AppExchange. See [Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/packages-overview.md). ## APIs Marketing Cloud Engagement offers a REST and SOAP API that share a common authentication mechanism based on OAuth 2. Use these APIs to interact with these features. - Tracking - Subscribers and lists - Programs - Triggered sends - Content - Contacts - Journey Builder - Mobile Connect - MobilePush - Campaigns See [Marketing Cloud Engagement APIs](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-apis/rest-api-overview.md). ## Programmatic Languages Marketing Cloud Engagement includes scripting languages to personalize landing pages, create applications, construct cross-channel templates or layouts, and work with messaging functions. See [Programmatic Marketing Content](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-programmatic-content/programmatic-content-overview.md). # Get Started with Marketing Cloud Next This developer guide describes API functionality in Marketing Cloud Next. If you can’t access the features in this guide, contact [Salesforce Customer Support](https://help.salesforce.com/s/articleView?id=000384365&type=1). Marketing Cloud Next brings the power of the Salesforce platform to your organization’s marketing efforts. Work with Salesforce leads and contacts, create campaigns and flows, and integrate with Data 360 to load and harmonize data from multiple sources. **note:** The product formerly called Marketing Cloud is now called Marketing Cloud Engagement. Marketing Cloud Next, Marketing Cloud Engagement, and Marketing Cloud Account Engagement use different APIs that aren’t compatible with each other. For more information about developing for Marketing Cloud Engagement, see [Marketing Cloud Engagement APIs and Programmatic Languages](https://developer.salesforce.com/docs/marketing/marketing-cloud/overview). For more information about developing for Marketing Cloud Account Engagement, see [Account Engagement API](https://developer.salesforce.com/docs/marketing/pardot/overview). ## Learn About Development for Marketing Cloud Next Learn when, why, and how to use Salesforce APIs. - [Which APIs Should I Use?](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-connect-apis/mc-connect-apis-info.md) - [View Training Resources](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-resources/mc-resources-trailhead.md) - [Watch Developer Videos](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-resources/mc-resources-videos.md) ## Configure Your Org Various admins are required to configure Marketing Cloud Next, including a Salesforce admin, a Data Cloud Architect, and an optional marketing admin. - [Configure your Marketing Cloud Next Org](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-administration/mc-administration.md) ## Set Up Your Development Environment To interact with Marketing Cloud Next using APIs, configure your development environment. - [Connect to Salesforce APIs](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-connect-apis/mc-connect-apis.md) - [Set Up Salesforce Development Tools](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-resources/mc-resources.md) ## Manage Data and Assets After you connect to an API, you’re ready to start managing your data and assets. - [Manage Objects](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-manage-objects/mc-manage-objects.md) - [Manage Content](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-manage-content/mc-manage-content.md) - [Explore Reference Content](/docs/marketing/marketing-cloud-growth/references) - [Review Security Best Practices](https://developer.salesforce.com/docs/marketing/marketing-cloud-growth/mc-security.md) # Get Started with the Journey Builder API ## Prerequisites To integrate with Journey Builder programmatically, you must first obtain an authentication token. 1. To get a client ID and secret, create an installed package with an API Integration component. 2. Using the above credentials, get an OAuth access token for authenticating your API calls. 3. Use the access token in the header to authenticate each subsequent call. ## Use the Journey Builder API 1. [Create a sendable data extension](/docs/marketing/marketing-cloud/references/mc-custom_objects?meta=createDataExtension). 2. [Create an event definition](/docs/marketing/marketing-cloud/references/mc_rest_interaction/createEventDefinition.html). The event definition determines entry settings for the journey, controlling who gets in and when. Use the sendable data extension created in step 1 as the entry source. If using a custom application for Journey Builder functionality, you can also define an entry event via the API using the POST /eventDefinitions resource. 3. [Build the journey](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.md). Use the Journey Specification to build out the JSON of your journey. - Define the activities. Activities determine the pace and content of contact messaging and data updates as the journey executes. Marketers create a chain of activities by dragging and dropping activities onto the Canvas. - Define a goal (optional). A goal measures the journey's effectiveness. 4. [Publish the journey](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/postPublishInteractionById.md). Once a journey is active, Marketing Cloud Engagement continually evaluates Contacts using the entry event criteria to determine if a journey should be invoked. 5. [Fire an entry event](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/how-to-fire-an-event.md). A journey begins when the event it is configured to detect occurs. Use the event definition key created for the event definition in step 2. ## Related Items - [Get a Client ID and Secret](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/api-integration.md) - [Server-to-Server Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-s2s-client-credentials.md) - [Web and Public App Integrations](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/integration-app-auth-code.md) - [API Specification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/jb-api-specification.md) - [Event Definition Overview](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/event-definition-key.md) # Get Started with the Journey Specification The Journey Specification is a structured JSON representation of a single journey in Journey Builder. The Journey Spec is used via REST API requests to the Marketing Cloud Engagement interaction service. The Journey spec provides developers with a structural syntax to programmatically compose journeys. It also allows Journey Builder engineers to rapidly create a robust ecosystem of Journey Builder functionality. Importantly, the Journey Spec guarantees that all changes to a journey are atomic, which prevents partial data corruption. ## Structure The Journey Spec is represented using a JSON serialized string. Journey, event, activity, and goals are the four (4) primary object properites the specification makes available: - Journey: (sometimes called interaction) The **core** object, without this object you are unable to create any other properties of a journey using the spec. - Event: This is called a `trigger` in the Journey Spec and determines entry settings for the journey. - Activity: Instead of separating Waits, Activities, Exits, and so on, the Journey Spec calls all of these activities. Outcomes are used to map one activity to the next activity in the flow of a journey, once the current activity has completed. - Goal: This object is how Journey Builder can provide information about the success of a journey. Using the primary objects of the Journey Spec, you can create extremely complex journeys using just a text editor and a REST client. ## Important considerations about the Journey Spec hierarchy - The trigger contains the eventDefinitionKey of the entry event that will trigger this journey. There can only be a single entry event. - There is no start activity. The first activity is the activity which has no preceding activity. It is generally the first one in the list of activities. - There is no end activity. Endings or exits are denoted by an outcome with a `next` value of null. Contacts will be ejected from the journey when they reach that outcome. - The goal is unique and isn’t an activity. - Journey keys must be unique within a MID. - Activity keys must be unique within a journey. - Arguments may contain expressions to be processed by the engine using Data Binding. Use the Mustache template language to write these expressions. These expressions can access data that are available in the journey context (e.g. contact data) or data that are the output of a previous activity. - Outcomes will be an array of outcome objects on the activity. The outcome object(s) will denote the next activity/activities. ## Journey Object The journey object has the following properties: - `id` - A unique identifier for this journey that is generated and assigned by the journey API during creation. Read-only. - `version` - This number denotes the iteration of this particular journey. Read-only. - `key` - Required. The customer key (also a unique identifier within the MID) for this journey. This is defined by the developer and can be used to address this journey in most API calls. - `name` - Required. The display name used in the Journey Builder UI for this journey. This value is visible to every user of your Marketing Cloud Engagement account. You can also use this value as a filter with the `nameOrDescription` query parameter. - `description` - A human readable description of this journey that informs others of purpose. You can also use this value as a filter with the `nameOrDescription` query parameter. - `workflowApiVersion` - Required. Represents the current release of the Journey Spec. - `goals` - An array of `goals` containing a single object. Journeys only support one goal. - `triggers` - An array of `triggers` containing a single object. Journeys only support one trigger. - `defaults` - An object that contains an ordered list of email expressions used to determine which email address to use as the default. - `activities` - An array that includes all the activities of the journey. ## Example Journey Object ```js // If you are just building the JSON to use in an API request, use the following syntax. This object contains the required properties to create any journey in Journey Builder. { "key": "a-key-that-is-unique-for-MID", "name": "This is my first journey", "description": "This is a description of my journey.", "defaults": { "email": [ "{{Event.event-key.EmailAddress}}", "{{Contact.Default.Email}}" ] }, "workflowApiVersion": 1.0 } // To reference the journey later, perhaps for an AJAX request, the following format for creating a journey Object might be more useful. // In JavaScript, this is a variable named 'myInteraction' whose value is an **empty object**. var myInteraction = {}; // This is an alternative syntax for adding attributes to an object along with their respective properties (just for your reference). myInteraction.key = "a-key-that-is-unique-for-MID"; myInteraction.name = "This is our first journey"; myInteraction.description = "This is a description of my journey."; myInteraction.workflowApiVersion = 1.0; myInteraction.version = 1; myInteraction.triggers = []; myInteraction.defaults = []; myInteraction.activities = []; myInteraction.goal = []; ``` ## Event Object An event (called `trigger` in the Journey Spec) is an object on the journey Object that determines the entry settings for the journey. The recommended `type` for events fired via the API and for custom events is `Event`, which uses the contact model and an optional expression to determine when contacts should enter the journey. The Event object has the following properties: - `key` - The key used to identify the entry event. - `name` - The display name for the entry event. - `type` - The type of entry event. The only supported value is `event`. - `eventDefinitionKey` - The key used to filter appropriate events into filter for evaluation on entry into the journey. Do not include a period in the event definition key. - `arguments` - Represents the arguments this event expects to be passed. This property is intended to be used at runtime. - `configurationArguments` - Represents the arguments this particular event expects to be passed. This property is intended to be used at publish and runtime. - `criteria` - An XML string that represents the contact filter critieria. ```js // This is the format of an Event (trigger) object (outside of the journey Object). { "key": "event-key", "name": "Starting point for the journey", "type": "Event", "eventDefinitionKey": "my-entry-event-key", "arguments": {}, "configurationArguments": {}, } // The Event object can be plugged in to the Journey Spec like this: { "key": "a-key-that-is-unique-for-MID", "name": "This is our first journey", "description": "We are using this journey to learn how to use the Journey Spec in Journey Builder", "workflowApiVersion": 1.0, "triggers": [ { "key": "event-key", "name": "Starting point for the journey", "type": "Event", "eventDefinitionKey": "my-entry-event-key", "arguments": {}, "configurationArguments": {}, } ] } ``` ## Activity Objects Activity Objects represent nearly every object type in the Journey Spec, with the exceptions of goals and events. - [Email](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/send-email.md) - [MultiCriteriaDecision](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/decision-split.md) - [RandomSplit](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/random-split.md) - [EngagementSplit](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/engagement-split.md) - [DataExtensionUpdate](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apidata-extension-update.md) - [Rest](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rest.md) - [Wait](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/wait.md) The Activity object has the following properties: - `id` - The unique ID for the activity. - `key` - The unique customer key for the activity. - `name` - The display name for this activity. - `type` - Defines the activity type. The expected input for each activity must be passed as an argument to operate correctly. - `outcomes` - An array of `outcome` objects. - `key` - The unique customer key for the outcome. - `next` - A string that maps to a valid journey activity key. - `arguments` - An object that represents the arguments that the activity expects to be passed at runtime. Each activity type requires a different set of parameters. - `configurationArguments` - An object that represents the arguments that the activity expects to be passed at publish and runtime. Each activity type requires a different set of parameters. ```js // This is the format of an activity object (outside of the array and journey object). { "key": "activity-key", "name": "The display name for the activity", "type": "[one of the supported activity types]", "outcomes": [], "configurationArguments": {}, "arguments": {}, "metaData": {} } // Outcomes and configurationArguments are addressed in the Activity Outcome Objects section. // The activity object can be plugged in to the Journey Spec like this: { "key": "a-key-that-is-unique-for-MID", "name": "This is our first journey", "description": "We are using this journey to learn how to use the Journey Spec in Journey Builder", "workflowApiVersion": 1.0, "activities": [ { "key": "activity-key", "name": "The display name for the activity", "type": "[one of the supported activity types]", "outcomes": [], "configurationArguments": {}, "arguments": {}, "metaData": {} } ] } ``` ## Activity Outcome The outcome objects provide some context for decision activities in determining which outcome they should select from the array. For example, on a `RandomSplit` the arguments are used to determine the likelihood that each contact has of traversing each outcome. Here is an example of an activity outcome: ```js // Please note that the arguments attribute is [optional] on some activities and required by others. { "next": "the-key-of-the-next-activity-to-start-when-this-activity-is-done", "arguments": { "someKey": "someValue" } } ``` ## Goal Object The goal object is used to measure effectiveness of an associated journey. Goals are only evaluated via their criteria / Filter XML. The goal object has the following properties: - `name` - The display name for this goal. - `key` - The customer key for this goal. - `type` - The type of goal this is (only option currently is ContactEvent). - `description` - The description for this goal, will be displayed in the Journey Builder user interface. - `metaData` - A set of properties that aren’t specific to the definition or execution of this Event but are related to it. - `conversionUnit` - This value is used for deterministic evaluations of the goal, can be either "percentage" or "wholenumber". - `conversionValue` - Based on the conversionUnit this is the metric Journey Builder uses to determine if the goal has been satisfied. ```js // This is the format of a Goal object (outside of the journey object). { "key": "goal-key", "name": "Our success metric", "description": "This goal determines the success of the journey", "type": "ContactEvent", "arguments": {}, "configurationArguments": { "criteria": "" }, "metaData": {} } // The Goal object can be plugged in to the Journey Spec like this: { "key": "a-key-that-is-unique-for-MID", "name": "This is our first journey", "description": "We are using this journey to learn how to use the Journey Spec in Journey Builder", "workflowApiVersion": 1.0, "goals": [ { "key": "goal-key", "name": "Our success metric", "description": "This goal determines the success of the journey", "type": "ContactEvent", "arguments": {}, "configurationArguments": {}, "metaData": {} } ] } ``` Using the above JSON, we could make a PUT request to Journey Builder and update our original journey with this new goal. ## Related Items - [How Data Binding Works](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/how-data-binding-works.md) - [Mustache Template Language](http://mustache.github.io/) - [Journey Specification Example](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/reference.md) - [Goal Format](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/goals.md) # Get Started with the SOAP Web Services API Use these topics to connect your development environment to SOAP API and get sample code for common API scenarios. - [Authenticate your SOAP API calls](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/authenticate-soap-api.md). The first step in an API-based integration is authenticating your calls. OAuth access token authentication is the most secure way to authenticate SOAP API calls. - [WSDL and endpoint links](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/wsdl-endpoint-links.md). When connecting to the SOAP API, use the correct WSDL links and endpoints for your stack. # Get the Fields Available for Retrieval To identify what kind of information is returned on a Retrieve call for an object, get the fields that are available for that object. The Retrievemethod takes a list of properties to retrieve on a given object. To build a dynamic list of retrievable properties, use the Describe call and filter out the retrievable fields using the IsRetrievable property. Use the Describe method when building your integration. However, don't use this call before every Retrieve call. These values are fairly static, so it isn’t necessary to retrieve them frequently. ## Usage Examples This sample SOAP envelope shows how to retrieve information about the fields for the [SentEvent](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sentevent.md) object. ```xml Describe https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN SentEvent ``` The response contains the names, data types, and other information about the fields in the specified object. ```xml DescribeResponse urn:uuid:98699d0e-c48e-4fc1-ac6a-5b516example urn:uuid:c85ffd1e-5266-4414-86fe-c0c48example http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2026-04-17T23:05:14Z 2026-04-17T23:10:14Z SentEvent SendID Int32 true true false SubscriberKey String true true false EventDate DateTime true true false Client.ID Int32 false true false EventType EventType true true true BatchID Int32 true true false TriggeredSendDefinitionObjectID String true true false ListID Int32 false true false PartnerKey String true true false SubscriberID Int32 false true false 3548176b-92c2-46ba-9ebc-8ab71example ``` ## Related Items - [Retrieve Method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve.md) - [Describe Method](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/describe.md) # GetAttributeValue Returns the value from a specified attribute or sendable data extension field. ## Syntax `GetAttributeValue(1)` | Ordinal | Type | Description | | ------- | ------ | ---------------------------------------------------------------------------------- | | 1 | string | Required. The attribute or sendable data extension field to retrieve the value of. | ## Example This example retrieves the email address for a contact and outputs the value to the browser. ```js ``` # GetCookieValue ## Overview Retrieves information from specified cookies ### Syntax GetCookieValue(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | -------------- | | **1** | string | **Required** | Name of cookie | ## Example ``` ``` # GetFormField ## Overview Retrieves information from specified form fields, such as data included in POST requests ### Syntax GetFormField(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------ | | **1** | string | **Required** | Name of field for the specified data | ## Example ``` ``` # GetFormField ## Overview Pulls back form field information POSTed to the page based on a specified key ### Syntax GetFormField(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------ | | **1** | string | **Required** | Key value used to identify applicable form field | ## Members You can retrieve member values using these strings: - ApplicationID - PackageID - ApplicationBaseURL - URL - PagePath - Method ## Example This sample code requests a form field based on the supplied key: ``` Request.GetFormField("bar"); ``` This sample code provides examples of how to call a member: ``` var requestURL = Request.URL(); var requestMethod = Request.Method(); ``` **note:** You must escape all HTML form field information. # GetJWT() Creates a JSON Web Token (JWT) for a JSON payload. JWTs offer a method of securely transmitting information between parties as a JSON object. The information is digitally signed using cryptographic algorithms. Because the JWT is signed, parties that receive a JWT can be assured that the data wasn’t tampered with in transit. **important:** We recommend that you use the companion function [GetJWTByKeyName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-get-jwt-by-key-name.md) instead of `GetJWT()`. The difference between `GetJWTByKeyName()` and `GetJWT()` is the first parameter. In the `GetJWT()` function, you pass your secret as the first parameter in plain text. With `GetJWTByKeyName()`, you pass a reference to a key that’s stored using the [Key Management](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_key_management.htm) feature of Marketing Cloud Engagement. With Key Management, you can also control which users have access to your keys. These factors make the `GetJWTByKeyName()` function more secure for most use cases. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `GetJWT()` function uses this syntax: `GetJWT({secret}, {algorithm}, {jsonPayload})` The function has the parameters listed in this table. | Name | Type | Description | | ------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `secret` | String | Required. A secret used to sign the JWT. | | `algorithm` | String | Required. The hash algorithm to use to encode the JWT. Possible values:
  • `HS256`—HMAC secret with SHA-256 hash
  • `HS384`—HMAC secret with SHA-384 hash
  • `HS512`—HMAC secret with SHA-512 hash
| | `jsonPayload` | String | Required. The payload of the JWT. Typically, the payload is a JSON object with name-value pairs. The JWT payload isn’t encrypted. | ## Usage To use the function, provide a signing secret, and specify the encoding algorithm. Finally, provide the payload that you want to encode. ``` %%[ To use the function, provide a signing secret, and specify the encoding algorithm. Lastly, provide the payload that you want to encode. Var @JSON Var @HREF Set @JSON = '{ "first_name": "Tomás", "last_name": "Santos", "email": "tomas.santos@example.com", "campaign_id": "928384" }' Set @JWT = GetJWT("0123456789abcdef0123456789abcdef", "HS256", @JSON) Set @HREF = CONCAT("https://www.example.com?sign=",@JWT) ]%%

%%=v(@HREF)=%%

``` The function outputs a JWT. ``` eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaXJzdF9uYW1lIjoiVG9tw6FzIiwibGFzdF9uYW1 lIjoiU2FudG9zIiwiZW1haWwiOiJ0b21hcy5zYW50b3NAZXhhbXBsZS5jb20iLCJjYW1wYWlnbl9pZCI 6IjkyODM4NCJ9.EDh9eRIiFCndRAFcup4R2VktJJXA90Ms4M3rRL5FfZk ``` If the syntax for the function is invalid, the function returns an `InvalidFunctionException` error. If the function call is invalid—for example, if it has an invalid parameter value—it returns a `FunctionExecutionException` error. # GetJWTByKeyName() Creates a JSON Web Token (JWT) for a JSON payload. This function uses a key that’s stored using a key stored in [Key Management](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_key_management.htm). JWTs offer a method of securely transmitting information between parties as a JSON object. The information is digitally signed using cryptographic algorithms. Because the JWT is signed, parties that receive a JWT can be assured that the data wasn’t tampered with in transit. Marketing Cloud Engagement supports hash-based message authentication code (HMAC) and Rivest–Shamir–Adleman public-key signatures (RSA signatures). **important:** We recommend that you use `GetJWTByKeyName()` instead of its companion function [GetJWT()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-get-jwt-by-key-name.md). The difference between `GetJWTByKeyName()` and `GetJWT()` is the first parameter. In the `GetJWT()` function, you pass your secret as the first parameter in plain text. With `GetJWTByKeyName()`, you pass a reference to a key that’s stored using the [Key Management](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_key_management.htm) feature of Marketing Cloud Engagement. With Key Management, you can also control which users have access to your keys. These factors make the `GetJWTByKeyName()` function more secure for most use cases. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax The `GetJWTByKeyName()` function uses this syntax: `GetJWTByKeyName({keyName}, {algorithm}, {jsonPayload})` The function has the parameters listed in this table. | Name | Type | Description | | ------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `keyName` | String | Required. The external key of a key that’s stored using Key Management. The function converts the key string to a byte array using UTF-8. It supports Base 16, Base 64, and ASCII character strings. | | `algorithm` | String | Required. A string that indicates which cryptographic algorithm and hash function to use in the token. Possible values:
  • `HS256`—HMAC secret with SHA-256 hash
  • `HS384`—HMAC secret with SHA-384 hash
  • `HS512`—HMAC secret with SHA-512 hash
  • `RS256`—RSA signature with SHA-256 hash
  • `RS384`—RSA signature with SHA-384 hash
  • `RS512`—RSA signature with SHA-512 hash
| | `jsonPayload` | String | Required. The payload of the JWT. Typically, the payload is a JSON object with name-value pairs. The JWT payload isn’t encrypted. | ## Usage To use the function, specify the external key of the key to use to sign the token. Next, specify the encoding algorithm. Lastly, provide the payload that you want to encode. ``` %%[ Var @JWT Var @JSON Var @HREF Set @JSON = '{ "first_name": "Tomás", "last_name": "Santos", "email": "tomas.santos@example.com", "campaign_id": "928348" }' Set @JWT = GetJWTByKeyName("JwtKey2", "HS256", @JSON) Set @HREF = Concat("https:///www.example.com?sign=", @JWT) ]%%

%%=V(@HREF)=%%

``` The function outputs a JWT. ``` eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaXJzdF9uYW1lIjoiVG9tw6FzIiwibGFzdF9uYW1 lIjoiU2FudG9zIiwiZW1haWwiOiJ0b21hcy5zYW50b3NAZXhhbXBsZS5jb20iLCJjYW1wYWlnbl9pZCI 6IjkyODM4NCJ9.EDh9eRIiFCndRAFcup4R2VktJJXA90Ms4M3rRL5FfZk ``` If the syntax for the function is invalid, the function returns an `InvalidFunctionException` error. This error can occur if you call the function without providing the right number of parameters or if you provide an invalid data type for a parameter. If the function call contains invalid data, it returns a `FunctionExecutionException` error. This error can occur if one of the parameter values is invalid. For example, the error is returned when the syntax of the JSON payload is incorrect. # GetPortfolioItem() Returns the content of a file in your Portfolio. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` GetPortfolioItem(itemExternalKey) ``` The `GetPortfolioItem(itemExternalKey)` function has this parameter: - `itemExternalKey` (string): Required. The external key of an item in your Portfolio. ## Usage To use this function, pass it the external key of an item in your Portfolio. This function is helpful for storing text in an external file, and bringing that text into your content. This example refers to a text file called hello.txt with an external key of "HelloWorld". The file contains this text. ``` Hello, world! This is a second line of text. This is the last line of text. ``` Call the function by passing it the external key of the text file. ```

%%=GetPortfolioItem("HelloWorld")=%%

``` The function returns `Hello, world! This is a second line of text. This is the last line of text.` # GetPostData ## Overview Returns the data from the POST payload sent to the requested resource as a string, converted using the provided optional encoding parameter. A common use case is processing JSON payloads supplied to a page. For accessing data sent via a form POST request, use: Platform.Request.GetFormField(fieldName). ### Syntax GetPostData(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | --- | ------------------------------------------------------------------------------------------ | | **1** | string | | Encoding format. If no value is entered, the encoding format will default to Windows-1252. | ## Encoding ``` jsonPost = Platform.Request.GetPostData(); ``` The example above defaults to Windows-1252 encoding. If the incoming request uses a different encoding format, such as UTF-8, the encoding can be provided using the optional parameter, shown in the example below. ``` jsonPost = Platform.Request.GetPostData('utf-8'); ``` ## Examples The examples below assign the JSON data posted to the page to the “json” variable, converting it to a JS object. Example using Microsoft Windows-1252 encoding (default): ``` ``` Example using UTF-8 encoding: ``` ``` # GetPublishedSocialContent Returns content to share on a social network as specified by the region ID. For use only in landing pages or the Social Forward feature. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` GetPublishedSocialContent(regionId) ``` The `GetPublishedSocialContent()` function has one parameter: - `regionId` (string): Required. The region ID for the social content area. ## Usage This example returns the content contained in SocialRegion. ``` %%[ GetPublishedSocialContent('SocialRegion') ]%% ``` # GetQueryStringParameter ## Overview Retrieves information from specified query string parameters, such as data included in GET requests ### Syntax GetQueryStringParameter(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------ | | **1** | string | **Required** | Name of query string parameter | ## Example ``` ``` # GetQueryStringParameter Retrieves the value of a query string parameter from the URL of a landing page or CloudPages page. ## Syntax `GetQueryStringParameter(1)` ## Function Properties | Ordinal | Type | Description | | ------- | ------ | --------------------------------------------------------------------------------------------------- | | `1` | String | Required. The key name of a query string parameter in the URL of a landing page or CloudPages page. | ## Example This code example retrieves the value of the `firstName` query string parameter in the URL. ```js

Hello !

``` For example, assume that a user visits a page with this URL: ``` https://www.example.com/welcome.htm?firstName=Martina ``` In this case, because the `firstName` query parameter has a value, the user sees a message that includes their name. ``` Hello Martina! ``` However, if the `firstName` query parameter wasn’t present in the URL, or if the key was specified without a value, the user sees a generic message that contains a fallback value for the `custName` variable. ``` Hello friend! ``` # GetRequestHeader Retrieves the value of an HTTP request header. ## Syntax GetRequestHeader(1) ## Function Properties | Ordinal | Type | Description | | ------- | ------ | ---------------------------------------- | | `1` | String | The name of the HTTP header to retrieve. | ## Example To use this function, pass it the name of the HTTP header that you want to retrieve. ```js ``` The response contains the value of the specified header. ``` en-US,en;q=0.9 ``` # GetSendTime Returns a timestamp for the beginning or end of a list, data extension (DE), or manual send at the job or individual subscriber level. The value that the function returns is in Central Standard Time (CST) without daylight saving time. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` GetSendTime(boolAllSubscribers) ``` The `GetSendTime()` function has one parameter: - `boolAllSubscribers` (boolean): If `true`, the function returns the job publish time or time at which the job started. If `false`, the function returns the timestamp at which the send completed for the individual subscriber. The default value is `false`. ## Usage To return the time at which the send completed for an individual subscriber, call the `GetSendTime()` function without any parameters. ```

%%=GetSendTime()=%%

``` You can also return the time at which the job started or was published by passing the `boolAllSubscribers` parameter. ```

%%=GetSendTime(true)=%%

``` This table shows how the results that the `Now()` and `GetSendTime()` functions return vary in different situations. | Function | During a send | After a list, DE, or manual send | After a triggered or journey send | | --------------------- | ------------------- | ----------------------------------------- | ----------------------------------------- | | **GetSendTime()** | Current system time | Individual subscriber send completed time | Individual subscriber send completed time | | **GetSendTime(true)** | Current system time | Job start time | Job publish time | | **Now()** | Current system time | Current system time | Current system time | | **Now(true)** | Current system time | Job start time | Job publish time | When used in web contexts such as "View as a Web Page" or `HttpGet()`, the `GetSendTime()` function returns the job publish time or the time at which the job started, regardless of the value of the `boolAllSubscribers` parameter. ## See Also - [Now()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-date-time/mc-ampscript-reference-date-time-now.md) # GetSocialPublishURL() Returns HTML code for sharing a content region on a supported social network. Use this function with the Social Forward feature of Marketing Cloud Engagement. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` GetSocialPublishURL(socialNetworkCode, contentRegion, socialNetworkParamKey, socialNetworkParamValue) ``` The `GetSocialPublishURL()` function has five parameters: - `socialNetworkCode` (string): Required. The name of the social network. - `contentRegion` (string): Required. The name of the content region to share on the social network. - `socialNetworkParamKey` (string): The key of a parameter to pass to the target social network. - `socialNetworkParamValue` (string): The value of a parameter to pass to the target social network. You can pass multiple key-value pairs for parameters by appending them to the end of the function. ## Supported Social Networks Pass a number from the Number Code column as the first parameter in the function. **note:** This list includes several social media sites that are no longer active as of 2023. This list is provided for completeness. | Social Network | Number Code | | -------------- | ----------- | | Facebook | 1 | | Del.icio.us | 2 | | Digg | 3 | | MySpace | 4 | | StumbleUpon | 5 | | Google | 6 | | Microsoft | 7 | | Yahoo | 8 | | LinkedIn | 9 | | ShareThis | 10 | | Twitter | 11 | | Google+ | 15 | ## Usage In the pasted HTML code below, the `GetSocialPublishURL()` function creates a link to Facebook in order to share the specified content area on that network. ```

This is an example of a shared content area!&nbsp; Please feel free to pass on this information!

Facebook ``` ## See Also - [Social Forward](https://help.salesforce.com/s/articleView?id=mktg.mc_es_social_forward.htm) - [GetSocialPublishUrlByName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social-get-social-publish-url-by-name.md) # GetSocialPublishURLByName() Returns HTML code for sharing a content region on a supported social network. Use this function with the Social Forward feature of Marketing Cloud Engagement. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` GetSocialPublishURLByName(socialNetworkName, countryCode, contentRegion, socialNetworkParamKey, socialNetworkParamValue) ``` The `GetSocialPublishURLByName()` function has five parameters: - `socialNetworkName` (string): Required. The name of the social network. - `countryCode` (string): Required. An ISO country code. - `contentRegion` (string): Required. The name of the content region to share on the social network. - `socialNetworkParamKey` (string): The key of a parameter to pass to the target social network. - `socialNetworkParamValue` (string): The value of a parameter to pass to the target social network. You can pass multiple key-value pairs for parameters by appending them to the end of the function. ## Supported Social Networks This function supports these social networks. **note:** This list includes several social media sites that are no longer active as of 2023. This list is provided for completeness. - Del.icio.us - Digg - Facebook - Google - Google+ - LinkedIn - Microsoft - MySpace - ShareThis - StumbleUpon - Twitter - Yahoo ## Usage ```

This is an example of a shared content area!&nbsp; Please feel free to pass on this information!

Facebook ``` ## See Also - [Social Forward](https://help.salesforce.com/s/articleView?id=mktg.mc_es_social_forward.htm) - [GetSocialPublishUrl()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-social/mc-ampscript-reference-social-get-social-publish-url.md) # GetSystemStatus Use the GetSystemStatus method to retrieve the status of your account. Use this method only during exception handling or as the first SOAP API call. **note:** Don't use this method before every API call or at intervals less than 60 seconds. When troubleshooting, run this method about every 10 minutes. ## Parameters | Name | Data Type | Description | | ---------------------- | ------------------- | ---------------------------------------------------- | | `Options` | SystemStatusOptions | Optionally specifies more processing options. | | `OverallStatus` | String | Specifies the overall status of the request. | | `OverallStatusMessage` | String | Specifies the overall status message of the request. | | `RequestID` | String | A unique identifier for the request. | ## Output This method returns an array of SystemStatusResult objects. If the SystemStatusResult SystemStatus property equals **OK**, no action is required. If the SystemStatusResult SystemStatus property equals **InMaintenance**, place your application in queue mode and periodically make the GetSystemStatus call until the status returns to OK. If the SystemStatusResult SystemStatus property equals **UnplannedOutage**, place your application in queue mode and periodically make the GetSystemStatus call until the status returns to OK. To understand and act on the system status, we recommend that you have these elements in place. - A global status container in your application. This container can allow your application to change code paths to ensure that all messages are stored while waiting for the status to return to OK. If the global status container contains an InMaintenance or UnplannedOutage status, wait for the scheduled status checking component to update the global status container to the OK status. - A scheduled status checking component in your software, so it can respond to error situations and update the global status container if the status is different. ## Usage This sample SOAP envelope shows how to retrieve the current system status. ```xml GetSystemStatus https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx YOUR_ACCESS_TOKEN ``` On success, the API returns HTTP `200` response with a SOAP body that resembles this example. ```xml OK a1b2c3d4-e5f6-7890-abcd-ef1234567890 OK ``` # Getting Started AMPscript is an interpreted scripting language for Marketing Cloud Engagement. With AMPscript, you can integrate the data in your customer database with your marketing content. This tight integration enables your Marketing team to send highly personalized messages using all of the communication channels that Marketing Cloud Engagement supports, including email, SMS, and mobile. You can also use it to create customized landing pages and microsites. When you send messages or deploy CloudPages that contain AMPscript, the AMPscript code is executed on the Marketing Cloud Engagement server when the message is sent or when the landing page loads. This guide contains basic usage information for AMPscript. To see reference content for AMPscript functions, click the [Reference](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/mc-ampscript-references.html) tab. # GetUserLanguages Returns a string array of language locale codes for the user’s browser. You can use this information to send language- and country-appropriate to a microsite. **note:** This function doesn’t work with CloudPages. To retrieve language information for CloudPages, use the [Platform.Request.GetRequestHeader()](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformHTTPPropertyGetRequestHeader.md) function to retrieve the `Accept-Language` header. ## Syntax `Platform.Request.GetUserLanguages()` ## Usage To execute this function, call it without any parameters. ```javascript ``` The code example returns a locale code derived from the user’s browser headers. ``` en-US ``` # GetValue ## Overview Returns the value from the specified AMPscript variable in the current script context ### Syntax GetValue(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ------------------------------------------------- | | **1** | string | **Required** | AMPscript variable from which to return the value | ## Example ``` ``` # GetValue ## Overview Return the value of the specified attribute for the recipient ### Syntax GetValue(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | --------------------- | | **1** | string | **Required** | Name of the attribute | ## Example This sample code returns the phone number of a recipient. ``` Attribute.GetValue("phoneNumber"); ``` # GetValue ## Overview Retrieves the value of the specified HTTP header ### Syntax GetValue(1) ### Function Properties | Ordinal | Type | | Description | | ------- | ------ | ------------ | ----------- | | **1** | string | **Required** | Header name | ## Example This sample code retrieves the From address from the HTTP header: ``` HTTPHeader.GetValue("From"); ``` # GlobalUnsubscribeCategory An object that represents subscription management categories. | Name | Data Type | Description | | --------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `IgnorableByPartners` | Boolean | Specifies if a category is seen by partners. | | `Ignore` | Boolean | Specifies if an account ignores the category. | | `ModifiedDate` | DateTime | Last time object information was modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | # GlobalUnsubscribeCategory An object that represents subscription management categories. ## Properties | Name | Data Type | Description | | --------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `IgnorableByPartners` | Boolean | Specifies if a category can be seen by partners. | | `Ignore` | Boolean | Specifies if an account ignores the category. | | `ModifiedDate` | DateTime | Last time object information was modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # Goals The goal object is used to measure the effectiveness of an associated journey. Goals are only evaluated via their criteria or filter XML. ## Journey Specification Format The activity must be formatted as specified below. The following JSON object will be included in the `goals` array of a journey, as defined in the Journey Specification. ## Helpful Hints - When a journey is saved, each goal is saved. - Goals are evaluated every 24 hours and upon exiting each wait activity. - The `metaData.conversionUnit` property is a string that can be either "percentage" or "wholenumber". - The `metaData.conversionValue` property is a number as a string. - The `configurationArguments.criteria` property is an XML string that defines a filter that is used as a data-gate to determine if a contact qualifies for this goal. ## Sample Request ```js { "goals": [ { "key": "user-defined-key", "name": "name of your goal", "description": "The description of this goal", "type": "Event", "outcomes": [], "arguments": {}, "configurationArguments": { "criteria": "", "schemaVersionId": 122 }, "metaData": { "conversionValue": "1", "conversionUnit": "wholenumber", "conversionTypeId": 1, "isExitCriteria": true, "eventDefinitionKey": "My-Event-Key", "eventDefinitionId": "" } } ] } ``` ## Sample Response ```js { "goals": [ { "id": "SFMC-provided-GUID", "key": "user-defined-key", "name": "name of your goal", "description": "The description of this goal", "type": "ContactEvent", "outcomes": [], "arguments": {}, "configurationArguments": { "criteria": "", "schemaVersionId": 122 }, "metaData": { "conversionValue": "1", "conversionUnit": "wholenumber", "conversionTypeId": 1, "isExitCriteria": true, "eventDefinitionKey": "My-Event-Key", "eventDefinitionId": "" } } ] } ``` ## Related Items [Journey Specification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.md) # Group A group of subscribers that’s defined in the Marketing Cloud Engagement UI. You can interact with groups via the API in the same manner as lists. | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | `Category` | Int | ID of the folder that an item is located in. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the group was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only legacy identifier for an object. Not supported on all objects. | | `ModifiedDate` | DateTime | The date and time when the group was modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Subscribers` | Array of [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) objects | Indicates subscribers associated with an object. | # Group An object that represents a group of subscribers. Interact with groups via the API in the same manner as lists. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Category` | Int | ID of the folder that an item is located in. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `Subscribers` | Array of [Subscriber](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.md) objects | Indicates subscribers associated with an object. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # GroupConnect Chat Messaging API Send real-time event-based messages to your users in Facebook Messenger and LINE. ## Use Cases - Send Account Updates - Send a message when changes occur in the user account. - Profile - Preferences - Settings - Membership status - Password - Send Payment Updates - Send a receipt - Send an out-of-stock notification - Notify an auction has ended - Send a status change on a payment transaction - Send Shipping Updates - Product is shipped - Status changes to in-transit - Product is delivered - Shipment is delayed - Send Reservation Updates - Itinerary changes - Location changes - Confirm cancellation - Cancel hotel booking - Car rental pick-up time changes - Confirm upgrade - Send Transportation Updates - Flight status changes - Ride is canceled - Trip is started - Ferry has arrived - Send Ticket Updates - Concert start time changes - Event location changes - Show is cancelled - Refund opportunity is available ## Known Limitations - This API can’t automatically create contacts. - This API can’t use content templates from Content Builder. - API send reports aren’t available. - This API addresses only install package permissions. ## Related Items Review the [Facebook Messenger Platform Policies](https://developers.facebook.com/docs/messenger-platform/policy/policy-overview) before you send messages using Facebook Messenger. # GroupDefinition An object that manages rules and metadata for groups in a List-based data model. ## Properties | Name | Data Type | Description | | --------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `Description` | String | Describes and provides information regarding the object. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `Keyword` | String | Not used. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # Groups The following are groups technical articles for SOAP API. - [Refresh a Group](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/refreshing_a_group.md) # GUID ## Overview Returns a random GUID value for use as a unique identifier. ### Syntax GUID() ## Example ``` ``` # GUID Return a globally unique ID (GUID) as a string. The ID that the function returns is generated using random data. The variant type for the ID is DCE 1.1, ISO/IEC 11578:1996. This function doesn't accept any arguments. ## Example This code example generates a GUID and saves it as a variable called `myGUID`. ```js

GUID:

``` The output of the code example includes a randomly generated GUID. ``` GUID: 31558c83-ff02-42c5-ab2d-a1455f9d6d4b ``` # GUID() Generates a 128-bit hexadecimal Globally Unique Identifier (GUID). ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
## Syntax ``` GUID() ``` The `GUID()` function doesn’t accept any parameters. ## Usage This example generates a GUID. ``` %%=v(GUID())=%% ``` The output of this function is a unique identifier, such as `a0f71563-b064-4b02-a21a-571dadadafb1`. # Handle Errors in REST API ## Validation | Description | Resolution | HTTP Error | Custom | | ---------------------- | ---------------------------------------------------------------------------- | ---------- | ------ | | Generic Exception | Verify that you included the proper endpoint and resource. | 400 | 10000 | | Invalid Data Type | Confirm that the parameters of your request include the required data types. | 400 | 10001 | | Missing Required Field | Confirm that the request includes all required fields. | 400 | 10002 | | Incorrect Format | Verify that the request is formatted correctly. | 400 | 10003 | | Invalid Message Format | Make sure that the request body has balanced braces and brackets. | 400 | 10004 | | Invalid Value | Make sure that all values in the request are of the correct data types. | 400 | 10005 | | Aggregate Error | Check `additionalErrors` for detailed error messages. | 400 | 10006 | | Unsupported Media Type | Make sure that all media formats in the request are valid and allowed. | 415 | | ## Authorization | Description | Resolution | HTTP Error | Custom | | ----------------------- | ---------------------------------------------------------------------------------- | ---------- | ------ | | General Exception | Ensure you provide the correct resource. | 403 | 20000 | | Business Rule Not Set | Review the associated permissions and ensure you provide the proper configuration. | 403 | 20001 | | Insufficient Privileges | Your account lacks the privileges necessary to perform the request. | 403 | 20002 | ## Authentication | Description | Resolution | HTTP Error | Custom | | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------- | ------ | | Not Authorized | The access token in the request is missing, invalid, or expired. | 401 | 0 | | Authorization token invalid on URL or request body | Verify that the request header contains a valid access token. | 401 | 40004 | | General | Ensure the request specifies the correct resource. | 403 | 40000 | | Not Authenticated | Verify that the request header contains a valid access token. | 403 | 40001 | | Authorization token invalid on this endpoint | Use the stack-level endpoint that matches your token. | 403 | 40002 | | Authorization token invalid on URL | Verify that the request header contains a valid access token. | 403 | 40003 | | Internal Server Error | See the response returned by the HTTP routing assertion. | 500 | | | Service Not Found | The resource you’re trying to access doesn’t exist. Verify that the request specifies the correct resource. | 596 | | ## Runtime | Description | Resolution | HTTP Error | Custom | | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -------------------------------- | | Generic | Verify that your request specifies the correct resource. | 400 | 30000 | | Invalid Operation | Your request uses an invalid HTTP operation for the resource. Modify the request to use a valid operation. | 400 | 30001 | | Invalid State Transition | This operation requests an invalid state transition for the resource. Ensure you request a valid state transition. | 409 | 30002 | | Object Not Found | Your request can’t find any available data. Ensure you properly created your request. | 404 | 30003 | | Execution Timeout Expired | Retry the API call using [Exponential Backoff](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting-best-practices.md). | 408 | — | | Object Already Exists | An existing object has the same ID, key, or name as the object specified in the request. Provide a unique value and try again. | 409 | 30004 | | Too many requests | Retry the API call after number of seconds specified in “Retry-After” header field. | 429 | [50100](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting-errors.md) | | Too many requests | Your API requests are temporarily blocked due to too many concurrent requests. Contact Salesforce Customer Support for more information about the issue. | 429 | [50200](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/rate-limiting-errors.md) | | Service Unavailable | Retry the API call after number of seconds specified in “Retry-After” header field. | 503 | 50300 | # Handlebars Block Helper: impressionRegion Use the `impressionRegion` block helper to define an impression region in a message. Impression tracking helps you track the performance of messages that contain dynamic content. Use the name of an impression region to view reporting data for that region. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{#impressionRegion name}} ... {{/impressionRegion}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | --------------------------------------------------------------------------------------- | | `name` | String | Required. The name to assign to the impression region. Specify only in the opening tag. | ## Return Value The block helper doesn’t produce any output. ## Usage Example This example opens two impression regions, one nested inside the other, and then closes one of them. ```handlebars {{#impressionRegion "Body"}} {{#impressionRegion "Promo"}}

Save 20% on your next order!

{{/impressionRegion}} ``` The block helper doesn't produce any visible output. The one closing tag in this example closes the innermost region, which is the "Promo" region. The "Body" region remains open until it's closed. If an open region is never closed, then it automatically closes at the end of the message. ## See Also - _Salesforce Help_: [Track Content Performance with Impression Regions](https://help.salesforce.com/s/articleView?id=mktg.mktg_content_impression_regions.htm) # Handlebars Comparison Functions Use the Handlebars comparison functions to compare values and return a boolean value based on the result of the comparison. This section contains information about this Handlebars function. | Function Name | Description | | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | [and](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-and.md) | Returns `true` if two values are true. | | [compare](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-compare.md) | Compares two values using a specified operator. | | [equals](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-equals.md) | Compares two values for equality. | | [if](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-if.md) | Conditionally renders a block based on whether a value evaluates to `true`. | | [iif](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-iif.md) | Evaluates an expression and returns one of two values based on whether the expression is `true` or `false`. | | [isEmpty](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-isempty.md) | Checks if a value evaluates to null or empty. | | [not](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-not.md) | Returns `true` if a value is false. | | [or](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-or.md) | Returns `true` if at least one value is true. | | [unless](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-unless.md) | Conditionally renders a block based on whether a value evaluates to `false`. | # Handlebars Content Functions Use the Handlebars content functions to work with content blocks. This section contains information about these Handlebars functions. | Function Name | Description | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------- | | [buildUrl](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-content-references/mcn-handlebars-reference-content-buildurl.md) | Creates a parameterized, click-tracked URL. | | [buildRowSetFromString](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-content-references/mcn-handlebars-reference-content-buildrowsetfromstring.md) | Creates a rowset by splitting a string at a delimiter. | | [buildRowSetFromXML](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-content-references/mcn-handlebars-reference-content-buildrowsetfromxml.md) | Loads XML data into a rowset by using an XPath expression. | | [getContentBlock](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-content-references/mcn-handlebars-reference-content-getcontentblock.md) | Retrieve and render a content block within a template. | # Handlebars Data Functions Use the Handlebars data functions to retrieve and work with data objects in Marketing Cloud Next. | Function Name | Description | | ------------------------------------------------------------- | ------------------------------------------------------------------- | | [assignCoupon](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-assigncoupon.md) | Claims a coupon row for the current recipient. | | [claimRow](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-claimrow.md) | Returns and claims the first unclaimed row from a marketing object. | | [hash](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-hash.md) | Constructs an object for use in queries. | | [query](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-query.md) | Retrieves multiple records from a data source. | | [queryFirst](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-queryfirst.md) | Retrieves the first matching record from a data source. | # Handlebars Date and Time Functions Use the Handlebars date and time functions to retrieve, transform, and show times and dates. This section contains information about these Handlebars functions. | Function Name | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------- | | [dateAdd](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-dateadd.md) | Adds or subtracts an amount of time to a date. | | [datePart](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-datepart.md) | Extracts part of a date or timestamp. | | [dateDiff](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-datediff.md) | Calculates the time difference between two dates. | | [now](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-now.md) | Returns the current system timestamp. | | [timeZoneConversion](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-date-time-references/mcn-handlebars-reference-date-time-timezoneconversion.md) | Converts a date from one time zone to another. | # Handlebars Encryption Functions Use the Handlebars encryption functions to calculate hashes. This section contains information about these Handlebars functions. | Function Name | Description | | ------------------------------------------------------- | ------------------------------------------------------------ | | [encode](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-encode.md) | Calculates a cryptographic hash using a specified algorithm. | | [md5](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-md5.md) | Converts a string to a 128-bit hexadecimal MD5 hash. | | [sha1](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha1.md) | Converts a string to a 160-bit hexadecimal SHA-1 hash. | | [sha256](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha256.md) | Converts a string to a 256-bit hexadecimal SHA-2 hash. | | [sha512](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha512.md) | Converts a string to a 512-bit hexadecimal SHA-2 hash. | # Handlebars for Marketing Cloud Next Handlebars is a popular and familiar templating language that for creating highly personalized messages without requiring extensive coding knowledge. By enabling the insertion of customer-specific data directly into content, Handlebars helps marketers boost engagement and improve campaign effectiveness. Marketing Cloud Next enhances this experience by offering a suite of built-in Handlebars helpers, making it easier to navigate data sources, filter and sort information, and apply powerful personalization logic in a simple, readable way. For reference information about the Handlebars helpers built in to Marketing Cloud Next, see the [Reference](/docs/marketing/handlebars-for-marketing-cloud-next/references) page. # Handlebars for Marketing Cloud Next Use Handlebars to create personalized templates for your Marketing Cloud Next campaigns. The Handlebars engine in Marketing Cloud Next is based on the Handlebars.Net library, with some additional features that are specific to Marketing Cloud Next. If you’re new to Handlebars in Marketing Cloud Next, review the [Guide section](/docs/marketing/handlebars-for-marketing-cloud-next/guide/mcn-handlebars-guide-overview.html) first. When you’re ready to start building your templates, review the [list of supported functions](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-references/mcn-handlebars-reference-index.md). # Handlebars Helper Function: add Adds two numeric arguments and returns their sum. The function can handle both integer and floating-point numbers, and attempts to convert strings to numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{add value1 value2}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---------------- | ------------------------------------------------------------------------------- | | `value1` | Number or String | Required. The first value to add. Must be a number or convertible to a number. | | `value2` | Number or String | Required. The second value to add. Must be a number or convertible to a number. | ## Return Value The function returns the arithmetic sum of the two input values. If you provide more than two arguments, the operation adds only the first two. The result is always a number rounded to 2 decimal places. If either input is a string, the operation tries to convert it to a number. If a string value can't be converted to a number, the operation throws an exception. # Handlebars Helper Function: and Performs a logical AND operation between multiple values. Returns `true` if all values are truthy, and `false` otherwise. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{and value1 value2 [value3 value4 ...]}} ``` ## Parameters | Parameter | Type | Description | | --------------------- | ---- | ----------------------------------------- | | `value1` | Any | The first operand for the AND operation. | | `value2` | Any | The second operand for the AND operation. | | `value3, value4, ...` | Any | Additional operands to evaluate. | ## Return Value The function returns `true` if all parameters evaluate to `true`, and `false` otherwise. If no parameters are provided, the function returns `true`. If one parameter is provided, the function returns the truthiness evaluation for that parameter. Truthiness evaluation follows these rules: - `null` is `false` - Boolean values are evaluated as-is - Non-zero numbers are `true`, but zero is `false` - Empty strings are `false`, and non-empty strings are `true` - Empty arrays (`[]`) and empty objects (`{}`) are `false` ## Usage Example This function is often used together with conditional helpers to handle multiple conditions. For example, this code example checks if the user is both an admin and is active and handles it accordingly. ```handlebars {{#if (and (equals user.role "admin") (compare user.status "==" "active"))}} {{else}} {{/if}} ``` ## See Also - [Compare](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-compare.md) - [Equals](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-equals.md) - [If](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-if.md) - [With](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-with.md) # Handlebars Helper Function: assignCoupon Claims a coupon row from a marketing object for the current recipient. Use this helper to assign a coupon code from a coupon list. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{assignCoupon list="CouponCodes"}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------- | | `list` | String | Required. The name of the marketing object that contains the coupon rows. | ## Return Value The function returns the claimed coupon row as an object. Use the [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-get.md) helper to retrieve values from the returned row. For a coupon list that isn't configured to always assign a new coupon, the helper returns the coupon previously assigned to the same recipient. If no coupon is available, the coupon list isn't valid, or the recipient doesn't have an individual ID, the function throws an exception. You can use the [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) helper to handle an unavailable coupon. ## Usage Examples This example assigns a coupon and renders the value in the `CouponCode` field. ```handlebars {{#with (assignCoupon list="CouponCodes")}} Your coupon code is {{get this "CouponCode"}}. {{/with}} ``` ### Providing a Fallback Value This example renders a fallback message when a coupon isn't available. ```handlebars {{fallback (get (assignCoupon list="CouponCodes") "CouponCode") "No coupon available"}} ``` ## See Also - [claimRow](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-claimrow.md) - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) - [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-get.md) # Handlebars Helper Function: base64Decode Converts Base64-encoded binary data to plain text. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{base64Decode stringToDecode characterEncoding="CHARSET" [abortSendOnFail=true|false]}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | | `stringToDecode` | String | Required. The Base64-encoded string to decode. | | `characterEncoding` | String | The character encoding to use. Specify as a named parameter with one of these values: `ASCII`, `UTF-7`, `UTF-8`, `UTF-16`, or `UTF-32`. | | `abortSendOnFail` | Boolean | Indicates whether to abort a send if `stringToDecode` can't be decoded. Specify as a named parameter. | ## Return Value The function returns the decoded plain-text value. ## Usage Example This example decodes a Base64-encoded coupon code that was retrieved from a marketing object so that it can be displayed to a subscriber as plain text. ```handlebars {{base64Decode "NmRuMjh1cXhvY3F1"}} ``` The function returns this decoded string: ```text 6dn28uqxocqu ``` ### Handling Decoding Failures This example decodes a value that isn't valid Base64 data, and sets the value of `abortSendOnFail` to `false` so that an email send continues even if decoding fails. ```handlebars {{base64Decode invalidEncodedValue characterEncoding="UTF-8" abortSendOnFail=false}} ``` If `invalidEncodedValue` can't be decoded, the helper returns an empty string instead of stopping the send. # Handlebars Helper Function: base64Encode Converts plain text to Base64-encoded binary data. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{base64Encode stringToEncode characterEncoding="CHARSET"}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | | `stringToEncode` | String | Required. The string to encode. | | `characterEncoding` | String | The character encoding to use. Specify as a named parameter with one of these values: `ASCII`, `UTF-7`, `UTF-8`, `UTF-16`, or `UTF-32`. | ## Return Value The function returns the Base64-encoded value of `stringToEncode`. ## Usage Example This example encodes a coupon code before storing it in a marketing object, so the plain-text value isn't stored directly. ```handlebars {{base64Encode "6dn28uqxocqu"}} ``` The function returns this Base64-encoded string: ```text NmRuMjh1cXhvY3F1 ``` ### Encoding with UTF-16 This example encodes the same string, but specifies UTF-16 character encoding. Because UTF-16 uses more bytes per character, the encoded output is longer. ```handlebars {{base64Encode "6dn28uqxocqu" characterEncoding="UTF-16"}} ``` The function returns: ```text NgBkAG4AMgA4AHUAcQB4AG8AYwBxAHUA ``` # Handlebars Helper Function: buildRowSetFromString Creates a rowset by splitting a string at a specified delimiter. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{buildRowSetFromString sourceData delimiter}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ------ | -------------------------------------------------------------- | | `sourceData` | String | Required. The string to split into rows. | | `delimiter` | String | Required. The delimiter that separates values in `sourceData`. | ## Return Value The function returns a rowset with one unnamed column. Each value separated by `delimiter` is a row in the result. ## Usage Example This example creates a rowset from a pipe-delimited string and renders each value. ```handlebars {{#each (buildRowSetFromString "123|456|789" "|")}} {{this}} {{/each}} ``` The example produces this output: ``` 123 456 789 ``` # Handlebars Helper Function: buildRowSetFromXml Loads XML data into a rowset by using an XPath expression. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{buildRowSetFromXml xmlData xpathExpression returnEmptyOnError=true|false}} ``` ## Parameters | Parameter | Type | Description | | -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `xmlData` | String | Required. The XML data to parse. | | `xpathExpression` | String | Required. The XPath expression that selects nodes from `xmlData`. | | `returnEmptyOnError` | Boolean | Required. If `true`, returns an empty rowset when parsing or XPath evaluation fails. If `false`, throws an exception. Specify as a named parameter. | ## Return Value The function returns a rowset that contains the XML nodes selected by `xpathExpression`. Each row includes the node value, XML, and any attributes found in the selected nodes. ## Usage Example This example selects the `Flight` nodes from an XML string. ```handlebars {{#set flightsXml}} 100.00 200.00 50025 {{/set}} {{#each (buildRowSetFromXml flightsXml "//Flight" returnEmptyOnError=false)}} {{Origin_att}} to {{Dest_att}}: {{Value}} {{/each}} ``` The example produces this output: ```text IND to NYC: 100.00 IND to LAX: 200.00 IND to SEA: 500 ``` # Handlebars Helper Function: buildUrl Creates a URL that includes click tracking. Use this helper to add UTM parameters and custom query parameters to a link. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ``` {{buildUrl base [encode=true|false] [label=LABEL] [noTracking=true|false] [sfmclinkid=LINK_ID] [sfmclinkalias=LINK_ALIAS] [utm_campaign=CAMPAIGN] [utm_content=CONTENT] [utm_medium=MEDIUM] [utm_source=SOURCE] [utm_term=TERM] [CUSTOM_KEY=CUSTOM_VALUE] }} ``` ## Parameters | Parameter | Type | Description | | --------------- | ------- | -------------------------------------------------------------------------------------------------- | | `base` | String | Required. The destination URL. The helper function preserves existing query parameters. | | `encode` | Boolean | When `true`, URL-encodes parameter values. The default is `true`. The `base` URL is never encoded. | | `label` | String | A link alias for tracking. Don't use with `sfmclinkalias`. | | `noTracking` | Boolean | When `true`, returns the composed URL without click tracking. The default is `false`. | | `sfmclinkid` | String | An internal link identifier for tracking. | | `sfmclinkalias` | String | A link alias for tracking. Don't use with `label`. | | `utm_campaign` | String | The campaign name or identifier. | | `utm_content` | String | A value that differentiates links that point to the same URL. | | `utm_medium` | String | The marketing medium. | | `utm_source` | String | The traffic source. | | `utm_term` | String | Paid-search keywords. | | `CUSTOM_KEY` | Any | A custom parameter to append to the URL. | Specify all optional parameters as named parameters. The helper also applies link parameters configured for the content asset and business unit. Values provided directly in `buildUrl` take precedence over content-level values, which take precedence over business unit values. A direct parameter with a null or blank value removes the parameter from the URL. ## Return Value The function returns a URL that has click tracking enabled. By default, it adds the composed destination URL to a tracking token. When `noTracking=true`, the function returns the composed destination URL directly. If `base` is missing, null, or empty, the function throws an exception. It also throws an exception if you use a reserved tracking parameter as a custom parameter or specify both `label` and `sfmclinkalias`. ## Usage Examples This example creates a tracked URL with a campaign parameter. ```handlebars {{buildUrl product.DetailUrl utm_campaign=$message.campaign.name}} ``` This example adds a custom parameter and turns off automatic encoding because the value is already encoded. ```handlebars {{buildUrl product.DetailUrl token=preEncodedToken encode=false}} ``` This example creates an untracked URL. Query parameters are still applied. ```handlebars {{buildUrl https://www.example.com noTracking=true}} ``` ## See Also - [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/hb_http_helpers/mcn-handlebars-reference-http-encodeuri.md) - [encodeURIComponent](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/hb_http_helpers/mcn-handlebars-reference-http-encodeuricomponent.md) # Handlebars Helper Function: char Returns the Unicode character that corresponds to a specified character code. The function can optionally repeat the character a specified number of times. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{char code repeated}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ----------------- | ------------------------------------------------------------------------------------------------------------------- | | `code` | Number or String | Required. The Unicode character code in decimal notation. Must be a number or convertible to a number. | | `repeated` | Integer or String | The number of times to repeat the character. Must be a number or convertible to a number. The default value is `1`. | ## Return Value The function returns the Unicode character that corresponds to the provided code. If a repeat count is specified, it returns the character that many times. For both parameters, the function attempts to convert strings to numbers. The function throws an exception if the `repeated` parameter is negative. The function also throws an exception if the value of either parameter isn't a number or convertible to a number. If the value of the `code` parameter is outside the 16-bit range (0-65535), the function wraps it around to a valid Unicode value by taking the modulo of the value and 65536. For example, `{{char 65602 1}}` returns `B` (U+0042), because 65602 % 65536 is 66 in decimal notation or 42 in hexadecimal. # Handlebars Helper Function: claimRow Returns the first unclaimed row from a marketing object and updates that row to indicate that it's claimed. Use this helper to distribute values such as coupon codes. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{claimRow object=MARKETING_OBJECT_NAME claimCol=COLUMN CLAIMANT_DATA="CLAIMANT_DATA_VALUE" ...}} ``` ## Parameters | Parameter | Type | Description | | --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `object` | String | Required. The name of the marketing object that contains the rows to claim. Specify as a named parameter. | | `claimCol` | String | Required. The column that tracks whether a row is claimed. Specify as a named parameter with the value equal to the column name. | | `CLAIMANT_DATA` | String | Required. The column to populate with data about the user claiming the row. Specify the name of the column as a named parameter, and set the value of the parameter to the value to populate in the claim table. | You can update multiple columns in the marketing object by appending more `CLAIMANT_DATA="CLAIMANT_DATA_VALUE"` pairs to the function. ## Return Value The function returns the claimed row, or throws an exception if there aren't any unclaimed rows. ## Usage Example This example claims a coupon code from the `CouponCodes` marketing object for a subscriber and marks that code unavailable to other subscribers. It returns the value from the CouponCode column in the marketing object. Before the helper runs, the marketing object contains these rows. | CouponCode | EmailAddress | IsClaimed | | ---------- | ------------ | --------- | | S5MY7BVU | | false | | 40PNCHO2 | | false | | 718BZOY0 | | false | ```handlebars {{#set emailAddress}}sunhi.kim@example.com{{/set}} {{#with (claimRow object="CouponCodes" claimCol="IsClaimed" EmailAddress=emailAddress)}} Your coupon code is {{CouponCode}} {{/with}} ``` This example produces this output: ```text Your coupon code is S5MY7BVU ``` The helper updates the `CouponCodes` marketing object. After this operation, the marketing object contains this data. | CouponCode | EmailAddress | IsClaimed | | ---------- | --------------------- | --------- | | S5MY7BVU | sunhi.kim@example.com | true | | 40PNCHO2 | | false | | 718BZOY0 | | false | ## Providing a Fallback Value If there aren't any unclaimed rows in the marketing object, the function throws an exception. For this reason, it's helpful to combine this function with [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md). This example shows how to combine these functions. ```handlebars {{#set emailAddress}}sunhi.kim@example.com{{/set}} {{#with (claimRow object="CouponCodes" claimCol="IsClaimed" EmailAddress=emailAddress)}} Your coupon code is {{fallback CouponCode "10OFF100"}} {{/with}} ``` If there are no unclaimed coupon codes remaining, the value of `CouponCode` is null. In this situation, the function returns the fallback code, "10OFF100". ## See Also - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) # Handlebars Helper Function: compare Compares two values using a specified operator. The operation supports both numeric and string comparisons, and automatically determines the appropriate comparison type. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ``` {{compare leftValue operator rightValue}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `leftValue` | Any | Required. The left operand for comparison | | `operator` | String | Required. The comparison operator to use. Accepted values:
  • "==": Equal to
  • "!=": Not equal to
  • ">": Greater than
  • ">=": Greater than or equal to
  • "<": Less than
  • "<=": Less than or equal to
| | `rightValue` | Any | Required. The right operand for comparison | ## Return Value The operation returns a boolean value (`true` or `false`) based on the result of the comparison. ### Comparison Logic The `compare` operation uses logical rules to evaluate the relationship between the `leftValue` and `rightValue` properties, according to the selected `operator`. It examines the types and values of both operands and determines the appropriate comparison strategy. If the operator is `==` or `!=`, the operation follows these rules: 1. If both values are `null`, they're considered equal and the operation returns `true`. If only one value is `null`, the operation returns `false`. 2. If either value is a boolean, both are coerced using language truthiness rules and compared as booleans. For example, the boolean `true` is equal to the string `"true"`. 3. If either value is a date or datetime value, both are parsed and compared as dates. 4. If either value is number-like, both are converted to numbers and compared numerically. For example, the string `"5.0"` is equal to the number `5`. 5. If either value is a string that can’t be converted to a number, the operation falls back to case-sensitive string comparison. For example, the string `"Hello"` isn’t equal to the string `"hello"`. If the operator is `>`, `>=`, `<`, or `<=`, the operation follows these rules: 1. If either value is a number or is convertible to a number, the operation attempts to compare them numerically. For example, `{{compare "5.5" ">" 3}}` returns `true`. 2. If either value is a date or datetime value, both are parsed and compared as dates. 3. If either value is a string that can't be converted to a number or date, the operation performs an alphabetic, case-sensitive comparison. For example, `{{compare "apple" "<" "banana"}}` returns `true`. # Handlebars Helper Function: concat Combines multiple values into a single string. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{concat value1 value2 ...}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---- | ----------------------------------------- | | `value1` | Any | Required. The first value to concatenate. | | `value2` | Any | The second value to concatenate. | | `...` | Any | Additional values to concatenate. | ## Return Value The function returns a single string with all input values concatenated together. Each value is converted to a string representation before concatenation. Arrays are converted by concatenating their elements as strings. Null values are skipped during concatenation. The function throws an exception if no arguments are provided. # Handlebars Helper Function: dateAdd Adds or subtracts a specific amount of time to a date. Use this helper to perform date arithmetic such as adding days to a date, subtracting months, or adjusting hours and minutes. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{dateAdd date number interval}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `date` | String or Object | Required. The starting date. | | `number` | Integer or String | Required. The amount of time to add. Use a negative value to subtract time from `date`. If you specify a string, the helper function tries to convert it to a number. | | `interval` | String | Required. The time unit to add or subtract. Possible values: `"Y"` (year), `"M"` (month), `"D"` (day), `"H"` (hour), `"MI"` (minute), `"S"` (second). | You can specify `date` in these formats: - **US formats**: `MM/dd/yyyy`, `M/d/yyyy`, `MM/dd/yyyy HH:mm:ss`, `M/d/yyyy h:mm a`, or `M/d/yyyy h:mm:ss a` - **ISO formats**: `yyyy-MM-dd`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, or `yyyy-MM-dd'T'HH:mm:ss.SSSZ` - **12-hour time**: `M/d/yyyy h:mm a`, `yyyy-MM-dd h:mm a`, or `yyyy-MM-dd h:mm:ss a` - **Time-only**: `h:mm a` or `h:mm:ss a` **note:** If you specify only a time, the helper function uses the current date. - **Long-form English**: `d MMMM yyyy`, `MMMM d, yyyy`, or `EEEE, MMMM d, yyyy` - **Chinese and Japanese notation**: `yyyy年M月d日` - **Korean notation**: `yyyy년 M월 d일` or `yyyy년M월d일` ## Return Value The function returns a date-time string in the format `yyyy-MM-dd HH:mm:ss`. If the value of the `date` parameter is February 29th during a leap year, the helper uses February 28th to perform calculations. For example, `{{dateAdd "2024-02-29" 1 "Y"}}` returns `2025-02-28 00:00:00`. ## See Also - [DateDiff](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-datediff.md) - [Now](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-now.md) - [TimezoneConversion](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-timezoneconversion.md) # Handlebars Helper Function: dateDiff Calculates the time difference between two dates and returns the result in a specified unit. Use this helper to determine elapsed time in years, months, days, hours, minutes, or seconds. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{dateDiff date1 date2 interval [version="ampscript"]}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `date1` | String or Object | Required. The first date. | | `date2` | String or Object | Required. The second date. | | `interval` | String | Required. The unit of time to find between `date1` and `date2`. Possible values: `Y` (years), `M` (months), `D` (days), `H` (hours), `MI` (minutes), `S` (seconds). | ### Date Input You can specify `date1` and `date2` in these formats: - **US formats**: `MM/dd/yyyy`, `M/d/yyyy`, `MM/dd/yyyy HH:mm:ss`, `M/d/yyyy h:mm a`, or `M/d/yyyy h:mm:ss a` - **ISO formats**: `yyyy-MM-dd`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, or `yyyy-MM-dd'T'HH:mm:ss.SSSZ` - **12-hour time**: `M/d/yyyy h:mm a`, `yyyy-MM-dd h:mm a`, or `yyyy-MM-dd h:mm:ss a` - **Time-only**: `h:mm a` or `h:mm:ss a` **note:** If you specify only a time, the helper function uses the current date. - **Long-form English**: `d MMMM yyyy`, `MMMM d, yyyy`, or `EEEE, MMMM d, yyyy` - **Chinese or Japanese notation**: `yyyy年M月d日` - **Korean notation**: `yyyy년 M월 d일` or `yyyy년M월d일` ### Hash Parameters | Parameter | Type | Description | | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | `version` | `string` | When set to `"ampscript"`, the function counts the number of interval boundaries that have been crossed, as opposed to the full number of interval units. | ## Return Value The function returns an integer corresponding to the amount of time that elapsed between `date1` and `date2`. For example, `{{dateDiff 2025-12-26 2026-01-05 "D"}}` returns `10`, because there is a difference of ten days between the two dates. The function counts complete elapsed units and truncates partial units. For example, `{{dateDiff "2025-01-31" "2025-02-02" "M"}}` returns `0`, because there isn’t a full month between the two dates, even though they crossed a month boundary (from January to February). In AMPScript mode (`version="ampscript"`), the function counts interval boundaries crossed between the two dates. For example, `{{dateDiff "2025-01-31" "2025-02-02" "M" version="ampscript"}}` returns `1`, because the dates cross a month boundary, even though the two dates are only 2 days apart. # Handlebars Helper Function: datePart Extracts a specified part of a date or timestamp, such as the day, month, or year. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{datePart date datePart}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | | `date` | String or Object | Required. The date or timestamp from which to extract a date part. | | `datePart` | String | Required. The date part to extract. Possible values: `Y` (year), `M` (month), `D` (day), `H` (hour), or `MI` (minute). | ### Date Input Specify `date` in these formats: - **US formats**: `MM/dd/yyyy`, `M/d/yyyy`, `MM/dd/yyyy HH:mm:ss`, `M/d/yyyy h:mm a`, or `M/d/yyyy h:mm:ss a` - **ISO formats**: `yyyy-MM-dd`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, or `yyyy-MM-dd'T'HH:mm:ss.SSSZ` - **12-hour time**: `M/d/yyyy h:mm a`, `yyyy-MM-dd h:mm a`, or `yyyy-MM-dd h:mm:ss a` - **Time-only**: `h:mm a` or `h:mm:ss a` **note:** If you specify only a time, the helper function uses the current date. - **Long-form English**: `d MMMM yyyy`, `MMMM d, yyyy`, or `EEEE, MMMM d, yyyy` - **Chinese or Japanese notation**: `yyyy年M月d日` - **Korean notation**: `yyyy년 M월 d일` or `yyyy년M월d일` ## Return Value The function returns the requested date part as an integer. For example, `{{datePart "2023年8月5日" "Y"}}` returns `2023`. # Handlebars Helper Function: divide Divides two numeric arguments and returns their quotient. The function can handle both integers and floating-point numbers, and attempts to convert strings to numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{divide dividend divisor}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ---------------- | ----------------------------------------------------------------------------------------------- | | `dividend` | Number or String | Required. The number to be divided. Must be a number or convertible to a number. | | `divisor` | Number or String | Required. The number to divide by. Must be a number or convertible to a number, and can’t be 0. | ## Return Value The function returns the arithmetic quotient of the two input values. If you provide more than two arguments, the operation divides only the first two. The result is always a number rounded to 2 decimal places. If you divide by 0, the operation throws an exception. If either input is a string, the operation tries to convert it to a number. If a string value can't be converted to a number, the operation throws an exception. Division by zero throws an exception. # Handlebars Helper Function: domain Returns the domain portion of an email address, which is the text immediately after the at sign (`@`). ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{domain emailAddress}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ------ | ---------------------------------------------------- | | `emailAddress` | String | Required. The email address to obtain the domain of. | ## Return Value The function returns the domain portion of `emailAddress`. If `emailAddress` doesn't contain an at sign or isn't a string, the function returns `null`. ## Usage Example This example returns the domain portion of an email address. ```handlebars {{domain "sales@example.com"}} ``` The function returns: ```text example.com ``` The helper returns the text after the first at sign. For example, `{{domain "sales@force@example"}}` returns `force@example`. # Handlebars Helper Function: each Iterates over arrays, lists, and objects, rendering a block for each element. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#each collection}} {{this}} {{/each}} ``` ## Parameters | Parameter | Type | Description | | ------------ | --------------- | ----------------------------------------------------- | | `collection` | Array or Object | Required. The array, list, or object to iterate over. | ## Return Value The function renders the block template for each element in the collection. Within the block, `{{this}}` refers to the current element. The helper provides standard Handlebars loop variables such as `@index`, `@key`, `@first`, and `@last`. # Handlebars Helper Function: encode Calculates a cryptographic hash by using a specified algorithm. Use this helper when you need to select the hashing algorithm with named parameters. **note:** Cryptographic hashes are one-way values and aren't suitable for securely storing passwords or other sensitive data. For new implementations, use SHA-256 or SHA-512. Use MD5 and SHA-1 only for legacy compatibility. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{encode alg=ALGORITHM value=STRING_TO_ENCODE [charset=CHARSET]}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------ | | `alg` | String | Required. The hashing algorithm to use. Specify as a named parameter with one of these values: `md5`, `sha1`, `sha256`, or `sha512`. | | `value` | String | Required. The string to hash. Specify as a named parameter. | | `charset` | String | The character encoding to use. Specify as a named parameter with a value of `UTF-8` or `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns the hash as a lowercase hexadecimal string. The length of the string depends on the selected algorithm. The function throws a `DATA_ATTRIBUTES_ERROR` if a required parameter is missing or if you specify an unsupported algorithm or character encoding. ## Usage Examples This example generates a SHA-256 hash. ```handlebars {{encode alg="sha256" value="Hello World"}} ``` The function returns this SHA-256 hash: ```text a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e ``` This example generates a hash by using UTF-16 character encoding. ```handlebars {{encode alg="sha256" value="Hello World" charset="UTF-16"}} ``` The function returns: ```text 5908535fdaa4eb2d8f5b7b5e237cd0168298eed9d9083caf7d141b3121121157 ``` ## See Also - [MD5](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-md5.md) - [SHA1](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha1.md) - [SHA256](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha256.md) - [SHA512](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-encryption-references/mcn-handlebars-reference-encryption-sha512.md) # Handlebars Helper Function: encodeURI Converts a string to a format that is safe to use in a URL. This function encodes an entire string. To encode only a query string that follows a URL, use [encodeURIComponent](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuricomponent.md). ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{encodeURI stringToEncode onlySpaces=true|false}} ``` ## Parameters | Parameter | Type | Description | | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `stringToEncode` | String | Required. The string to encode. | | `onlySpaces` | Boolean | If `true`, encodes spaces as `%20` and ignores other characters. If `false`, encodes all characters that aren't safe to use in URLs. The default value is `false`. | ## Return Value The function returns the URL-encoded string. ## Usage Example This example encodes a string of text so that it's safe to include in a URL, converting all spaces and special characters. ```handlebars {{encodeURI "Sample Text: example" onlySpaces=false}} ``` The function returns this URL-encoded string: ```text Sample+Text%3a+example ``` ## See Also - [encodeURIcomponent](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuricomponent.md) # Handlebars Helper Function: encodeURIComponent Encodes non-URL components of a string. This function encodes only characters that follow a URL, such as a query string. To encode an entire string, use [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md). ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{encodeURIComponent stringToEncode}} ``` ## Parameters | Parameter | Type | Description | | ---------------- | ------ | ------------------------------- | | `stringToEncode` | String | Required. The string to encode. | ## Return Value The function returns the URL-encoded string. ## Usage Example This example encodes a string of text so that it's safe to include in a URL, converting all spaces and special characters. ```handlebars {{encodeURIComponent "https://www.example.com/app?firstName=Cruz&lastName=De La Rosa&email=cdelarosa@example.com" }} ``` The function returns this URL-encoded string: ```text https://www.example.com/app?firstName=Cruz&lastName=De+La+Rosa&email=cdelarosa%40example.com ``` ## See Also - [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md) # Handlebars Helper Function: equals Compares two values for equality. It can perform different types of comparisons based on an optional third parameter. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{equals value1 value2 compareAs}} ``` ## Parameters | Parameter | Type | Description | | ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------- | | `value1` | Any | The first value to compare. | | `value2` | Any | The second value to compare. | | `compareAs` | String | The type of comparison to perform. Possible values: `date`, `datetime`, `number`, `string`. The default value is `string`. | ## Return Value The function returns `true` if the values are equal based on the specified comparison type, and `false` otherwise. If both values are null, it returns `true`. If no parameters are provided, it returns `true`. If one parameter is missing, it returns `false`. If you don’t specify a comparison type, the function performs a string comparison. # Handlebars Helper Function: fallback Returns the second argument (`fallbackValue`) if the first argument is null, an empty string, or if an exception occurs in code nested within the fallback helper. Otherwise, it returns the first argument. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{fallback value fallbackValue}} ``` ## Parameters | Parameter | Type | Description | | --------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `value` | Any | Required. The primary value to check. | | `fallbackValue` | Primitive | Required. The static value to use if the primary value is null or an exception occurs. Must be a boolean, character, byte, short, integer, long, float, double, or string. | ## Return Value If `value` is `null`, is an empty string, or is an expression that throws an exception, the function returns `fallbackValue`. Otherwise, it returns the value of the `value` parameter. If the value of the `fallbackValue` parameter isn't a primitive type (for example, if it's an array or object), the function throws an exception. # Handlebars Helper Function: filter Filters a list of objects based on a field, comparison operator, and target value. The function supports string, number, and date comparisons. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{filter list fieldName comparisonOperator targetValue filterAs}} ``` ## Parameters | Parameter | Type | Description | | -------------------- | ------ | ------------------------------------------------------------------------------------- | | `list` | Array | Required. The list of objects to filter. | | `fieldName` | String | Required. The field to filter on. | | `comparisonOperator` | String | Required. The comparison operator. See [Comparison Operators](#comparison-operators). | | `targetValue` | Any | Required. The value to compare against. | | `filterAs` | String | Required. The type to filter as. Valid values: `"string"`, `"number"`, `"date"`. | ## Comparison Operators The `comparisonOperator` parameter supports the operators listed in this table for numeric and date comparisons. | Symbolic Operator | Verbose Operator | | ----------------- | --------------------- | | `>` | `GREATER_THAN` | | `<` | `LESS_THAN` | | `==` | `EQUALS` | | `!=` | `NOT_EQUALS` | | `>=` | `GREATER_THAN_EQUALS` | | `<=` | `LESS_THAN_EQUALS` | For string comparisons, the `comparisonOperator` parameter supports these operators: - `CONTAINS` - `IS_NULL` - `IS_NOT_NULL` ## Return Value The function returns a new list containing only the objects that match the filter criteria. If no objects match, it returns an empty list. If a parameter is missing or invalid, the function throws an exception. ## Usage Examples These examples show how to use the `filter` function to filter this example array. ```json [ { "name": "John Doe", "age": 25 }, { "name": "Jane Doe", "age": 42 }, { "name": "Edna Example", "age": 64 } ] ``` ### Numeric Comparison This example filters the array to include only objects where the `age` field is greater than 25. ```handlebars {{filter myList "age" ">" 25 "number"}} ``` The function returns `[{"name": "Jane Doe", "age": 42}, {"name": "Edna Example", "age": 64}]`. ### String Comparison This example filters the array to include only objects where the `name` field contains the string "Doe". ```handlebars {{filter myList "name" "CONTAINS" "Doe" "string"}} ``` The function returns `[{"name": "John Doe", "age": 25}, {"name": "Jane Doe", "age": 42}]`. # Handlebars Helper Function: flatten Transforms a list of lists into a flat list. This function is useful for normalizing nested data structures in templates. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{flatten nestedList}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ----- | --------------------------------------- | | `nestedList` | Array | Required. The list of lists to flatten. | ## Return Value The function returns a new list containing all elements from the nested lists. If the input isn’t a list of lists, or if a parameter is missing or an element isn’t a list, the function throws an exception. ## Usage Examples This example shows how to use the `flatten` function to flatten this example array. ```javascript myArray = [[1, 2], [3, 4], [5]]; ``` To flatten the array, use the `flatten` function, as shown in this example. ```handlebars {{flatten myArray}} ``` The function returns `[1, 2, 3, 4, 5]`. # Handlebars Helper Function: format Formats output based on a format string and optional type specification. It supports formatting dates, numbers, and strings according to specified patterns and culture settings. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{format subject formatString type culture}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `subject` | Any | Required. The value to format. | | `formatString` | String | Required. The format pattern to apply. See [Format Strings](#format-strings). | | `type` | String | The type to format as. Valid values: `"date"`, `"numeric"`. If not specified, uses general string formatting. | | `culture` | String | The culture code for formatting, such as `en-US` or `zh_TW`. Supports both hyphen and underscore formats. Defaults to current runtime culture if not specified. | ## Format Strings The value that you specify for the `formatString` parameter determines the type of formatting to apply to the `subject`. These sections describe the different format strings that you can use. ### Date Format Strings Date formats are highly configurable and can be customized to suit your needs. These sections describe the different format strings that you can use. #### Preformatted Date and Time Strings Use the string patterns listed in this table to format dates and times. The values in the Example Output column are based on the date Monday, March 15, 2024 at 2:30:45 PM in the UTC-6 time zone with the `en_US` culture. | StringPattern | Name | Example Output | | ------------- | ---------------------- | --------------------------------- | | `d` | Short date | 3/15/2024 | | `D` | Long date | Friday, March 15, 2024 | | `f` | Full date/time (short) | Friday, March 15, 2024 2:30 PM | | `F` | Full date/time (long) | Friday, March 15, 2024 2:30:45 PM | | `g` | General (short) | 3/15/2024 2:30 PM | | `G` | General (long) | 3/15/2024 2:30:45 PM | | `M` | Month day | March 15 | | `O` | Round-trip | 2024-03-15T08:30:45.1230000-06:00 | | `R` | RFC1123 | Fri, 15 Mar 2024 14:30:45 GMT | | `s` | Sortable | 2024-03-15T08:30:45 | | `t` | Short time | 2:30 PM | | `T` | Long time | 2:30:45 PM | | `u` | Universal sortable | 2024-03-15 14:30:45Z | | `U` | Universal full | 2024-03-15T14:30:45.0Z | | `Y` | Year month | March 2024 | #### Date Components Use the string patterns listed in this table to format dates. The values in the Example column are based on the date Monday, March 15, 2024 at 2:30:45 PM in the UTC-6 time zone with the `en_US` culture. | String Pattern | Description | Example | Valid Range | | -------------- | -------------------------- | ------- | ----------------- | | `yyyy` | 4-digit year | 2024 | 0001–9999 | | `yyy` | 3-digit year (minimum) | 2024 | 001–999 | | `yy` | 2-digit year | 24 | 00–99 | | `y` | 1-digit year (minimum) | 2024 | 1–9999 | | `MMMM` | Full month name | March | Culture-dependent | | `MMM` | Abbreviated month name | Mar | Culture-dependent | | `MM` | 2-digit month | 03 | 01–12 | | `M` | Month without leading zero | 3 | 1–12 | | `dddd` | Full day of week | Friday | Culture-dependent | | `ddd` | Abbreviated day of week | Fri | Culture-dependent | | `dd` | 2-digit day | 15 | 01–31 | | `d` | Day without leading zero | 15 | 1–31 | #### Time Components Use the string patterns listed in this table to format times. The values in the Example column are based on the time 2:30:45 PM in the UTC-6 time zone with the `en_US` culture. | String Pattern | Description | Example | Valid Range | | -------------- | ---------------------------- | ------- | ----------------- | | `HH` | 24-hour format (2-digit) | 14 | 00–23 | | `H` | 24-hour format (1-digit min) | 14 | 0–23 | | `hh` | 12-hour format (2-digit) | 02 | 01–12 | | `h` | 12-hour format (1-digit min) | 2 | 1–12 | | `mm` | Minutes (2-digit) | 30 | 00–59 | | `m` | Minutes (1-digit min) | 30 | 0–59 | | `ss` | Seconds (2-digit) | 45 | 00–59 | | `s` | Seconds (1-digit min) | 45 | 0–59 | | `fff` | Milliseconds (3-digit) | 123 | 000–999 | | `ff` | Centiseconds (2-digit) | 12 | 00–99 | | `f` | Deciseconds (1-digit) | 1 | 0–9 | | `tt` | AM/PM designator | PM | Culture-dependent | | `t` | First char of AM/PM | P | Culture-dependent | #### Date Literals and Separators You can further format dates and times using these literals and separators. | String Pattern | Description | Example | | -------------- | ---------------------------- | ------- | | `'text'` | Literal text (single quotes) | 'of' | | `"text"` | Literal text (double quotes) | "the" | | `/` | Date separator | / | | `:` | Time separator | : | | `-` | Dash separator | - | | ` ` | Space | (space) | ### Numeric Format Strings You can customize the way that numbers are formatted by using predefined or custom format strings. #### Predefined Numeric Format Strings Use the string patterns listed in this table to format numbers. The values in the Example columns are based on the `en_US` culture setting. | Pattern | Name | Example (1234.567) | Example (-1234.567) | Notes | | ----------- | ------------------------- | ------------------ | ------------------- | -------------------------------------------------------------- | | `C` or `C2` | Currency | \$1,234.57 | (\$1,234.57) | Uses the specified culture's currency symbol and formatting. | | `C0` | Currency (no decimals) | \$1,235 | (\$1,235) | Rounds to nearest integer. | | `C4` | Currency (4 decimals) | \$1,234.5670 | (\$1,234.5670) | Zero-padded to 4 decimal places. | | `D` | Decimal | 1235 | -1235 | Rounds to nearest integer. | | `D8` | Decimal (8 digits) | 00001235 | -00001235 | Left-padded with zeros to 8 digits. | | `E` or `E2` | Scientific | 1.23E+003 | -1.23E+003 | Exponential notation with an uppercase 'E'. | | `e3` | Scientific (lowercase) | 1.235e+003 | -1.235e+003 | Exponential notation with a lowercase 'e'. | | `F` or `F2` | Fixed-point | 1234.57 | -1234.57 | Doesn’t include a thousands separator. | | `F0` | Fixed-point (no decimals) | 1235 | -1235 | Rounds to nearest integer. | | `F6` | Fixed-point (6 decimals) | 1234.567000 | -1234.567000 | Zero-padded to 6 decimal places. | | `G` | General | 1234.567 | -1234.567 | | | `N` or `N2` | Number | 1,234.57 | -1,234.57 | Includes a thousands separator based on the specified culture. | | `N0` | Number (no decimals) | 1,235 | -1,235 | Rounds to nearest integer. | | `P` or `P2` | Percent | 123,456.70% | -123,456.70% | | | `P0` | Percent (no decimals) | 123,457% | -123,457% | Rounds to nearest integer. | | `R` | Round-trip | 1234.567 | -1234.567 | Preserves precision. | | `X` | Hexadecimal | 4D2 | Error | Numbers A-F are shown in uppercase. | | `X8` | Hexadecimal (8 digits) | 000004D2 | Error | Numbers A-F are shown in uppercase. Zero-padded to 8 digits. | | `x` | Hexadecimal (lowercase) | 4d2 | Error | Numbers A-F are shown in lowercase. | #### Custom Numeric Format Strings When you specify a custom numeric format string, use either `#` or `0` as a placeholder for the digits in the number. Use the custom format strings listed in this table to format numbers. The values in the Example columns are based on the `en_US` culture setting. | Pattern | Description | Example (1234.567) | Example (0.567) | | --------------------------------------------- | ------------------- | ------------------ | --------------- | | `.` | Decimal point | 1234.567 | 0.567 | | `,` | Thousands separator | 1,234.567 | 0.567 | | `%` | Percentage | 123456.7% | 56.7% | | `‰` | Per mille | 1234567‰ | 567‰ | | `E0` | Scientific notation | 1.234567E3 | 5.67E-1 | | `` | Literal string | 1234.567 units | 0.567 units | | `\` | Escape character | 1234.567\% | 0.567\% | To specify separate formats for positive, negative, and zero values, use the `;` character. For example, `{{format 1234.567, "N2;N0;N2"}}` returns `1,234.57`, and `{{format -1234.567, "N2;(F2);N0"}}` returns `(1,234.57)`. This table includes examples of custom numeric formatting strings. | Format String | Input | Output | Description | | ------------------ | -------- | --------- | ------------------------------- | | `#,##0.00` | 1234.567 | 1,234.57 | Standard number with 2 decimals | | `#,##0` | 1234.567 | 1,235 | Rounded to whole number | | `000000` | 123 | 000123 | Zero-padded to 6 digits | | `###.###` | 123.456 | 123.456 | Optional digits | | `#.##;(#.##);Zero` | -123.45 | (123.45) | Negative format section | | `#.##;(#.##);Zero` | 0 | Zero | Zero format section | | `# 'units'` | 123 | 123 units | Literal text | | `#.##%` | 0.1234 | 12.34% | Percentage | | `#.##‰` | 0.1234 | 123.4‰ | Per mille | ### String Formatting When the `type` parameter is omitted or is set to `string`, these rules apply: - If the `formatString` parameter is empty, the string is returned as-is. - If any format string value is provided, the value is treated as a string template placeholder. - If formatting fails, an exception is thrown. These rules are applied when formatting strings: 1. All format patterns are case-sensitive. 2. Literal text must be enclosed in single or double quotes. 3. Use a backslash (`\`) to escape special characters. 4. If a pattern isn’t valid, an exception is thrown. 5. Date patterns work only with date types, and numeric patterns workonly with numbers. 6. Some patterns, such as day and month names, vary by culture. 7. Numbers can have up to 15 significant digits. 8. Use semicolon (`;`) to separate positive, negative, and zero formats. ### Culture and Locale Specification Use the `culture` parameter to specify the culture to use for formatting. These locale codes are supported: - `en-US` (English - United States) - `en-GB` (English - United Kingdom) - `fr-FR` (French - France) - `de-DE` (German - Germany) - `es-ES` (Spanish - Spain) - `ja-JP` (Japanese - Japan) - `zh-CN` (Chinese - China) - `zh-TW` (Chinese - Taiwan) The `culture` value determines the date format conventions, currency symbols, decimal separators, thousands separators, day names, and month names that are used for formatting. ## Return Value The function returns the formatted value as a string. If formatting fails, it returns the original value as a string (backward compatibility). All format strings are case-sensitive. ## See Also - [FormatCurrency](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatcurrency.md) - [FormatNumber](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatnumber.md) # Handlebars Helper Function: formatCurrency The `formatCurrency` helper function formats a number as a currency value. This function is a convenience function that calls `formatNumber` with the currency format type. It throws an error if the input can't be converted to a number. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{formatCurrency number cultureCode}} ``` ## Parameters | Parameter | Type | Description | | ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `number` | Number or String | Required. The number to format as a currency value. If the value is a string, it must be convertible to a number. | | `cultureCode` | String | A POSIX locale code for currency formatting, such as `en_US` or `zh-TW`. The operation supports both hyphen (`fr-CA`) and underscore (`fr_CA`) formats. If you don’t specify a culture code, the operation uses `en_US`. | ## Return Value The operation returns a formatted string representation of the number as a currency value, using the specified locale’s currency format. Different locales use different currency symbols, decimal separators, and grouping patterns. For example, `{{formatCurrency 1234.56 "en-US"}}` returns `$1,234.56`, while `{{formatCurrency 1234.56 "de-DE"}}` returns `1.234,56 €`. Different locales handle the rounding of currency values in different ways. For example, Japanese Yen is usually expressed without decimal places, so `{{formatCurrency 1234.56 "ja-JP"}}` returns `¥1,235`. If the input can’t be converted to a number, the operation throws an exception. This behavior helps you handle conversion errors gracefully by using the [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-fallback.md) helper, as shown in this example. ```handlebars {{fallback (formatCurrency orderTotal) "Amount not available"}} ``` In this example, if `orderTotal` can’t be converted to a number, the operation returns `Amount not available`. ## See Also - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-fallback.md) - [format](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-format.md) - [formatNumber](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatnumber.md) # Handlebars Helper Function: formatNumber Formats a number as a specific numeric type, such as a decimal, currency, or percentage value. It can convert numbers stored in strings to a number data type and round numbers to a certain number of decimal places. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{formatNumber number formatType cultureCode}} ``` ## Parameters | Parameter | Type | Description | | ------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `number` | Number or String | Required. The number to format. Must be convertible to a valid number. Assumes period (.) as decimal separator for string inputs. | | `formatType` | String | Required. The number format type. See [Format Types](#format-types). | | `cultureCode` | String | POSIX locale code for formatting, such as `en_US` or `zh-TW`. Supports both hyphen and underscore formats. The default is `en_US`. | ## Format Types This table lists the format types that you can use with the `formatType` parameter. | Format Type | Description | | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `C` | Formats the number as a currency value. | | `D` | Formats the number as a decimal number. | | `E` | Formats the number using scientific notation. | | `F` | Formats the number to a fixed number of decimal places. If you don't specify a number of decimal places, two decimal places are used. | | `G` | Formats the number without thousands separators. | | `N` | Formats the number with thousands separators. | | `P` | Formats the number as a percentage. | | `R` | Formats the number as a round-trip value. This format ensures that the value parsed from a string can be parsed back to a numeric value. | | `X` | Formats the number as a hexadecimal value. | Optionally, include a number after the format type to indicate the precision of the output. For example, `C2` formats the number as a currency value with 2 decimal places, so `{{formatNumber 1234.567 "C2"}}` returns `$1,234.57`. ## Return Value The function returns a formatted string representation of the number using the specified format type and culture. When the input can’t be converted to a valid number, it returns an empty string (backward compatibility). Invalid format types and locale codes throw exceptions. Different cultures use different decimal separators, grouping patterns, and currency symbols. ## See Also - [formatCurrency](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatcurrency.md) - [format](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-format.md) # Handlebars Helper Function: get Retrieves a value from a list or map by index or key. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{get collection indexOrKey}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ----------------- | ------------------------------------------------------------------------------ | | `collection` | List or Map | Required. The list or map to retrieve from. | | `indexOrKey` | Integer or String | Required. The index to retrieve from a list or the key to retrieve from a map. | ## Return Value The function returns the value at the specified index or key. If the index or key isn’t found, or if the collection type is invalid, the function throws an exception. ## Usage Examples These examples show how to use the `get` function to retrieve a value by index or key from a list or map. ### Get Value by Index This example shows how to use the `get` function to get the value at the specified index. Note that the first element is at index 0. ```javascript myList = ["apple","banana","cherry"]; {{get myList 1}} ``` The function returns `banana`. ### Get Value by Key You can also use the `get` function to retrieve a value by key from a map. ```javascript myMap = {"apple": "red", "banana": "yellow", "orange": "orange"}; {{get myMap "banana"}} ``` The function returns `yellow`. ### Get Nested Value The `get` function is also helpful for retrieving nested values from lists or maps. ```javascript myList = [{"apple": "red"}, {"banana": "yellow"}, {"orange": "orange"}]; {{get (get myList 1) "banana"}} ``` The function returns `yellow`. # Handlebars Helper Function: getContentBlock Retrieve and render a content block within a template. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{getContentBlock key="contentKey"}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ----------------------------------------------------------------- | | `key` | String | Required. The unique identifier of the content block to retrieve. | ## Return Value The function returns the rendered content of the specified content block. For HTML rendering contexts, it returns the HTML part of the content. For other contexts, it returns the text part. If the content block can't be retrieved, the function throws an exception. ## Locale Support The helper automatically extracts the locale from the rendering context. If any language-specific content variants are available, the function retrieves them based on the locale information. ## Usage Examples This example retrieves and renders a content block. ```handlebars {{getContentBlock key="abc123"}} ``` ### Providing a Fallback Value The function throws an exception if the specified content block doesn't exist, so it's a good idea to provide a fallback. This example provides a default if the content block isn't found. ```handlebars {{fallback (getContentBlock key="footerblock") "Copyright 2026 Northern Trail Outfitters"}} ``` ### Using in Conditional Blocks It's often useful to render specific content blocks based on the properties of the recipient. This example conditionally includes a content block when a variable evaluates to `true`. ```handlebars {{#if isPreferredCustomer}} {{getContentBlock key="preferred-customer-banner"}} {{/if}} ``` ## See Also - [Fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) - [If](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/comparison/mcn-handlebars-reference-comparison-if.md) # Handlebars Helper Function: guid Generates a 128-bit hexadecimal globally unique identifier (GUID). ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{guid}} ``` ## Parameters This helper doesn't accept any parameters. If you pass parameters, they're ignored. ## Return Value The function returns a GUID, such as `c4642f98-8d01-44da-b075-8e6c6a4c17c2`. ## Usage Example This example generates a GUID. ```handlebars {{guid}} ``` # Handlebars Helper Function: hash Constructs an object from key-value pairs. Use this helper as a subexpression to pass structured data as a named parameter to other functions, such as [queryFirst](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/data/mcn-handlebars-reference-data-queryfirst.md). **note:** Use this helper only as a subexpression within other functions. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax There are two ways to specify values for this helper. You can specify values by using the equals operator, as in this example: ```handlebars (hash key1=value1 key2=value2 ...) ``` You can also specify values by using positional pairs of keys and values: ```handlebars (hash key1 value1 key2 value2 ...) ``` ## Return Value The function returns a map (`LinkedHashMap`) that contains all of the specified key-value pairs. The function preserves the order of the key-value pairs. ## Usage Examples This example creates a simple object that contains literal values. ```handlebars {{hash name="Alice" age=30}} ``` The function returns a simple hashmap object: `{name=Alice, age=30}`. ### Using Variable References You can specify variables as key values, as shown in this example: ```handlebars {{hash greeting=firstName status="active"}} ``` The returned object includes the value of the `firstName` variable for the `greeting` key. ### Using with QueryFirst This example uses the `hash` helper to provide search parameters to the `queryFirst` helper. ```handlebars {{queryfirst type="CRM" object="Account" where="Name LIKE :search" params=(hash search="Acme%")}} ``` ## See Also - [query](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-query.md) - [queryFirst](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-queryfirst.md) # Handlebars Helper Function: if Conditionally renders a block based on whether a value evaluates to `true`. This built-in helper is provided by the Handlebars.Net library. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#if condition}} {{else if condition2}} {{else}} {{/if}} ``` ## Parameters | Parameter | Type | Description | | ----------- | ---- | -------------------------------- | | `condition` | Any | Required. The value to evaluate. | ## Return Value The function renders the block template if the condition evaluates to `true`. If an `{{else}}` block is provided, it renders that block when the condition evaluates to `false`. The helper also supports `{{else if}}` blocks for multiple conditions. ## See Also - _Github_: [Handlebars.Net](https://github.com/Handlebars-Net/Handlebars.Net) - _Handlebars Language Guide_: [Built-in Helpers](https://handlebarsjs.com/guide/builtin-helpers.html#if) # Handlebars Helper Function: iif Evaluates an expression and returns one of two values based on whether the expression is `true` or `false`. This function works similarly to a ternary operator in other programming languages. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{iif expression leftResult rightResult}} ``` ## Parameters | Parameter | Type | Description | | ------------- | ---- | --------------------------------------------------------------------- | | `expression` | Any | Required. The expression to evaluate. | | `leftResult` | Any | Required. The value to return if the expression evaluates to `true`. | | `rightResult` | Any | Required. The value to return if the expression evaluates to `false`. | ## Return Value The function returns `leftResult` if the expression evaluates to true according to truthiness rules, otherwise returns `rightResult`. Truthiness evaluation follows these rules: `null` is `false`; boolean values are returned as-is; `0` is `false`, any non-zero number is `true`; empty string `""` is `false`, any non-empty string is `true`; empty arrays `[]` and empty objects `{}` are `false`. Both `leftResult` and `rightResult` are always evaluated, regardless of which is returned. # Handlebars Helper Function: indexOf Returns the character position where a search string exists within a subject string. The search is case-insensitive and uses 1-based indexing. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{indexOf subject search}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------ | | `subject` | String | Required. The string to search within. | | `search` | String | Required. The string to find within the subject. | ## Return Value The function returns the 1-based position where the search string is found in the subject string. If the search string isn’t found or if either parameter is null, it returns 0. The search is case-insensitive. # Handlebars Helper Function: isEmailAddress Tests whether an email address is structurally valid. **note:** This helper doesn't verify that an email address or domain exists. It only checks whether the supplied address aligns with the standardized structure of an email address. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{isEmailAddress emailAddress}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ------ | ------------------------------------ | | `emailAddress` | String | Required. The email address to test. | ## Return Value The function returns `true` if `emailAddress` is structurally valid. Otherwise, it returns `false`. ## Usage Example This example checks whether an email address is structurally valid. ```handlebars {{isEmailAddress "tomas.santos@example.org"}} ``` The function returns `true`. This table lists results for several other examples, and explains why an example returns `true` or `false`. | Function Call | Result | Notes | | --------------------------------------------------- | ------- | ------------------------------------------------------------------------- | | `{{isEmailAddress "pooja.chatterjee@example.com"}}` | `true` | | | `{{isEmailAddress "pooja.chaterjee@example"}}` | `true` | An email domain can omit a top-level domain, such as `.com`. | | `{{isEmailAddress "pooja.chatterjeeexample.com"}}` | `false` | This address is missing an at sign. | | `{{isEmailAddress "pooja@chatterjee@example.com"}}` | `false` | This address contains two at signs. | | `{{isEmailAddress "@example.com"}}` | `false` | This address is missing the local part, which appears before the at sign. | | `{{isEmailAddress "pooja.chatterjee@.com"}}` | `false` | This address is missing a second-level domain. | # Handlebars Helper Function: isEmpty Checks if a specified parameter evaluates to null or empty. It returns `true` if the parameter is null, undefined, or an empty string, and `false` otherwise. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{isEmpty input}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---- | ------------------------------------- | | `input` | Any | The value to check for null or empty. | ## Return Value The function returns `true` if the specified parameter is `null`, `undefined`, or an empty string. It returns `false` for all other values including zero values, non-empty strings, boolean values, and non-empty objects and arrays. If the `input` parameter is missing, or if the parameter references a non-existent variable, it returns `true`. This function is often used together with conditional helpers to handle empty values. For example, this code example checks if the `firstName` variable is empty and handles it accordingly. ```handlebars {{#if (isEmpty firstName)}} Hello friend! {{else}} Hello {{firstName}}! {{/if}} ``` ## See Also - [If](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-if.md) - [With](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-with.md) # Handlebars Helper Function: isNullDefault Returns a default value when the first value is null. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{isNullDefault nonNullValue nullValue}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ---- | ------------------------------------------------------------------ | | `nonNullValue` | Any | Required. The value to return when it isn't null. | | `nullValue` | Any | Required. The default value to return when `nonNullValue` is null. | ## Return Value The function returns `nonNullValue` unless the value is null. When `nonNullValue` is null, it returns `nullValue`. ## Usage Example This example returns a customer's membership tier, returning `Basic` if the value of `tier` is null. ```handlebars {{isNullDefault tier "Basic"}} ``` If the `tier` variable resolves to any value, such as `"Premium"`, the function returns that value. ``` Premium ``` If `tier` is null, the function returns the fallback value. ``` Basic ``` # Handlebars Helper Function: jsonpath Use JSONPath expressions to query and filter JSON objects. Use this helper to extract specific values or arrays from complex JSON objects. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{jsonpath object expression}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ------------------------ | -------------------------------------------------------------------------------------------------- | | `object` | Object, Array, or String | Required. The JSON object, array, or JSON string to query. | | `expression` | String | Required. The JSONPath expression to apply to the object. All JSONPath expressions begin with `$`. | ### JSONPath Syntax The `expression` parameter can include these JSONPath patterns: - `$.field` — Access a property in the top level of the object. - `$.a.b` — Access a nested property by specifying its path. - `$[x]` — Access an array element by its index. Arrays are zero-indexed, so the first item in the array is item `0`. - `$[x:y]` — Select a range of array elements. The starting element of the range is zero-indexed and inclusive, and the ending element is exclusive, so [0:3] returns the first three objects in the array. - `$[-1]` — Access the final element in an array. - `$[*]` — Select all elements in an array. - `$..field` — Find all values of the specified field, regardless of its level in the parent object. This pattern is known as recursive descent. - `$[?(expr)]` — Filter the expression by specifying a field, operator, and value. ### Filter Operators When you use the `$[?(expr)]` syntax to filter an expression, the filter can contain these operators: - `==` — equality - `!=` — inequality - `<` — less than - `>` — greater than - `<=` — less than or equal to - `>=` — greater than or equal to - `&&` — logical AND - `||` — logical OR - `=~` — regular expression (regex) match ## Return Value The data type of the return value depends on the JSONPath expression. Definite paths, which are expressions that refer to a single value, return the value itself. The data type of the value can be a string, number, boolean, object, or array. If the specified value isn’t found, the function throws an exception. Indefinite paths, which are expressions that include wildcards and filters, return an array of matching values. If no matches are found, the function returns an empty array `[]`. ## Usage Examples To access a nested property from an object, use dot notation, as shown in these examples. ```handlebars {{jsonpath subscriber "$.firstName"}} {{jsonpath subscriber "$.address.city"}} ``` The functions return the properties from the specified object. If the specified properties don’t exist, the function throws an exception. ### Array Operations You can use this function to access data in arrays, as shown in this example: ```handlebars {{jsonpath items "$[0:3]"}} ``` The function returns an array that contains the first three objects from the `items` array. ### Wildcard Selection This example selects all elements in the `items` array. ```handlebars {{jsonpath products "$.items[*]"}} ``` ### Recursive Descent This example finds all occurrences of the `price` field, regardless of their level in the parent object. ```handlebars {{jsonpath data "$..price"}} ``` ### Filter Expression This example filters the parent object to include only elements from the `items` array where the value of the `price` field is greater than 100. ```handlebars {{jsonpath products "$.items[?(@.price > 100)]"}} ``` ## See Also - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) - [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-get.md) - [length](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-length.md) - [each](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-each.md) # Handlebars Helper Function: length Returns the number of characters in a specified string or the number of elements in an array. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{length subject}} ``` ## Parameters | Parameter | Type | Description | | --------- | --------------- | ---------------------------------------------------- | | `subject` | String or Array | Required. The string or array to find the length of. | ## Return Value The function returns the number of characters in the input string or the number of elements in the input array. If the input is null, it returns 0. When measuring strings, the function counts all characters including spaces, punctuation, and special characters. Non-string inputs are converted to strings before counting. The function counts Unicode code units (UTF-16 length), so surrogate pairs count as 2 units. # Handlebars Helper Function: lookup Dynamically access an object property or array element by specifying a variable. Unlike dot notation (`{{object.property}}`), which requires a literal property name, you can use `lookup` to determine the property name or array index at run time. This function is based on the [Handlebars.js lookup helper](https://handlebarsjs.com/guide/builtin-helpers.html#lookup). ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{lookup object key}} ``` ## Parameters | Parameter | Type | Description | | --------- | ----------------- | ------------------------------------------------------- | | `object` | Object or Array | Required. The object or array to look up a value from. | | `key` | String or Integer | Required. The property name or array index to retrieve. | ## Return Value The return value has the same data type as the retrieved property. If the key doesn't exist or the index is out of bounds, the function returns `undefined`. An undefined property renders as an empty string. ## Usage Examples This example looks up a property in an object. ```handlebars {{lookup user "name"}} ``` The function returns the value of the `name` property in the `user` object. ### Dynamic Property Access You can use a variable to determine which property to access. This example loops through the field names in the `data` object and performs a lookup on each one. ```handlebars {{#each fields}} {{lookup ../data this}} {{/each}} ``` ### Array Index Lookup You can use this function to return an array element by index. This example returns the first element in the `items` array (the first element in an array is `0`). ```handlebars {{lookup items 0}} ``` ### Using Loop Index This example uses the loop index to access the previous item. ```handlebars {{#each items}} Previous: {{lookup ../items (subtract @index 1)}} Current: {{this}} {{/each}} ``` ### Accessing Root Properties Dynamically This example looks up a property name from the root context. ```handlebars {{lookup @root propertyName}} ``` ### Nested Lookup You can chain multiple lookup operations together. This example looks up the value of `category` in the `data` object. In that result, it returns the value of the `itemName` property. ```handlebars {{lookup (lookup data category) itemName}} ``` ## See Also - [Get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-get.md) - [Each](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-each.md) - [With](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-with.md) # Handlebars Helper Function: lowercase Converts all letters in a string to lowercase. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{lowercase subject culture}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `subject` | String | Required. The string to convert to lowercase. | | `culture` | String | A POSIX locale code for culture-specific case conversion, such as `tr-TR`. This parameter is helpful with Turkic languages in which the dotless capital letter `I` is converted to a dotless lowercase letter `ı`, as opposed to the lowercase letter `i` found in other Latin alphabets. The operation supports both hyphen (`az-AZ`) and underscore (`az_AZ`) formats. If you don’t specify a culture code, the operation uses the current system culture. | ## Return Value The operation returns the input string with all characters converted to lowercase. If the input is null, the operation returns an empty string. If the input isn’t a string, the operation converts it to a string and converts all characters to lowercase. # Handlebars Helper Function: map Extracts a specific field from each object in a list, returning a list of those field values. It supports both simple arrays and complex object structures. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{map list fieldName}} ``` ## Parameters | Parameter | Type | Description | | ----------- | ------ | ----------------------------------------------------------------------------------------------------------------- | | `list` | Array | Required. The list of objects to map. | | `fieldName` | String | Required. The field to extract from each object. If the field doesn’t exist in an object, that object is skipped. | ## Return Value The function returns a new list containing the values of the specified field from each object in the input list. If the specified field isn’t present in an object, that object is skipped. If a parameter is missing or an element in the list isn’t a valid map, the function throws an exception. ## Usage Examples This example shows how to use the `map` function to extract the `age` field from each object in the list. ```javascript myList = [ { "name": "D’Angelo", "country": "Sweden", "age": 30 }, { "name": "Miguel", "country": "Canada", "age": 25 }, { "name": "Lakshmi", "country": "United States" } ]; {{map myList "age"}} ``` The function returns `[30, 25]`. ### Chaining with Other Functions You can chain the `map` function with other functions such as `filter`, `sort`, and `flatten`. ```javascript myList = [{"name": "D’Angelo", "age": 24}, {"name": "Miguel", "age": 27}, {"name": "Lakshmi", "age": 26}]; {{map (filter myList "age" ">" 25 "number") "name"}} ``` The function returns `["Miguel", "Lakshmi"]`. ### Complex Object Structures With complex nested objects, use the `flatten` function to flatten the nested objects before you map the values, as shown in this example. ```javascript myList = { "orders": [ { "items": [ {"name": "Reticulated Widget", "price": 100}, {"name": "Quantum Toaster", "price": 200} ] }, { "items": [ {"name": "Retro Encapsulator", "price": 300} ] } ] }; {{map (flatten (map myList "items")) "price"}} ``` The function returns `[100, 200, 300]`. ## See Also - [Flatten](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-flatten.md) - [Map](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-map.md) # Handlebars Helper Function: md5 Converts a string to a 128-bit hexadecimal MD5 hash. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{md5 STRING_TO_CONVERT charset=CHARSET}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | | `STRING_TO_CONVERT` | String | Required. The string to hash. | | `charset` | String | The character set to use. Specify as a named parameter. Accepted values are `UTF-8` and `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns the 128-bit MD5 hash as a hexadecimal string. ## Usage Example This example hashes a string of text so that the plain-text value isn't stored or transmitted directly. ```handlebars {{md5 "This is a string of text."}} ``` The function returns this MD5 hash: ```text 7ccb47715d465a9e6a2b7d3c0441da80 ``` ### Using UTF-16 Encoding This example hashes the same string, but specifies UTF-16 encoding. ```handlebars {{md5 "This is a string of text." charset="UTF-16"}} ``` Because the character encoding changes the bytes that are hashed, the function returns a different hash: ```text 3251ab3b9d54f085f6b57aa3bc134c3c ``` **note:** MD5 is a one-way hash and isn't suitable for securely storing passwords or other sensitive data. # Handlebars Helper Function: modulo Performs the modulo operation on two numeric arguments and returns the remainder. The function can handle both integer and floating-point numbers, and attempts to convert strings to numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{modulo value1 value2}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---------------- | -------------------------------------------------------------------------------------------------- | | `value1` | Number or String | Required. The first value (dividend). Must be a number or convertible to a number. | | `value2` | Number or String | Required. The second value (divisor). Must be a number or convertible to a number, and can’t be 0. | ## Return Value The function returns the remainder of the division operation. If you provide more than two arguments, the operation uses only the first two. The result is always a number rounded to 2 decimal places. If you divide by 0, the operation throws an exception. If either input is a string, the operation tries to convert it to a number. If a string value can’t be converted to a number, the operation throws an exception. Division by zero throws an exception. # Handlebars Helper Function: multiply Multiplies two numeric arguments and returns their product. The function can handle both integers and floating-point numbers, and attempts to convert strings to numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{multiply value1 value2}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---------------- | ------------------------------------------------------------------------------------ | | `value1` | Number or String | Required. The first value to multiply. Must be a number or convertible to a number. | | `value2` | Number or String | Required. The second value to multiply. Must be a number or convertible to a number. | ## Return Value The function returns the arithmetic product of the two input values. If you provide more than two arguments, the operation multiplies only the first two. The result is always a number rounded to 2 decimal places. If either input is a string, the operation tries to convert it to a number. If a string value can’t be converted to a number, the operation throws an exception. # Handlebars Helper Function: not Performs a logical NOT operation on a value. The function returns `true` if the operand evaluates to `false`, or `false` if the operand evaluates to `true`. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{not value}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---- | -------------------------------------------------- | | `value` | Any | The operand to perform a logical NOT operation on. | ## Return Value The function returns `true` if the operand evaluates to `false`, and `false` if the operand evaluates to `true`. If you don’t provide a parameter, the function returns `true`. The evaluation follows these rules: - `null` is `false`. - Boolean values are returned as-is. - `0` is `false`. Any non-zero number is `true`. - An empty string is `false`, and a non-empty string is `true`. - Empty arrays and empty objects are `false`. Non-empty arrays and objects are `true`. - Other values are treated as `false`. # Handlebars Helper Function: now Returns the current date and time. This function takes no parameters and always returns the current server timestamp. You can’t specify a time zone for this function. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{now}} ``` ## Parameters This function doesn’t accept any parameters. If you pass parameters, they’re ignored. ## Return Value The function returns the current server date and time as a date-time value in Coordinated Universal Time (UTC). The output resembles this example: `2026-05-01T15:01:13`. # Handlebars Helper Function: or Performs a logical OR operation between multiple values. Returns `true` if at least one operand is truthy, `false` if all are falsy. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{or value1 value2 [value3 value4 ...]}} ``` ## Parameters | Parameter | Type | Description | | --------------------- | ---- | ---------------------------------------- | | `value1` | Any | The first operand for the OR operation. | | `value2` | Any | The second operand for the OR operation. | | `value3, value4, ...` | Any | Additional operands to evaluate. | ## Return Value The function returns `true` if at least one parameter is truthy, and `false` if all are falsy. If no parameters are provided, it returns `false`. If one parameter is provided, it returns its truthiness value. This function returns boolean values only (`true` or `false`). For fallback value selection (returning the first truthy value), use conditional logic with `{{iif}}` helper instead. Truthiness evaluation follows these rules: `null` is `false`; boolean values are returned as-is; `0` is `false`, any non-zero number is `true`; empty string `""` is `false`, any non-empty string is `true`; empty arrays `[]` and empty objects `{}` are `false`, non-empty are `true`; other values are treated as `false`. # Handlebars Helper Function: personalizationResult Retrieves personalized content or data based on subscriber information and campaign context. Use this function to dynamically customize email content campaigns by accessing personalization data from the subscriber context. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{personalizationResult key}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `key` | String | Required. The personalization key to retrieve. The key must be a valid identifier string that contains only alphanumeric characters and underscores and must start with a letter or underscore. | ## Return Value The function returns the personalized value associated with the key from the personalization data. If the key isn’t found, it returns an empty string. If the key exists but contains `null`, the function returns `null`. The function doesn’t throw exceptions. ## Usage Examples To retrieve a personalized value, use the `personalizationResult` function with the key of the personalized value you want to retrieve. ```handlebars {{personalizationResult "welcome_message"}} ``` You can use this function together with conditional helpers to render content based on the personalized value. This example checks if the subscriber is a premium member and renders exclusive premium content if they are. ```handlebars {{#if (personalizationResult "isPremiumMember")}}

Exclusive premium content here

{{else}}

Standard content for all subscribers

{{/if}} ``` # Handlebars Helper Function: propercase Capitalizes the first letter of each word in a string and converts all other letters to lowercase. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{propercase subject culture}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `subject` | String | Required. The string to convert to proper case. | | `culture` | String | A POSIX locale code for culture-specific case conversion, such as `tr-TR`. This parameter is helpful with Turkic languages in which the dotless capital letter `I` is converted to a dotless lowercase letter `ı`, as opposed to the lowercase letter `i` found in other Latin alphabets. The operation supports both hyphen (`az-AZ`) and underscore (`az_AZ`) formats. If you don't specify a culture code, the operation uses the current system culture. | ## Return Value The operation returns the input string with the first letter of each word capitalized and all other letters converted to lowercase. If the input is null, the operation returns an empty string. If the input isn't a string, the operation converts it to a string and applies proper case conversion. # Handlebars Helper Function: query Retrieves multiple records from Sales Cloud or marketing object data sources. Use this helper to fetch arrays of records based on criteria that you specify. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{query type=CRM|MO object=OBJECT_NAME [id=SALESFORCE_ID] [fields=FIELD_1, ...FIELD_N] [sortBy=FIELDNAME ASC|DESC] [limit=LIMIT] [where=FILTER] [params=PARAMS]}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `object` | String | Required. The API name of the target object. Specify as a named parameter with a value equal to the name of the object to query. | | `type` | String | Required. The type of data source to query. Specify as a named parameter with one of these values: `CRM` (for Sales Cloud objects) or `MO` (for marketing objects). | | `fields` | String | A comma-separated list of field names to retrieve from the matching records. | | `id` | String | The Salesforce ID of the target object. Use this parameter only when `type` is `CRM`. | | `limit` | Integer | The maximum number of records to return in the query. If the value of `type` is `CRM`, the default value is 100. | | `params` | Object | Parameter values for `where` placeholders. Every parameter name in the `where` clause must have a corresponding key. See [Params Values](#params-values). | | `sortBy` | String | Indicates the sort order to apply to results. Specify a field name followed by `ASC` (ascending order) or `DESC` (descending order). Use this parameter only when `type` is `CRM`. The default sort order is `ASC`. | | `where` | String | A filter for the query. Use `:paramName` placeholders. Can’t be combined with inline field conditions or the `id` parameter. See [Where Clause Syntax](#where-clause-syntax). | ### Where Clause Syntax The `where` parameter supports these elements: - Operators: `=`, `!=`, `<`, `>`, `<=`, `>=`, `LIKE` - Logic: `AND` and `OR` - Placeholders: `:paramName` values that match keys in the `params` object You can use parentheses to create logical groupings. For example, to add a filter that includes active records and either the Revenue value or the CreationDate value is greater than a specified parameter, use `Status = "Active" AND (Revenue > 100000 OR CreationDate > "2025-01-01")`. ### Params Values Use the [hash](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-hash.md) function to specify parameters. This example uses the `hash` function to create an object with two properties: `name` and `status`. The `where` statement then refers to these parameters. ```handlebars {{query type="CRM" object="Account" fields="Name" where="Name LIKE :name AND Status = :status" params=(hash name=firstName status="Active") }} ``` ## Return Value The function returns an array of matching records. If no records match the criteria, it returns an empty array `[]`. ## Usage Examples This example retrieves results from the Contact object that match a specific ID in Sales Cloud. ```handlebars {{query type="CRM" object="Contact" id="001xx"}} ``` ### Sorting and Limiting Results This example retrieves records from the Contact object and sorts them in ascending order by the `LastName` field. It then returns the first 10 results. ```handlebars {{query type="CRM" object="Contact" sortBy="LastName " limit=10}} ``` ### Filtering with the Where Clause This example retrieves objects from the Account object where the value of the `minRev` property is greater than 1,000,000 and the value of the `status` property is `Active`. ```handlebars {{query type="CRM" object="Account" where="Revenue > :minRev AND Status = :status" params=(hash minRev=1000000 status="Active") }} ``` ## See Also - [queryFirst](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-queryfirst.md) - [hash](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-hash.md) - [each](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/objects/mcn-handlebars-reference-objects-each.md) - [length](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-length.md) # Handlebars Helper Function: queryFirst Retrieves the first record from Sales Cloud, marketing objects, or data graphs that matches the specified criteria. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{queryFirst type=CRM|MO|DG object=OBJECT_NAME [id=SALESFORCE_ID] [fields=FIELD_1, ...FIELD_N] [sortBy=FIELDNAME ASC|DESC] [where=FILTER] [params=PARAMS]}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `fields` | String | A comma-separated list of field names to retrieve from the record. | | `id` | String | The Salesforce ID of the target object. Use this parameter only when `type` is `CRM`. | | `object` | String | Required. The API name of the target Salesforce object, marketing object, or data graph. | | `params` | Object | Parameter values for `where` placeholders. Every parameter name in the `where` clause must have a corresponding key. See [Params Values](#params-values). | | `sortBy` | String | Indicates the sort order to apply to results before selecting the first result. Possible values: `ASC` or `DESC`. Use this parameter only when `type` is `CRM`. | | `type` | String | Required. The type of data source to query. Possible values: `"CRM"` (for Sales Cloud objects), `"MO"` (for marketing objects), or `"DG"` (for data graphs). | | `where` | String | A filter for the query. Use `:paramName` placeholders. Can’t be combined with inline field conditions or the `id` parameter. See [Where Clause Syntax](#where-clause-syntax). | ### Where Clause Syntax The `where` parameter supports these elements: - Operators: `=`, `!=`, `<`, `>`, `<=`, `>=`, `LIKE` - Logic: `AND`, `OR` with parenthesized grouping - Placeholders: `:paramName` values that match keys in the `params` object You can use parentheses to create logical groupings. For example, to add a filter that includes active records and either the Revenue value or the CreationDate value is greater than a specified parameter, use `Status = "Active" AND (Revenue > 100000 OR CreationDate > "2025-01-01")`. ### Params Values Use the [hash](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-hash.md) function to specify parameters. This example uses the `hash` function to create an object with two properties: `name` and `status`. The `where` statement then refers to these parameters. ```handlebars {{queryFirst type="CRM" object="Account" fields="Name" where="Name LIKE :name AND Status = :status" params=(hash name=firstName status="Active")}} ``` ## Return Value The function returns the first matching record as an object. ## Usage These examples show how to retrieve records from supported data sources and access their values. ### CRM Lookup by ID This example retrieves an account by its CRM ID. ```handlebars {{queryFirst type="CRM" object="Account" id="001xx"}} ``` ### Marketing Object Lookup This example retrieves a customer record from a marketing object. ```handlebars {{queryFirst type="MO" object="LegacyCustomerList" Email="test@example.com"}} ``` ### Data Graph Lookup This example retrieves a unified profile from Data Graph. ```handlebars {{queryFirst type="DG" object="UnifiedProfile" contactPointEmail=email}} ``` ### Including a WHERE Clause This example uses a WHERE clause with parameter placeholders. ```handlebars {{queryFirst type="CRM" object="Account" fields="Name" where="Name LIKE :search" params=(hash search="Acme%")}} ``` ### Accessing Retrieved Properties This example retrieves a record and accesses its properties. ```handlebars {{#with (queryFirst type="CRM" object="Contact" Email=userEmail)}}

Hello {{FirstName}} {{LastName}}!

{{/with}} ``` ### Providing a Fallback Value Nest the `queryFirst` function in the `fallback` function to handle the case where the specified record doesn't exist. ```handlebars {{fallback (queryFirst type="MO" object="Preferences_DE" SubscriberId=subId).Language "en-US"}} ``` ### Using Conditional Logic You can use the `if` helper to check for the existence of a record. ```handlebars {{#if (queryFirst type="CRM" object="Opportunity" AccountId=accountId Stage="Closed Won")}}

Thank you for your business!

{{else}}

Interested in learning more?

{{/if}} ``` ## See Also - [query](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-query.md) - [hash](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-data-references/mcn-handlebars-reference-data-hash.md) - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-fallback.md) - [with](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/utility/mcn-handlebars-reference-utility-with.md) # Handlebars Helper Function: raiseError Throws an exception with a specified error message and optional error code. Use this helper to interrupt template rendering when you need to enforce validation rules or signal error states. When this helper executes, it prevents the template from completing. Consuming services can access the error details. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{raiseError errorMessage errorCode}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ------ | ---------------------------------------------------------------------- | | `errorMessage` | String | Required. The error message to include in the exception. | | `errorCode` | String | An error code for categorizing or programmatically identifying errors. | ## Return Value This helper always throws a `RaiseErrorHelperException` that contains the provided message and optional error code. The exception that this helper throws can’t be caught or handled by the `fallback` helper. ## Usage Use this helper alone or with conditional logic. This example shows the function within an if-else block. ```handlebars {{#if (not isValid)}} {{raiseError "Validation failed"}} {{else}} {{/if}} ``` ## See Also - [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-fallback.md) - [if](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/comparison/mcn-handlebars-reference-comparison-if.md) - [unless](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/comparison/mcn-handlebars-reference-comparison-unless.md) # Handlebars Helper Function: random Generates a random integer between two specified values. The function can handle both integers and floating-point numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{random first second}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------- | | `first` | Number or String | Required. The minimum value. Must be a number or convertible to a number. | | `second` | Number or String | Required. The maximum value. Must be a number or convertible to a number, and must be greater than or equal to `first`. | ## Return Value The function returns a random integer that is greater than or equal to `first` and less than or equal to `second`. If you provide more than two arguments, the operation uses only the first two. The function throws an exception if the second parameter is less than the first, or if either input is a string that can't be converted to a number. # Handlebars Helper Function: regExMatch Searches a string for a pattern by using a regular expression and returns the result. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{regExMatch sourceString regExPattern returnValue [explicitCapture=true|false] [ignoreCase=true|false] [ignorePatternWhitespace=true|false] [multiline=true|false]}} ``` ## Parameters | Parameter | Type | Description | | ------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `sourceString` | String | Required. The string to search. | | `regExPattern` | String | Required. The regular expression to apply to `sourceString`. | | `returnValue` | String | Required. The name or ordinal of the matching group to return. Use `"0"` to return the full match. | | `explicitCapture` | Boolean | Indicates whether the expression captures only explicitly named groups. Specify as a named parameter. | | `ignoreCase` | Boolean | Indicates whether the regular expression uses case-insensitive matching. Specify as a named parameter. | | `ignorePatternWhitespace` | Boolean | Indicates whether to exclude unescaped white space from the pattern. Specify as a named parameter. | | `multiline` | Boolean | Indicates whether to use multiline mode, where `^` and `$` indicate the beginning and end of each line instead of the beginning and end of `sourceString`. Specify as a named parameter. | The helper supports the same regular expression patterns and options as the `java.util.regex` package. See _Java Platform API Specification_: [Class Pattern](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/regex/Pattern.html). ## Return Value The function returns text from the source string that matches the specified pattern. If the pattern doesn’t match any content from the source string, the function returns an empty string. ## Usage Example This example validates a subscriber-supplied coupon code by checking whether it contains five to seven alphanumeric characters, and returns the matched code. ```handlebars {{#set couponCode}}save23{{/set}} {{regExMatch couponCode "^[A-Z0-9]{5,7}$" "0" ignoreCase=true}} ``` The pattern matches the entire string. Because the value of the `ignoreCase` option is `true`, the pattern matches the entire `couponCode` string, even though the string uses only lowercase letters and the pattern specifies only uppercase letters. The helper returns: ``` save23 ``` # Handlebars Helper Function: repeat Repeats a block of template code a specified number of times, providing loop context variables for each iteration. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#repeat count}} Block content {{/repeat}} ``` ## Parameters | Parameter | Type | Description | | --------- | ----------------- | ------------------------------------------------------------------------------------------ | | `count` | Integer or String | Required. Number of times to repeat. Must be convertible to a non-negative integer (>= 0). | ## Return Value The function repeats the block `count` times and returns the concatenated result. Each iteration provides these loop variables: - `index`: A 0-based index of the current iteration. - `first`: A boolean indicating whether the current iteration is the first iteration. - `last`: A boolean indicating whether the current iteration is the last iteration. - All parent context variables. If `count` is `0`, the function returns an empty string. If the parameter is invalid, the function throws an exception. # Handlebars Helper Function: replace Replaces occurrences of a search string with a replacement string in a case-sensitive manner. This ensures precise string matching and replacement. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{replace subject search replacement culture}} ``` ## Parameters | Parameter | Type | Description | | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `subject` | String | Required. The string to search and replace in. Non-string inputs are converted to strings through language-level type coercion. | | `search` | String | Required. The string to search for (case-sensitive). Non-string inputs are converted to strings through language-level type coercion. | | `replacement` | String | Required. The string to replace matches with. Non-string inputs are converted to strings through language-level type coercion. | | `culture` | String | BCP 47 locale code for culture-specific case comparison. Supports both hyphen (`en-US`) and underscore (`en_US`) formats. Defaults to current system culture if not specified. | ## Return Value The function returns the input string with all occurrences of the search string replaced by the replacement string. The search is performed case-sensitively for precise matching. If the search string is empty, no replacement occurs. If the input is null, it returns an empty string. # Handlebars Helper Function: set Performs local variable assignment within its block scope. It injects one or more variables into the current context for use only within the block. Variables assigned with `set` are local to the block and don’t persist outside the `{{#set}}...{{/set}}` block. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#set var1=value1 ... varN=valueN }} Block content that can access var1 ... varN. {{/set}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------- | | `varName` | Any | Variable name and value pairs such as `name="John"` and `age=30`. Variable names must be valid identifiers. Set at least one variable. | ## Return Value The function returns the rendered content of the block with all the specified variables available in the context. The variables are available only within the block scope and don’t persist outside of it. The helper creates a new context by cloning the existing one, adding the provided key-value pairs, and then rendering the inner block with the updated context. This method preserves the parent context. All parent variables remain accessible directly, unlike the `with` helper, which replaces the context. # Handlebars Helper Function: sha1 Converts a string to a 160-bit hexadecimal SHA-1 hash. **note:** SHA-1 is a one-way hash and isn't suitable for securely storing passwords or other sensitive data. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{sha1 STRING_TO_CONVERT charset=CHARSET}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | | `STRING_TO_CONVERT` | String | Required. The string to hash. | | `charset` | String | The character set to use. Specify as a named parameter. Accepted values are `UTF-8` and `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns the 160-bit SHA-1 hash as a hexadecimal string. ## Usage Example This example hashes a string of text by using UTF-16 character encoding. ```handlebars {{sha1 "This is a string of text." charset="UTF-16"}} ``` The function returns a hash of the string. ``` 1a36453a2f2c1bf17dcc763321e5e35268e5e4c6 ``` # Handlebars Helper Function: sha256 Converts a string to a 256-bit hexadecimal SHA-2 hash. **note:** SHA-256 is a one-way hash and isn't suitable for securely storing passwords or other sensitive data. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{sha256 STRING_TO_CONVERT charset=CHARSET}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | | `STRING_TO_CONVERT` | String | Required. The string to hash. | | `charset` | String | The character set to use. Specify as a named parameter. Accepted values are `UTF-8` and `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns the 256-bit SHA-2 hash as a hexadecimal string. ## Usage Example This example hashes a string of text by using UTF-16 character encoding. ```handlebars {{sha256 "This is a string of text." charset="UTF-16"}} ``` The function returns a hash of the string. ``` 84b87f1ae08610f97a0bb6c228dd2289a54203c23ee2af17d617a1c1b4a0ab1a ``` # Handlebars Helper Function: sha512 Converts a string to a 512-bit hexadecimal SHA-2 hash. **note:** SHA-512 is a one-way hash and isn't suitable for securely storing passwords or other sensitive data. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{sha512 STRING_TO_CONVERT charset=CHARSET}} ``` ## Parameters | Parameter | Type | Description | | ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- | | `STRING_TO_CONVERT` | String | Required. The string to hash. | | `charset` | String | The character set to use. Specify as a named parameter. Accepted values are `UTF-8` and `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns the 512-bit SHA-2 hash as a hexadecimal string. ## Usage Example This example hashes a string of text by using UTF-16 character encoding. ```handlebars {{sha512 "This is a string of text." charset="UTF-16"}} ``` The function returns a hash of the string. ``` 82fdb746ae8cc9a50b4da8e92706e41ef9d242a66c3d40a2a698124583f81769f35226679edbd2fa05c900a6c9ab8337b31f8fcc6f9f9cdfa56001899f758d8a ``` # Handlebars Helper Function: slice Returns a portion of a list between two specified indices, similar to JavaScript's `Array.slice()`. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{slice list startIndex endIndex}} ``` ## Parameters | Parameter | Type | Description | | ------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `list` | Array | Required. The list to slice. | | `startIndex` | Integer | Required. The starting index. Use negative indices to count from the end. | | `endIndex` | Integer | The ending index. Use negative indices to count from the end. If you don’t specify an end index, the function returns a sublist from the `startIndex` to the end of the list. | ## Return Value The function returns a sublist from `startIndex` to `endIndex`, not including the element at the `endIndex`. List indices start at 0. If indices are out of bounds or invalid, the function throws an exception. If the array is empty, the function returns an empty list. ## Usage Examples This example shows how to use the `slice` function to return a sublist. ```javascript myList = ["apple", "banana", "cherry", "date", "elderberry"]; {{slice myList 1 3}} ``` The function returns `["banana", "cherry"]`. ### Slice from the `startIndex` to the End of the List If you don't specify an end index, the function returns a sublist from the `startIndex` to the end of the list, as shown in this example. ```javascript myList = ["apple", "banana", "cherry", "date", "elderberry"]; {{slice myList 2}} ``` The function returns `["cherry", "date", "elderberry"]`. ### Index from the End of the List You can also use negative indices to index the list from the end. Negative indices start at -1. The element at the `endIndex` isn’t included in the sublist, regardless of whether it’s positive or negative. This example shows how to use negative indices to index the list from the end. ```javascript myList = ["apple", "banana", "cherry", "date", "elderberry"]; {{slice myList -2 -1}} ``` The function returns `["date"]`. ### Combine Positive and Negative Indices You can also specify a positive `startIndex` and a negative `endIndex`. This example shows how to return a list that includes the second through the second-to-last elements. ```javascript myList = ["apple", "banana", "cherry", "date", "elderberry"]; {{slice myList 1 -1}} ``` The function returns `["banana", "cherry", "date"]`. # Handlebars Helper Function: sort Sorts a list of objects by a specified field, order, and type. Supports sorting as string, number, date, or boolean. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{sort list fieldName sortOrder sortAs}} ``` ## Parameters | Parameter | Type | Description | | ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- | | `list` | Array | Required. The list of objects to sort. | | `fieldName` | String | Required. The field to sort by. Must exist in all objects. | | `sortOrder` | String | Required. The sort order. Valid values are `"asc"` (ascending order) and `"desc"` (descending order). | | `sortAs` | String | Required. The type to sort as. Valid values:
  • `"string"`
  • `"number"`
  • `"date"`
  • `"boolean"`
. | ## Return Value The function returns a new list sorted by the specified field, order, and type. Objects with missing fields or invalid values for the specified type are excluded from the result. If a parameter is missing or invalid, the function throws an exception. ### Usage Examples This example shows how to use the `sort` function to sort a list of objects by the `age` field in ascending order. ```javascript myList = [{"age": 24}, {"age": 27}, {"age": 21}]; {{sort myList "age" "asc" "number"}} ``` The function returns `[{"age": 21}, {"age": 24}, {"age": 27}]`. ### String Sorting When the field is a string, the function sorts the strings in alphabetical order, as shown in this example. ```javascript myList = [{"name": "John"}, {"name": "Alice"}, {"name": "Bob"}]; {{sort myList "name" "asc" "string"}} ``` The function returns `[{"name": "Alice"}, {"name": "Bob"}, {"name": "John"}]`. ### Boolean Sorting When the field is a boolean, the function sorts the booleans with `false` before `true`, as shown in this example. ```javascript myList = [{"isActive": false}, {"isActive": true}]; {{sort myList "isActive" "asc" "boolean"}} ``` The function returns `[{"isActive": false}, {"isActive: true}]`. ### Nested Helpers You can combine the `sort` function with the `filter` function to filter a list by one field, and then sort the resulting list by another field. This example shows how to use the `sort` function with the `filter` function to sort a list of objects by the `createdAt` field in descending order, only including objects where the value of the `total` field is greater than 100. ```javascript myList = [ {"orderId": "o1", "createdAt": "2024-01-10", "total": 100}, {"orderId": "o2", "createdAt": "2024-01-11", "total": 120}, {"orderId": "o3", "createdAt": "2024-01-12", "total": 150} ]; {{sort (filter myList "total" ">" 100 "number") "createdAt" "desc" "date"}} ``` The function returns this list: ```json [ { "orderId": "o3", "createdAt": "2024-01-12", "total": 150 }, { "orderId": "o2", "createdAt": "2024-01-11", "total": 120 } ] ``` # Handlebars Helper Function: stringToHex Converts each character in a string to its hexadecimal equivalent. ## Availability This helper is available in the Winter ’27 release of Marketing Cloud Next. ## Syntax ```handlebars {{stringToHex sourceString [charSet=CHARSET]}} ``` ## Parameters | Parameter | Type | Description | | -------------- | ------ | ------------------------------------------------------------------------------------------------------------------- | | `sourceString` | String | Required. The string to convert. | | `charSet` | String | The character set to use. Specify as a named parameter with a value of `UTF-8` or `UTF-16`. The default is `UTF-8`. | ## Return Value The function returns a hexadecimal string that represents the encoded characters in `sourceString`. ## Usage Example This example converts a string of text to its UTF-8 hexadecimal representation. ```handlebars {{stringToHex "Hello world!"}} ``` The function returns: ```text 48656c6c6f20776f726c6421 ``` This example converts the same string, but specifies UTF-16 encoding. Each character requires more bytes in UTF-16, so the resulting string is longer. ```handlebars {{stringToHex "Hello world!" charSet="UTF-16"}} ``` The function returns: ```text 480065006c006c006f00200077006f0072006c0064002100 ``` # Handlebars Helper Function: substring Extracts a portion of a string starting from a specified position. The function can extract either the remainder of the string from the start position or a specific length of characters. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{substring subject start length}} ``` ## Parameters | Parameter | Type | Description | | --------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `subject` | String | Required. The string to extract from. Must be a string or convertible to a string. | | `start` | Integer or String | Required. The starting position for extraction. The first character is at position 1. Must be a number or convertible to a number, and must be greater than 0. | | `length` | Integer or String | The number of characters to extract. Must be a positive number or convertible to a positive number. | ## Return Value The function returns a substring of the input string. If you don’t specify the `length` parameter, the function returns the remainder of the string from the start position. If the start position is a number that’s greater than the number of characters in the string, it returns an empty string. If the value of the `length` parameter is larger than the number of characters remaining in the string or is less than 0, the function returns all characters from the start position to the end of the string. If the value of the `subject` parameter is null, the function returns an empty string. # Handlebars Helper Function: subtract Subtracts two numeric arguments and returns their difference. The function can handle both integer and floating-point numbers, and attempts to convert strings to numbers. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{subtract value1 value2}} ``` ## Parameters | Parameter | Type | Description | | --------- | ---------------- | ---------------------------------------------------------------------------------------- | | `value1` | Number or String | Required. The first value to subtract from. Must be a number or convertible to a number. | | `value2` | Number or String | Required. The second value to subtract. Must be a number or convertible to a number. | ## Return Value The function returns the arithmetic difference of the two input values. If you provide more than two arguments, the operation subtracts only the first two. The result is always a number rounded to 2 decimal places. If either input is a string, the operation tries to convert it to a number. If a string value can’t be converted to a number, the operation throws an exception. # Handlebars Helper Function: timezoneConversion Converts a date from one time zone to another. Use this helper to show dates in the appropriate time zone for your recipients. ## Availability This helper is available in the Summer ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{timezoneConversion date sourceTZ targetTZ}} ``` ## Parameters | Parameter | Type | Description | | ---------- | ---------------- | ------------------------------- | | `date` | String or Object | Required. The date to convert. | | `sourceTZ` | String | Required. The source time zone. | | `targetTZ` | String | Required. The target time zone. | ### Date Input You can specify `date` in these formats: - **US formats**: `MM/dd/yyyy`, `M/d/yyyy`, `MM/dd/yyyy HH:mm:ss`, `M/d/yyyy h:mm a`, or `M/d/yyyy h:mm:ss a` - **ISO formats**: `yyyy-MM-dd`, `yyyy-MM-dd HH:mm:ss`, `yyyy-MM-dd'T'HH:mm:ss`, or `yyyy-MM-dd'T'HH:mm:ss.SSSZ` - **12-hour time**: `M/d/yyyy h:mm a`, `yyyy-MM-dd h:mm a`, or `yyyy-MM-dd h:mm:ss a` - **Time-only**: `h:mm a` or `h:mm:ss a` **note:** If you specify only a time, the helper function uses the current date. - **Long-form English**: `d MMMM yyyy`, `MMMM d, yyyy`, or `EEEE, MMMM d, yyyy` - **Chinese and Japanese notation**: `yyyy年M月d日` - **Korean notation**: `yyyy년 M월 d일` or `yyyy년M월d일` ### Time Zone Inputs You can specify `sourceTZ` and `targetTZ` in these formats: - **IANA time zone names**, such as `America/Los_Angeles`, `Europe/Kiev`, or `Asia/Hong_Kong`. - **Time zone abbreviations**. The helper function supports these abbreviations: - `UTC`: Coordinated Universal Time - `EST`: Eastern Standard Time (North America) - `EDT`: Eastern Daylight Time (North America) - `CST`: Central Standard Time (North America) - `CDT`: Central Daylight Time (North America) - `MST`: Mountain Standard Time (North America) - `MDT`: Mountain Daylight Time (North America) - `PST`: Pacific Standard Time (North America) - `PDT`: Pacific Daylight Time (North America) **note:** Using abbreviations can lead to confusion and code maintenance issues. For example, in English, "CST" can stand for "China Standard Time", "Central Standard Time", or "Cuba Standard Time". For best results, use IANA time zone names, which eliminate this ambiguity. ## Return Value The function returns a date-time string in ISO-8601 format (`yyyy-MM-dd'T'HH:mm:ss`) representing the date converted to the target time zone. You can send this output to other helper functions, such as [dateDiff](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-datediff.md). The function automatically handles Daylight Saving Time (DST) transitions based on the date provided. ## See Also - [DateAdd](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-dateadd.md) - [DateDiff](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-datediff.md) - [Now](/handlebars/reference/date-time/mcn-handlebars-reference-date-time-now.md) # Handlebars Helper Function: trim Removes leading and trailing whitespace from a specified string value. The function can handle strings and attempts to convert other types to strings. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{trim subject}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | -------------------------------------------------------------------------------- | | `subject` | String | Required. The string value to trim. Must be a string or convertible to a string. | ## Return Value The function returns the input with all whitespace characters—including spaces, tabs, and newlines—removed from the beginning and end of the string. If the input is null, the function returns an empty string. If the input isn't a string, the function converts it to a string and trims the whitespace. # Handlebars Helper Function: unless Conditionally renders a block based on whether a value evaluates to `false`. This behavior is the inverse of the [if](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-comparison-references/mcn-handlebars-reference-comparison-if.md) helper. This built-in helper is provided by the Handlebars.Net library. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#unless condition}} {{else}} {{/unless}} ``` ## Parameters | Parameter | Type | Description | | ----------- | ---- | -------------------------------- | | `condition` | Any | Required. The value to evaluate. | ## Return Value The function renders the block template if the condition evaluates to `false`. If an `{{else}}` block is provided, it renders that block when the condition evaluates to `true`. ## See Also - _Github_: [Handlebars.Net](https://github.com/Handlebars-Net/Handlebars.Net) - _Handlebars Language Guide_: [Built-in Helpers](https://handlebarsjs.com/guide/builtin-helpers.html#unless) # Handlebars Helper Function: uppercase Converts all letters in a string to uppercase. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{uppercase subject culture}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `subject` | String | Required. The string to convert to uppercase. | | `culture` | String | A POSIX locale code for culture-specific case conversion, such as `tr-TR`. This parameter is helpful with Turkic languages in which the dotless capital letter `I` is converted to a dotless lowercase letter `ı`, as opposed to the lowercase letter `i` found in other Latin alphabets. The operation supports both hyphen (`az-AZ`) and underscore (`az_AZ`) formats. If you don't specify a culture code, the operation uses the current system culture. | ## Return Value The operation returns the input string with all characters converted to uppercase. If the input is null, the operation returns an empty string. If the input isn't a string, the operation converts it to a string and converts all characters to uppercase. # Handlebars Helper Function: with Changes the context within a block to a specified object so that you can access properties without repeating the object name. This built-in helper is provided by the Handlebars.Net library. ## Availability This helper is available in the Winter ’26 release of Marketing Cloud Next. ## Syntax ```handlebars {{#with object}} Value1: {{value1}} Value2: {{value2}} ... {{/with}} ``` ## Parameters | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------ | | `object` | Object | Required. The object to use as the context within the block. | ## Return Value The function renders the block template with the specified object as the context. Within the block, you can access properties directly without the object name. You can access the root context using `@root`. This code example shows how to access the root context. ```handlebars {{#with user}} User: {{name}} Root context: {{@root.title}} {{/with}} ``` You can also access the parent context using the `../` syntax. This code example shows how to access the parent context. ```handlebars {{#with user}} User: {{name}} Parent context: {{../title}} {{/with}} ``` ## See Also - _Github_: [Handlebars.Net](https://github.com/Handlebars-Net/Handlebars.Net) - _Handlebars Language Guide_: [Built-in Helpers](https://handlebarsjs.com/guide/builtin-helpers.html#with) # Handlebars HTTP Functions Use the Handlebars HTTP functions to work with URLs and HTTP requests. | Function Name | Description | | ------------------------------------------------------------------------- | ---------------------------------------------------------- | | [encodeURI](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuri.md) | Converts a string to a format that’s safe to use in a URL. | | [encodeURIComponent](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-http-references/mcn-handlebars-reference-http-encodeuricomponent.md) | Encodes non-URL components of a string. | # Handlebars Math Functions Use the Handlebars math functions to perform mathematical operations on numeric values. This section contains information about this Handlebars function. | Function Name | Description | | ----------------------------------------------------- | --------------------------------------------------------------------------------- | | [add](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-add.md) | Returns the sum of two numbers. | | [divide](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-divide.md) | Returns the result of dividing the first parameter by the second parameter. | | [modulo](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-modulo.md) | Returns the remainder after dividing the first parameter by the second parameter. | | [multiply](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-multiply.md) | Returns the product of two numbers. | | [random](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-random.md) | Returns a random number within a specified range. | | [subtract](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-math-references/mcn-handlebars-reference-math-subtract.md) | Returns the result of subtracting the second parameter from the first parameter. | # Handlebars Object and List Functions Use the Handlebars object and list functions to work with objects and lists. This section contains information about these Handlebars functions. | Function Name | Description | | -------------------------------------------------------- | --------------------------------------------------------------------------------- | | [each](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-each.md) | Loops through a list of items and renders a block of template code for each item. | | [filter](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-filter.md) | Returns a list of items that match a condition. | | [flatten](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-flatten.md) | Flattens a nested list into a single list. | | [get](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-get.md) | Returns the value of a property from an object. | | [jsonpath](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-jsonpath.md) | Queries and filters JSON objects. | | [lookup](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-lookup.md) | Accesse an object property or array element. | | [map](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-map.md) | Extracts a specific field from each object in a list. | | [slice](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-objects-references/mcn-handlebars-reference-objects-slice.md) | Returns a portion of a list between two specified indices. | # Handlebars Personalization Functions Use the Handlebars personalization functions to personalize your templates. This section contains information about this Handlebars function. | Function Name | Description | | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | | [personalizationResult](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-personalization-references/mcn-handlebars-reference-personalization-personalizationresult.md) | Retrieves personalized content or data based on subscriber information and campaign context. | # Handlebars String Functions Use the Handlebars string functions to show and manipulate strings. This section contains information about these Handlebars functions. | Function Name | Description | | ------------------------------------------------------------- | --------------------------------------------------------------------------- | | [char](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-char.md) | Returns a character when passed an ASCII character code. | | [concat](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-concat.md) | Concatenates strings of text. | | [indexOf](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-indexof.md) | Returns the position at which a substring occurs within a string. | | [lowercase](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-lowercase.md) | Returns the provided string using only lowercase letters. | | [properCase](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-propercase.md) | Returns specified string with the first letter of each word capitalized. | | [regExMatch](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-regexmatch.md) | Searches a string for a pattern by using a regular expression. | | [replace](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-replace.md) | Replaces every occurrence of one substring with a different substring. | | [stringToHex](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-stringtohex.md) | Converts each character in a string to its hexadecimal equivalent. | | [substring](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-substring.md) | Returns a portion of a string, beginning at a specified character position. | | [trim](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-trim.md) | Removes white space from the beginning and end of a string. | | [uppercase](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-string-references/mcn-handlebars-reference-string-uppercase.md) | Returns the provided string using only uppercase letters. | # Handlebars Utility Functions Use the Handlebars utility functions to perform several different types of tasks. The utility functions evaluate conditions, format numbers, output text, and more. This section contains information about these Handlebars functions. | Function Name | Description | | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | [base64Decode](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-base64decode.md) | Converts Base64-encoded binary data to plain text. | | [base64Encode](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-base64encode.md) | Converts plain text to Base64-encoded binary data. | | [domain](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-domain.md) | Returns the domain portion of an email address. | | [fallback](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-fallback.md) | Returns a fallback value if the first argument is null, empty, or if an exception occurs. | | [format](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-format.md) | Formats output based on a format string and optional type specification. | | [formatCurrency](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatcurrency.md) | Formats a number as a currency value. | | [formatNumber](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-formatnumber.md) | Formats a number as a numeric type. | | [guid](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-guid.md) | Generates a globally unique identifier. | | [isEmailAddress](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-isemailaddress.md) | Tests whether an email address is structurally valid. | | [isNullDefault](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-isnulldefault.md) | Returns a default value when a value is null. | | [length](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-length.md) | Returns the length of a string or the number of elements in an array. | | [raiseError](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-raiseerror.md) | Throws an exception with a specified error message and optional error code. | | [repeat](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-repeat.md) | Repeats a block of template code a specified number of times, providing loop context variables for each iteration. | | [set](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-set.md) | Performs local variable assignment within its block scope. | | [sort](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-sort.md) | Sorts a list of objects by a specified field. | | [with](https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-with.md) | Changes the context within a block to a specified object so that you can access properties without repeating the object name. | # HelpMOKeyword Defines actions associated with the HELP SMS keyword for an account. ## Properties | Name | Data Type | Description | | -------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DefaultHelpMessage` | String | Contains default message to deliver for a HELP MO message. | | `FriendlyName` | String | Contains the friendly name for a HELP MO keyword. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `IsDefaultKeyword` | Boolean | Specifies if account defaults to this SMS keyword action if no other options are available. | | `MenuText` | String | Defines text to use for outlining multiple response options in the response to a HELP MO request. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `MoreChoicesPrompt` | String | Text used to inform MO message sender of more available choices as part of a HELP keyword action. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # HourlyRecurrence An object that specifies an hourly recurrence pattern and value. This recurrence can be used with campaigns. ## Properties | Name | Data Type | Description | | ----------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | | `HourInterval` | Int | Specifies hour interval in hourly recurrence pattern. | | `HourlyRecurrencePatternType` | [HourlyRecurrencePatternTypeEnum](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/hourlyrecurrencepatterntypeenum.md) | Defines the pattern type for an hourly recurrence. Valid values include:
  • Interval
| ## Related Items - [Perform a Campaign](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/performing_a_campaign_via_the_web_service_api.md) # HourlyRecurrencePatternTypeEnum The pattern types for hourly recurrence settings. ## Values | Name | Description | | ---------- | ------------------------------------------------- | | `Interval` | Specifies an interval type of recurrence pattern. | ## Related Items - [HourlyRecurrence](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/hourlyrecurrence.md) # How Data Binding Works Data binding allows you to bind an activity to data in a running journey. This process greatly simplifies how a marketer or developer dynamically connects data for each contact flowing through a journey. The syntax for data binding is based on the Mustache template language library. Data binding lets you write expressions evaluated by the Journey Builder engine at runtime, when an activity executes for a contact. The `inArguments` and `outArguments` include these expressions. The system doesn't evaluate these expressions when saving, validating, or publishing a journey. **note:** Data binding expressions are case-sensitive. Ensure that the expression exactly match your data extension name and field name. The standard POST body to an Activity without Data Binding leaves the `inArguments` and `outArguments` empty. ```json { "contents": { "inArguments": [], "outArguments": [], "journeyId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "activityId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "definitionInstanceId": "1234abcd-56ef-78gh-90ij-9876klmn5432", "keyValue": "somekeyvalue@domain.tld" } } ``` While this call contains some useful information, it provides a limited approach. InArguments provide your Activity with information needed to handle internal decisions, update your data, or reach out to services your Custom Activity depends on. OutArguments contain the key and value pair for each field expected on the response body of the request. The following example uses Data Binding within the config.json: ```json { "workflowApiVersion": "1.0", "type": "MOBILE", "lang": { "en-US": { "name": "My Custom Activity", "description": "This activity will make the world a better place" } }, "arguments": { "execute": { "inArguments": [ { "contactIdentifier": "{{Contact.Key}}" }, { "emailAddress": "{{InteractionDefaults.Email}}" }, { "twitterHandle": "{{Contact.Default.Twitter}}" }, { "lastLogin": "{{Contact.Attribute.Engagement.LastLogin}}" } ], "outArguments": [ { "foundSignupDate": "" } ], "url": "https://some-endpoint.com/execute" } }, "configurationArguments": { "save": {}, "publish": {}, "validate": {}, "edit": { "uri": "https://my.endpoint.tld/path/to/activity/index.html", "height": 350, "width": 550 } } } ``` ## Data Binding Syntax Basics Using Mustache syntax provides a similar experience to using personalization strings. However, data binding is limited to Contacts and Event Data for a journey for the supplied Contact. To illustrate how Mustache syntax works, assume you use the following JSON data: ```json { "Contact": [ { "ID": 1234567890, "Key": "1234abcd-56ef-78gh-90ij-9876klmn5432", "FirstName": "John", "LastName": "Smith", "Nickname": "Johnny", "PhysicalAddresses": [ { "type": "work", "Address1": "9876 Money Maker Lane", "Address2": "Suite 100", "City": "Palo Alto", "State": "CA", "PostalCode": "94301" } ] } ] } ``` To bind the full name of the Contact, use Handlebars syntax. ``` {{Contact.Attribute.Persona.FirstName}} {{Contact.Attribute.Persona.LastName}} ``` ## Supported Methods of Data Binding Using Data Binding with Contact Builder provides a powerful set of data. - `Contact.Key` - The Journey Builder Engine requires this contact key value to provide the appropriate context. - `InteractionDefaults.Email` - Use this pattern to retrieve the default address of the given type for the specified Contact. - `Contact.Default.[Twitter||Facebook||SMS]` - Use this pattern to retrieve the default address (non-email) of the given type for the specified Contact. - `Contact.Attribute.[FullyQualifiedAttributeName]` - Use this pattern to retrieve the specified attribute from the Contact Builder. The fully qualified attribute names generally appear in the form of **\[AttributeSet Name].\[AttributeName]**. By default, the attribute set name from Contact Builder's Data Designer is the same as the data extension name. The attribute set name of a system-defined set may be different from the data extension name, so use the attribute set name from Contact Builder. (The attribute set name is different from the attribute group name.) Attribute sets and names can use special characters like spaces, but you **must** surround these values with double quotation marks. Example: `Contact.Attribute."Product Orders"."Product Name"` Here are some examples based on the following data assumptions: - The contact opted-in for subscriptions - The contact subscribed with Email, Twitter and SMS channels as defaults using the following values: - john.smith@example.com - @johnnyballgame - 555-555-5555 - Contact includes related data on an attribute set named `Person` (using the JSON data from above). ``` // To fetch the Default Email Address for the Contact {{InteractionDefaults.Email}} // To fetch the Default Twitter Address for the Contact {{Contact.Default.Twitter}} // To fetch the Default SMS Address for the Contact {{Contact.Default.SMS}} // To fetch the Home Postal Code for the Contact {{Contact.Attribute.Person.Work.PostalCode}} // To fetch full name for the Contact {{Contact.Attribute.Person.FirstName}} {{Contact.Attribute.Person.LastName}} ``` ### Journey Context You may need to retrieve information from the running journey's context. An expression can also reference the outArguments from a prior activity in the current journey context using the following placeholder patterns: - `Interaction.[ActivityCustomerKey].[OutArgumentName]` - Uses a journey-unique Activity Customer Key and the Activity specifies the OutArgumentName value. - `Context.IsTest` - Returns **true** for a journey in Test Mode. Use this parameter when the Activity needs to act differently when running the journey as a test. - `Context.PublicationId` - Use the publication ID to associate the currently executing activity to a particular publication (version) of the journey. - `Context.DefinitionId` - Use the definition ID to associate the currently executing activity to a particular definition of the journey. - `Context.DefinitionInstanceId` - This key identifies the actual instance of a journey. Each time a contact runs through the engine, the engine creates a unique ID. Use this information to match logs. - `Context.StartActivityKey` - This key contains the starting key for the session associated with the activity. The key includes a blank value when starting a new activity. Coming off of a wait, this key contains the key of the wait activity. - `Context.VersionNumber` - This key retrieves the entire journey response body, from which you can pull the journey version number. See the Journey Spec for an example of the response body format. ### Event Context You can reference an event within an expression (the incoming data associated with the entry event). Adhere to the following pattern when using data binding with events: ```Handlebars // Capture a field "ProductId" from the EventDefinitionKey "my-custom-product-entry-event-key" {{Event.my-custom-product-entry-event-key.ProductId}} ``` ## Evaluating Expressions An activity can include many different data bound fields. The fields include Mustache expressions specified at journey design time. For instance, for an activity with a databound field expecting an email, the customer can specify `{{InteractionDefaults.Email}}`. - When processing a contact in a journey, the engine evaluates all expressions. - Once a journey publishes, and every subsequent hour, the system compiles each expression to ensure evaluation at runtime. - When the system can’t compile an expression, publish fails and the system disables the journey. These types of failures could happen if a customer renames or deletes a field or does anything to invalidate the expression. - The system compiles all expressions in memory during this hourly validation. This process allows the engine to cache all information needed to retrieve for a given journey, and it speeds up the replacement process of the Mustache placeholders. For example, you can combine all contact calls that can happen within this session of the journey into one contact service call. - The `defaults` property on the journey Object contains an ordered list of email expressions that determine which email address to use as the default, starting with the first expression. ## Best Practices Handlebars allows for complex ways of using placeholders. Use the fully qualified name approach for specifying placeholders to cut down on the change of ambiguation issues. The system checks the inner scope before the outer scope. If there is non-alpha character, such as a space or a colon, in the attribute set or field name, use double quotation marks with Handlebars syntax. ```Handlebars {{#with Contact.FilterId}} {{#with Contact.AttributeId}} {{1234abcd-56ef-78gh-90ij-9876klmn5432}}-{{1234abcd-56ef-78gh-90ij-9876klmn5432}} {{/with}} {{/with}} ``` ## See Also - [Custom Activities](https://developer.salesforce.com/docs/marketing/marketing-cloud/mc-app-development/creating-activities.md) - [Validation Checks to Publish a Journey](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/interaction-operating-states.md) - [Journey Specification](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.md) - _Salesforce Help_: [Personalization Strings](https://help.salesforce.com/articleView?id=mktg.mc_es_personalization_strings.htm) - [Mustache Template Language](http://mustache.github.io/) # HTTP Functions Use the HTTP server-side JavaScript functions to perform HTTP GET and HTTP POST actions and use that information as part of your interactions with Marketing Cloud Engagement. ## Load Use the HTTP Server-Side JavaScript Functions In your server-side JavaScript code, first load the core library using this syntax: Platform.Load("core", "1"); # HTTP Functions These methods permit you to interact with URL information, retrieve locale information from a client browser, or GET and POST information to a URL. You can use this functionality to include content from a URL within an email or landing page or format URLs for inclusion in rendered content. # HTTP Properties Functions You can use the Request object to retrieve various types of HTTP Request object properties and platform application values. The client browser passes this information to the server during an HTTP interaction, so this object contains information regarding the browser and session. These methods return a null value when no HTTP Request object exists or if the given value doesn't exist in the header object. ## Additional Properties Use these properties as part of your calls. Each property returns a specific value associated with the Request object. If no valid Request object exists, the property returns a null or false value as applicable. - Browser - Returns metadata related to the browser from the Request object as a JSON object: - `Platform` - `Browser` - `Version` - `MajorVersion` - `MinorVersion` - ClientIP - Returns the IP address of the requesting client - HasSSL - Returns a Boolean value indicating whether the current Request object supports SSL (HTTPS) usage - IsSSL - Returns a Boolean value indicating whether the current Request object used an SSL (HTTPS) connection - Method - Returns the HTTP method, such as GET or POST, for the Request - QueryString - Returns the full query string for the Request object - ReferrerURL - Returns the URL of the referring web address - RequestURL - Returns the full URL of the Request object - UserAgent - Returns the name of the browser associated with the Request ## Example This call redirects the browser from an HTTP to an HTTPS URL by using the `IsSSL` and `HasSSL` properties to determine if the page uses SSL and supports SSL, respectively. ```js ``` # HTTP Security Headers API Apply and manage HTTP security headers for SAP-branded `view` and `click` domains. This API supports create, read, update, and delete (CRUD) operations. Image and CloudPage domains aren't supported. ## Available Headers The HTTP Security Headers API supports a discrete set of header and value pairs. Developers select which headers to apply from these nine options. | Header | Value | | --------------------------- | ------------------------------------------------------- | | `Content-Security-Policy` | default-src 'self'; frame-ancestors 'self' | | `X-Frame-Options` | SAMEORIGIN | | `X-Content-Type-Options` | nosniff | | `Referrer-Policy` | origin-when-cross-origin | | `Strict-Transport-Security` | max-age=31536000; includeSubDomains | | `Cache-Control` | no-cache, must-revalidate, max-age=0, no-store, private | | `X-XSS-Protection` | 1; mode=block | | `Permissions-Policy` | geolocation=(self), microphone=() | | `Set-Cookie` | strict | **note:** The `Content-Security-Policy` sometimes breaks external content when applied to `view` domains. For example, it's possible to break an image that's hosted on another domain. Test your pages to ensure that your content renders as intended. ## Base URI In this base URI example, the abbreviation {tse} is a placeholder that occupies the place of the tenant-specific-endpoint for the account. ```http https://{tse}.rest.marketingcloudapis.com/ ``` ## Supported Use Cases | Function | Method | Route | Permissions | | ------------------------------------------------------------- | ------ | ---------------------------------------- | -------------------------------- | | [Get All HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-get-all.md) | GET | /messaging/v1/securityHeaders/all | Security > HTTP Headers > View | | [Get HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-read.md) | GET | /messaging/v1/securityHeaders | Security > HTTP Headers > View | | [Update HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-update.md) | POST | /messaging/v1/securityHeaders | Security > HTTP Headers > Update | | [Delete HTTP Security Headers](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_security/securityHeaders-delete.md) | DELETE | /messaging/v1/securityHeaders/{PageType} | Security > HTTP Headers > Delete | ## Error Handling This API uses the standard error status codes outlined on the [Handle Errors in REST API page](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-apis/error-handling.md). ## Related Items - [Sender Authentication Package](https://help.salesforce.com/s/articleView?id=mktg.mc_es_sender_authentication_package.htm) - [Set Up Your Development Environment for Enhanced Packages](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-getting-started/mc-dev-setup-enhanced.md) - [HTTP Headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) - [Handle Errors in REST API page](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc-apis/error-handling.md) # HTTP.Get() Performs an HTTP GET by using the provided name and value pairs against the passed URL, and it returns a JSON object that contains a status value and the HTTP response. You can include multiple pairs of header names and values. This function only works with HTTP on port 80 and HTTPS on port 443. ## Syntax ``` HTTP.Get(1, 2, 3) ``` ## Properties The `HTTP.Get()` function has the properties listed in this table. | Ordinal | Type | Description | | ------- | ------ | ------------------------------------------------------- | | `1` | String | Required. The destination URL for the HTTP GET request. | | `2` | Array | An array of header names to include in the request. | | `3` | Array | An array of header values to include in the request. | ## Usage This sample code performs an HTTP GET and outputs the response object. ```js ``` The response is a JSON object that contains a numeric status value and the response body of the GET request. ```json { "Status": 0, "Content": "{ \"args\": {}, \"headers\": { \"Host\": \"example.com\", \"Mytestheader1\": \"MyTestValue1\", \"Mytestheader2\": \"MyTestValue2\", \"X-Amzn-Trace-Id\": \"Root=1-67ae4eb9-4b57ee616f927d773ff4f5be\" }, \"origin\": \"203.0.113.1\", \"url\": \"https://example.com/forms/myForm.html\" }" } ``` ## See Also - [Platform.Function.HTTPGet()](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationHTTPGet.md) - [Script.Util.HttpGet()](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationScriptUtilHttpGet.md) # HTTP.Post() Issues an HTTP POST request to the provided URL. The function returns a JSON object that contains a status value and the HTTP response. This function only works with HTTP on port 80 and HTTPS on port 443. ## Syntax ``` HTTP.Post(destinationUrl, contentType, content, headerNames[], headerValues[]) ``` The `HTTP.Post()` function has these parameters. - `destinationUrl` (string): Required. The destination URL for the HTTP POST request. - `contentType` (string): Required. The value to pass for the Content-Type header. - `content` (string): Required. The content of the POST request. - `headerNames` (array): Required. An array of header names to include in the request. - `headerValues` (array): Required. An array of header values to include in the request. **note:** HTTP requests created by this function automatically include the `host` and `content-length` headers. The value of `host` is always set to the domain of the URL that the request was sent to. The value of `content-length` is always set to the length of the content in the request. ## Usage This example issues an HTTP POST request and outputs the resulting JSON object. ```xml ``` # HttpGet() Retrieves data from a URL using the GET method. If the URL is the same for multiple subscribers in a send, Marketing Cloud Engagement makes one call per unique URL. The response is then cached and used for each subscriber. This function only works with HTTP on port 80 and HTTPS on port 443. Non-standard port assignments cause this function to fail. **note:** In older accounts, Marketing Cloud Engagement assumes that all returned data uses the WindowsCodePage 1252 character set. Recently created accounts use UTF-8. You can change this default by contacting Salesforce support. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` HttpGet(httpGetUrl, boolContinueOnError, enumAllowEmptyContent, functionStatus) ``` The `HttpGet()` function has four parameters: - `httpGetUrl` (string): Required. The URL to perform the HTTP GET operation on. - `boolContinueOnError` (boolean): If `true`, the function ignores errors that it encounters while performing the HTTP GET operation. If `false`, the function exits when it encounters an error. The default value is `false`. - `enumAllowEmptyContent` (integer): Specifies how the function handles empty content. Accepted values: - `0`: Allow empty content. This is the default behavior. - `1`: Return an error when the function encounters empty content. - `2`: Skip sending an email to a subscriber when you use the function in an email. - `functionStatusOutput` (integer): A variable that holds the status of the function. Possible values: - `0`: Indicates that the function completed successfully. - `-1`: Indicates that the function failed because the specified wasn’t found. - `-2`: Indicates that the function failed because of an HTTP request error. - `-3`: Indicates that the function completed successfully but didn’t return any content. ## Usage To use the function, pass it the URL of a site that you want to retrieve. ``` %%=HttpGet('https://www.example.com')=%% ``` The function returns the content of `http://www.example.com`. You can use conditional logic to handle errors. In this example, the function continues if it encounters an error, and it allows empty content. The result of the function is stored in the variable `@callStatus`. ``` %%[ Var @httpGetExample, @callStatus, @test123 Set @httpGetExample = HttpGet('https://www.example.com', true, 0, @callStatus) If @callStatus == 0 then ]%%

%%=v(@httpGetExample)=%%

%%[ Else ]%%

The requested content isn't available right now. Try again later.

%%[EndIf]%% ``` The function returns the content of `http://www.example.com` if it’s available, and a message if it isn’t available. # HTTPHeader Object Utility Functions Use these functions to add, retrieve, and remove information from an HTTP header. ## Load In your Server-side JavaScript code, first load the core library using this syntax: ``` Platform.Load("core","1"); ``` Use the associated sample code as models to construct your own Server-side JavaScript code. # HTTPHeader Object Utility Functions Use these functions to create impression regions within content areas. ## Load In your Server-side JavaScript code, first load the core library using this syntax: ``` Platform.Load("core","1"); ``` Use the associated sample code as models to construct your own Server-side JavaScript code. # HttpPost() Posts content to the specified URL. This function only works with HTTP on port 80 and HTTPS on port 443. Nonstandard port assignments cause this function to fail. The function honors any character set returned in the `content-type` HTTP header. For example, you can use a UTF-8 encoded HTML file if you specify `Content-Type: text/html; charset=utf-8` in the header. If the header doesn’t specify encoding, the application assumes all returned data uses the character set WindowsCodePage 1252. To change this default setting, contact Salesforce support. You can include as many name-value pairs as you need. **note:** You can’t set the `host` and `content-length` headers of POST requests that are sent using this function. The value of `host` is always set to the domain of the URL that the request was sent to. The value of `content-length` is always set to the length of the content in the request. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` HttpPost(urlEndpoint, contentTypeHeader, contentToPost, response, headerName1, headerValue1, [headerName2, headerValue2...] ) ``` The `HttpPost()` function has six parameters: - `urlEndpoint` (string): Required. The URL to post the specified content to. - `contentTypeHeader` (string): Required. The content-type header to use in the POST request. - `contentToPost` (string): Required. The content to send to the specified URL in the POST request. - `response` (string): Required. An output parameter that contains the status of the POST request. - `headerName1` (string): The name of an additional header to include in the request. - `headerValue1` (string): The value of an additional header to include in the request. You can pass multiple name-value pairs for parameters by appending them to the end of the function (`headerName2`, `headerValue2`...). ## Usage To call the function, pass it the required parameters. This example posts a simple JSON object to a specified URL. The function call uses the application/json `content-type` header, and stores the status of the request in a variable called `@callStatus`. ``` %%[ Var @callStatus, @exampleContent Set @exampleContent = '{ "FirstName": "Tom", "LastName": "Santos", "Age": 41, "Interests": [ "Golfing", "Cooking", "Travel" ] }' HttpPost("http://example.com", "application/json", @exampleContent, @callStatus) Output(@callStatus) ]%% ``` The function stores the HTTP status code in the specified variable. ## See Also - [HttpPost2()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post2.md) - [HttpPostWithRetry()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post-with-retry.md) # HttpPost2() Posts content to the specified URL. This function only works with HTTP on port 80 and HTTPS on port 443. Nonstandard port assignments cause this function to fail. The function honors any character set returned in the `content-type` HTTP header. For example, you can use a UTF-8 encoded HTML file if you specify `Content-Type: text/html; charset=utf-8` in the header. If the header doesn’t specify encoding, the application assumes all returned data uses the character set WindowsCodePage 1252. To change this default setting, contact Salesforce support. **note:** You can’t change the `host` and `content-length` headers of POST requests that are sent using this function. The value of `host` is always set to the domain of the URL that the request was sent to. The value of `content-length` is always set to the length of the content in the request. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` HttpPost2(urlEndpoint, contentTypeHeader, contentToPost, boolExceptionOnError, response, responseRowSet, headerName1, headerValue1, [headerName2, headerValue2...] ) ``` The `HttpPost2()` function has six parameters: - `urlEndpoint` (string): Required. The URL to post the specified content to. - `contentTypeHeader` (string): Required. The content-type header to use in the POST request. - `contentToPost` (string): Required. The content to send to the specified URL in the POST request. - `boolExceptionOnError` (boolean): If `true`, the function produces an exception if it encounters an error. If `false`, the function continues after it encounters an error. - `response` (variable): A variable that is used to store the status of the POST request. - `responseRowSet` (variable): A variable that is used to store the response as a rowset. - `headerName1` (string): The name of an additional header to include in the request. - `headerValue1` (string): The value of an additional header to include in the request. You can pass multiple name-value pairs for parameters by appending them to the end of the function (`headerName2`, `headerValue2`, ...). ## Usage To call the function, pass it the required parameters. This example posts a simple JSON object to a specified URL. The function call uses the application/json `content-type` header, and stores the status of the request in a variable called `@callStatus`. ``` %%[ Var @callStatus, @callStatusRowSet, @exampleContent Set @exampleContent = '{ "FirstName": "Tom", "LastName": "Santos", "Age": 41, "Interests": [ "Golfing", "Cooking", "Travel" ] }' HttpPost2("http://example.com", "application/json", @exampleContent, true, @callStatus, @callStatusRowSet) Output(@callStatus) ]%% ``` The function stores the HTTP status code and a rowset that contains the results of the request in the specified variables. ## See Also - [HttpPost()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post.md) # HTTPPostWithRetry() Posts content to the specified URL. This function only works with HTTP on port 80 and HTTPS on port 443. Nonstandard port assignments cause this function to fail. This function is similar to [HTTPPost2()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post2.md), but this function includes the ability to retry the request if it fails on the first attempt. You can specify the number of times the function attempts to retry the POST request The function honors any character set returned in the `content-type` HTTP header. For example, you can use a UTF-8 encoded HTML file if you specify `Content-Type: text/html; charset=utf-8` in the header. If the header doesn’t specify encoding, the application assumes all returned data uses the character set WindowsCodePage 1252. To change this default setting, contact Salesforce support. You can include as many name-value pairs as you need. **note:** You can’t set the `host` and `content-length` headers of POST requests that are sent using this function. The value of `host` is always set to the domain of the URL that the request was sent to. The value of `content-length` is always set to the length of the content in the request. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` HTTPPostWithRetry(urlEndpoint, contentTypeHeader, content, numRetries, boolReschedule, boolReturnExceptionOnError, responseStatus, responseContentRowset, headerName1, headerValue1, [headerName2, headerValue2...] ) ``` The `HTTPPostWithRetry()` function has six parameters: - `urlEndpoint` (string): Required. The URL to send the content to. - `contentTypeHeader` (string): Required. The content-type header to use in the POST request. - `content` (string): Required. The content to send to the specified URL in the POST request. - `numRetries` (number): The number of times the request can be retried. The first retry occurs immediately after the request fails. Subsequent retries occur 1–4 seconds after the previous failure. The default value is `3`. - `boolReschedule` (boolean): Determines whether the request is rescheduled if it can’t be completed after the specified number of retries. If the value is `true` and the send can’t be completed after the specified number of retry attempts, the send is paused and the system attempts to complete the send again after 15 minutes. If the value is `false`, the system doesn’t attempt to retry the delivery later. The default value is `false`. - `boolReturnExceptionOnError` (boolean): If `true`, the function produces an exception if it encounters an error. If `false`, the function continues after it encounters an error. - `responseStatus` (variable): A variable that is used to store the status of the POST request. - `responseContentRowset` (variable): A variable that is used to store the response content as a rowset. - `headerName1` (string): The name of an additional header to include in the request. - `headerValue1` (string): The value of an additional header to include in the request. You can pass multiple name-value pairs for parameters by appending them to the end of the function (`headerName2`, `headerValue2`, and so on). ## Usage To call the function, pass it the required parameters. This example posts a simple JSON object to a specified URL. The function call uses the application/json `content-type` header, and stores the status of the request in a variable called `@callStatus`. ``` %%[ Var @callStatus, @callStatusRowSet, @exampleContent Set @exampleContent = '{ "FirstName": "Tom", "LastName": "Santos", "Age": 41, "Interests": [ "Golfing", "Cooking", "Travel" ] }' HTTPPostWithRetry( "https://example.com", "application/json", @exampleContent, 2, true, true, @callStatus, @callStatusRowSet) ]%%

Call status: %%=v(@callStatus)=%%

``` The function stores the HTTP status code and a rowset that contains the results of the request in the specified variables. ## See Also - [HttpPost2()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-post2.md) # HttpRequestHeader() Retrieves the header from an HTTP request for a landing page. You can only use this function to retrieve the standard HTTP headers outlined in RFC 7231. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` HttpRequestHeader(headerToRetrieve) ``` The `HttpRequestHeader(headerToRetrieve)` function has one parameter: - `headerToRetrieve` (string): Required. The header that you want to retrieve. ## Function Properties To use this function, pass it the name of the header that you want to retrieve. ``` %%=HTTPRequestHeader('User-Agent')=%% ``` The function returns the value of the User-Agent header for the HTTP request. ## See Also - [RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231) on IETF.org # Identify Multiple Calls Using CreateOptions and ConversationID A request can have an external unique identifier, typically the ConversationID. If you don't specify a ConversationID, include the RequestID. The API processes the calls in the order specified. ## C# Example ```csharp CreateOptions co = new CreateOptions(); co.CallsInConversation = 3; co.CallsInConversationSpecified = true; co.ConversationID = "1234567"; co.SequenceCode = 1; co.SequenceCodeSpecified = true; co.RequestType = RequestType.Asynchronous; co.RequestTypeSpecified = true; CreateResult[] results = integrationFramework.Create(co, new APIObject[] { ts }, out requestID, out status); ``` ## SOAP Envelope ```xml Asynchronous 1234567 ... ``` # Identify One Call Using CreateOptions and ConversationID A request can have an external unique identifier, typically the ConversationID. If you don't specify a ConversationID, include the RequestID. Using this approach provides these added benefits: - Results are available for calls using external identifiers - Data is protected from replayed API calls ## C# Example ```cs CreateOptions co = new CreateOptions(); co.RequestType = RequestType.Asynchronous; co.RequestTypeSpecified = true; co.ConversationID = "123456"; // or any other unique string CreateResult[] results = integrationFramework.Create(co, new APIObject[] { ts }, out requestID, out status); ``` ## SOAP Envelope ```xml Asynchronous 123456 ... ``` Identity Resolution (Data Cloud Connect API) # Identity Resolution (Data Cloud Connect API) Manage and execute identity-resolution rulesets for Marketing Cloud Next by using Connect API. This table lists the identity-resolution-related use cases that Connect API supports. | Supported Use Case | HTTP Verb | URI | | --- | --- | --- | | Get identity-resolution rulesets | [GET](/docs/marketing/marketing-cloud-core/references/mc-connect-identity-resolution?meta=getIdentityResolutionRulesets) | /services/data/{apiVersion}/ssot/identity-resolutions | | Get identity-resolution ruleset details | [GET](/docs/marketing/marketing-cloud-core/references/mc-connect-identity-resolution?meta=getIdentityResolutionRuleset) | /services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId} | | Run an identity-resolution ruleset immediately | [POST](/docs/marketing/marketing-cloud-core/references/mc-connect-identity-resolution?meta=runIdentityResolutionRuleset) | /servics/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId}/actions/run-now | **Version:** v68.0 ## Servers * `https://{subdomain}.my.salesforce.com` * `subdomain (default (no default)) The unique API subdomain for your Salesforce org.` ## Operations ### GET Retrieve a list of identity-resolution rulesets in your org. `GET /services/data/{apiVersion}/ssot/identity-resolutions` Operation ID: `getIdentityResolutionRulesets`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Responses * **200** This response indicates that the API accepted your request to retrieve a list of identity-resolution rulesets for your org. Media type: `application/json`. Schema: `idGetResponseBody`. _Example_ ``` { "identityResolutions": [ { "anonymousUnifiedProfiles": 0, "configurationType": "individual", "consolidationRate": 0, "dataSpaceName": "default", "doesRunAutomatically": true, "id": "1ir1Q0000004CKHQA2", "knownUnifiedProfiles": 15, "label": "My Ruleset", "lastJobCompleted": "2024-02-03T01:23:36.000Z", "lastJobStatus": "SKIPPED", "matchRules": [ { "criteria": [ { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__FirstName__c", "matchMethodType": "fuzzy", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__LastName__c", "matchMethodType": "exact", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__ContactPointEmail__dlm", "fieldName": "ssot__EmailAddress__c", "matchMethodType": "exactnormalized", "shouldMatchOnBlank": false } ], "label": "My Ruleset" } ], "matchedSourceProfiles": 0, "objectApiName": "Individual", "reconciliationRules": [ { "entityName": "ssot__Individual__dlm", "fields": [], "linkDmoName": "IndividualIdentityLink__dlm", "ruleType": "lastupdated", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedIndividual__dlm" }, { "entityName": "ssot__ContactPointEmail__dlm", "fields": [], "linkDmoName": "ContactPointEmailIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointEmail__dlm" }, { "entityName": "ssot__ContactPointAddress__dlm", "fields": [], "linkDmoName": "ContactPointAddressIdentityLink__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedContactPointAddress__dlm" } ], "rulesetStatus": "PUBLISHED", "sourceProfiles": 15, "totalUnifiedProfiles": 15 } ] } ``` * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` ### POST Create an identity-resolution ruleset. `POST /services/data/{apiVersion}/ssot/identity-resolutions` Operation ID: `createIdentityResolutionRuleset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` #### Responses * **201** This response indicates that the API accepted your request to create an identity-resolution ruleset. Media type: `application/json`. Schema: `idCreateResponseBody`. _Example_ ``` { "configurationType": "individual", "dataSpaceName": "default", "doesRunAutomatically": false, "id": "1ir1Q0000004XYzQAM", "label": "My_New_Ruleset", "matchRules": [ { "criteria": [ { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__FirstName__c", "matchMethodType": "fuzzy", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__Individual__dlm", "fieldName": "ssot__LastName__c", "matchMethodType": "exact", "shouldMatchOnBlank": false }, { "caseSensitiveMatch": false, "entityName": "ssot__ContactPointEmail__dlm", "fieldName": "ssot__EmailAddress__c", "matchMethodType": "exactnormalized", "shouldMatchOnBlank": false } ], "label": "My_New_Ruleset" } ], "objectApiName": "Individual_sufx", "reconciliationRules": [ { "entityName": "ssot__Individual__dlm", "fields": [], "linkDmoName": "UnifiedLinkssotIndividualSufx__dlm", "ruleType": "lastupdated", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedssotIndividualSufx__dlm" }, { "entityName": "ssot__ContactPointEmail__dlm", "fields": [], "linkDmoName": "UnifiedLinkssotContactPointEmailSufx__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedssotContactPointEmailSufx__dlm" }, { "entityName": "ssot__ContactPointAddress__dlm", "fields": [], "linkDmoName": "UnifiedLinkssotContactPointAddressSufx__dlm", "ruleType": "mostfrequent", "shouldIgnoreEmptyValue": true, "sources": [], "unifiedDmoName": "UnifiedssotContactPointAddressSufx__dlm" } ], "rulesetStatus": "PUBLISHING" } ``` * **400** This response indicates that the API wasn’t able to complete your request because there was a problem with the request. Check the request body to make sure that it contains all of the required properties. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "errorCode": "INVALID_INPUT", "message": "You can't create a new ruleset for ${dmoName} because it already has 2 published rulesets. Update an existing ruleset or delete a ruleset and try again." } ] ``` * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` ### GET Retrieve details of a specific identity-resolution ruleset. `GET /services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId}` Operation ID: `getIdentityResolutionRuleset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `identityResolutionId` (path, string, required) The unique ID of an identity-resolution ruleset. #### Responses * **200** This response indicates that the API accepted your request to retrieve a list of identity-resolution rulesets for your org. Media type: `application/json`. Schema: `idGetResponseBody`. _Example: same as GET /services/data/{apiVersion}/ssot/identity-resolutions 200 response._ * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that your request included the correct ID or name for the identity-resolution ruleset. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "errorCode": "ITEM_NOT_FOUND", "message": "Identity Resolution not found: 1ir1Q0000000XYZQA2" } ] ``` ### DELETE Delete an identity-resolution ruleset. `DELETE /services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId}` Operation ID: `deleteIdentityResolutionRuleset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `identityResolutionId` (path, string, required) The unique ID of an identity-resolution ruleset. #### Responses * **204** Indicates that the API accepted your request to delete the identity-resolution ruleset. The response contains no content. * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that your request included the correct ID or name for the identity-resolution ruleset. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "errorCode": "ITEM_NOT_FOUND", "message": "Identity Resolution not found: 1ir1Q0000000XYZQA2" } ] ``` ### PATCH Update an identity-resolution ruleset. `PATCH /services/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId}` Operation ID: `updateIdentityResolutionRuleset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `identityResolutionId` (path, string, required) The unique ID of an identity-resolution ruleset. #### Responses * **200** This response indicates that the API accepted your request to retrieve a list of identity-resolution rulesets for your org. Media type: `application/json`. Schema: `idGetResponseBody`. _Example: same as GET /services/data/{apiVersion}/ssot/identity-resolutions 200 response._ * **400** This response indicates that the API wasn’t able to complete your request because there was a problem with the request. Check the request body to make sure that it contains all of the required properties. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example: same as POST /services/data/{apiVersion}/ssot/identity-resolutions 400 response._ * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that your request included the correct ID or name for the identity-resolution ruleset. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "errorCode": "ITEM_NOT_FOUND", "message": "Identity Resolution not found: 1ir1Q0000000XYZQA2" } ] ``` ### POST Run an identity-resolution ruleset immediately. `POST /servics/data/{apiVersion}/ssot/identity-resolutions/{identityResolutionRulesetId}/actions/run-now` Operation ID: `runIdentityResolutionRuleset`. #### Parameters * `Authorization` (header, string, required) A unique, time-limited token that you can use to issue requests to Connect API. Replace `YOUR_ACCESS_TOKEN` with your authentication token. _Example_ ``` Bearer YOUR_ACCESS_TOKEN ``` * `identityResolutionId` (path, string, required) The unique ID of an identity-resolution ruleset. #### Request body (required) Media type: `application/json`. _Example_ ``` {} ``` #### Responses * **200** This response indicates that the API accepted your request to run an identity-resolution ruleset immediately. Media type: `application/json`. Schema: `idRunNowResponseBody`. _Example_ ``` { "resultCode": "NoPendingChangesJobRunSkipped" } ``` * **401** This response indicates that the API wasn’t able to authorize your request. When you receive a 401 response, verify that your authorization token is still valid. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "message": "Session expired or invalid", "errorCode": "INVALID_SESSION_ID" } ] ``` * **404** This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that your request included the correct ID or name for the identity-resolution ruleset. Media type: `application/json`. Schema: `httpErrorResponseBody`. _Example_ ``` [ { "errorCode": "ITEM_NOT_FOUND", "message": "Identity Resolution not found: 1ir1Q0000000XYZQA2" } ] ``` ## Schemas ### idGetResponseBody * `identityResolutions` (_array of object_) * `anonymousUnifiedProfiles` (_number (integer)_) * `configurationType` (_string_) The source object for the identity-resolution ruleset. Allowed values: `Account`, `Individual`. * `consolidationRate` (_number (float)_) * `dataSpaceName` (_string_) * `doesRunAutomatically` (_boolean_) If this value is `true`, the ruleset is configured to run automatically on a defined schedule. Otherwise, the ruleset doesn’t run automatically. * `id` (_string_) The unique ID of the identity-resolution ruleset. * `knownUnifiedProfiles` (_number (integer)_) The number of records that the ruleset has unified. * `label` (_string_) The name of the ruleset. * `description` (_string_) A description of the ruleset. * `lastJobCompleted` (_string (date-time)_) A timestamp that indicates the last time the ruleset ran. * `lastJobStatus` (_string_) The result that occurred the last time the ruleset ran. * `matchRules` (_array of object_) * `label` (_string_) A label for the ruleset. * `criteria` (_array of object_) * `caseSensitiveMatch` (_boolean_) * `entityName` (_string_) * `fieldName` (_string_) * `matchMethodType` (_string_) * `shouldMatchOnBlank` (_boolean_) * `matchedSourceProfiles` (_number (integer)_) * `objectApiName` (_string_) * `reconciliationRules` (_array of object_) * `entityName` (_string_) * `fields` (_array of any_) * `linkDmoName` (_string_) * `ruleType` (_string_) * `shouldIgnoreEmptyValue` (_boolean_) * `sources` (_array of any_) * `unifiedDmoName` (_string_) * `rulesetStatus` (_string_) The status of the ruleset. * `sourceProfiles` (_number (integer)_) * `totalUnifiedProfiles` (_number (integer)_) The total number of records that the ruleset has unified. ### httpErrorResponseBody Array of `object`. * `errorcode` (_string_) The error message. * `message` (_string_) A detailed error message. ### idCreateResponseBody * `configurationType` (_string_) The source object for the identity-resolution ruleset. Allowed values: `Account`, `Individual`. * `dataSpaceName` (_string_) The name of the data space for the identity-resolution ruleset. * `doesRunAutomatically` (_boolean_) If this value is `true`, the ruleset is configured to run automatically on a defined schedule. Otherwise, the ruleset doesn’t run automatically. * `id` (_string_) The unique ID of the identity-resolution ruleset. * `label` (_string_) The name of the ruleset. * `matchRules` (_array of object_) * `label` (_string_) A label for the ruleset. * `criteria` (_array of object_) * `caseSensitiveMatch` (_boolean_) * `entityName` (_string_) * `fieldName` (_string_) * `matchMethodType` (_string_) * `shouldMatchOnBlank` (_boolean_) * `objectApiName` (_string_) * `reconciliationRules` (_array of object_) * `entityName` (_string_) * `fields` (_array of any_) * `linkDmoName` (_string_) * `ruleType` (_string_) * `shouldIgnoreEmptyValue` (_boolean_) * `sources` (_array of any_) * `unifiedDmoName` (_string_) * `rulesetStatus` (_string_) The status of the ruleset. ### idRunNowResponseBody * `resultCode` (_string_) The result of running the identity-resolution ruleset. Allowed values: `ExceededMaximumNumberOfSuccessfulRunsAllowedIn24Hours`, `IdentityResolutionJobIsAlreadyRunning`, `NoPendingChangesJobRunSkipped`, `SuccessfullySubmittedIdentityResolutionJobRunRequest`. ### idCreateRequestBody * `configurationType` (_string_) The source object for the identity-resolution ruleset. Allowed values: `Account`, `Individual`. * `label` (_string_) The name of the ruleset. * `description` (_string_) A description of the ruleset. * `matchRules` (_array of object_) * `label` (_string_) A label for the ruleset. * `criteria` (_array of object_) * `caseSensitiveMatch` (_boolean_) * `entityName` (_string_) * `fieldName` (_string_) * `matchMethodType` (_string_) * `shouldMatchOnBlank` (_boolean_) * `reconciliationRules` (_array of object_) * `entityName` (_string_) * `fields` (_array of any_) * `linkDmoName` (_string_) * `ruleType` (_string_) * `shouldIgnoreEmptyValue` (_boolean_) * `sources` (_array of any_) * `unifiedDmoName` (_string_) ### idGetDetailsResponseBody * `anonymousUnifiedProfiles` (_number (integer)_) * `configurationType` (_string_) The source object for the identity-resolution ruleset. Allowed values: `Account`, `Individual`. * `consolidationRate` (_number (float)_) * `dataSpaceName` (_string_) The name of the data space for the identity-resolution ruleset. * `doesRunAutomatically` (_boolean_) If this value is `true`, the ruleset is configured to run automatically on a defined schedule. Otherwise, the ruleset doesn’t run automatically. * `id` (_string_) The unique ID of the identity-resolution ruleset. * `knownUnifiedProfiles` (_number (integer)_) The number of records that the ruleset has unified. * `label` (_string_) The name of the ruleset. * `lastJobCompleted` (_string (date-time)_) A timestamp that indicates the last time the ruleset ran. * `lastJobStatus` (_string_) The result that occurred the last time the ruleset ran. * `matchRules` (_array of object_) * `label` (_string_) A label for the ruleset. * `criteria` (_array of object_) * `caseSensitiveMatch` (_boolean_) * `entityName` (_string_) * `fieldName` (_string_) * `matchMethodType` (_string_) * `shouldMatchOnBlank` (_boolean_) * `matchedSourceProfiles` (_number (integer)_) * `objectApiName` (_string_) * `reconciliationRules` (_array of object_) * `entityName` (_string_) * `fields` (_array of any_) * `linkDmoName` (_string_) * `ruleType` (_string_) * `shouldIgnoreEmptyValue` (_boolean_) * `sources` (_array of any_) * `unifiedDmoName` (_string_) * `rulesetStatus` (_string_) The status of the ruleset. * `sourceProfiles` (_number (integer)_) * `totalUnifiedProfiles` (_number (integer)_) The total number of records that the ruleset has unified. # If Statements Use the `If` statement to perform conditional processing. At a minimum, an `If` statement must include: - The keyword `If` immediately preceding the condition that you want to evalute. - The keyword `Then` immediately following the condition. - The keyword `EndIf` to close the block. These keywords aren’t case-sensitive; that is, `IF`, `If`, and `if` all function in the same way. This example shows a minimal `If` statement. ``` Set @maximum = 200 Set @valueToTest = 300 If @valueToTest > @maximum Then Output("The value is greater than the maximum.") EndIf ``` Evaluations in `If` statements can include any of these input types: - Constants - Variables - Attributes and data extension values - Function calls In the example, the condition is met, so the function outputs `The value is greater than the maximum.` ## ElseIf Statements Use the `ElseIf` statement to test additional conditions. You can include multiple `ElseIf` statements in an `If` block. This example outputs one string of text if the value of the `@age` variable is 31–40, and a different string if it’s 41–50. ``` If (@age > 30 and @age <= 40) Then Output("Age between 31 and 40") ElseIf (@age > 40 and @age <= 50) Then Output("Age between 41 and 50") EndIf ``` ## Else Statements Use `Else` statements to catch any condition that isn’t specifically handled by the conditions in the `If` or `ElseIf` statements. You can only include one `Else` statement in an `If` block. This example outputs one string of text if the value of the `@age` variable is 31–40, a different string if it’s 41–50, and a third string for all other values. ``` If (@age > 30 and @age <= 40) Then Output("Age between 31 and 40") ElseIf (@age > 40 and @age <= 50) Then Output("Age between 41 and 50") Else Output("Age is either under 30 or over 51.") EndIf ``` ## See Also - [Evaluating Conditions in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-condition-evaluation.md) # Iif() Use the `Iif()` function to test a condition. The first parameter contains the condition that you want to test. The condition can be any function or expression that returns `true` or `false`. If the condition is true, the function returns the second parameter. If the condition is false, it returns the third parameter. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes
This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0). ## Syntax ``` Iif(condition, valueIfTrue, valueIfFalse) ``` The `Iif()` function has three parameters: - `condition` (string): Required. The condition to test. - `valueIfTrue` (string): Required. The value to return if the condition is true. - `valueIfFalse` (string): Required. The value to return if the condition is false. ## Usage This example constructs a greeting for a message using the `Iif()` and [Concat()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/string/mc-ampscript-reference-string-concat.md) functions. It looks at the `FirstName` field from the subscriber profile for the recipient. ``` %%[ Var @salutation, @name Set @name = firstname Set @salutation = Iif(Empty(@name), "Valued subscriber,", Concat("Dear ", @name, ",")) ]%%

%%=v(@salutation)=%%

``` If the `FirstName` field contains a value, the `Iif()` function outputs a string that greets the subscriber by name. ``` Dear Tomás, ``` If the `FirstName` field is empty, the `Iif()` function produces a generic text string. ``` Valued subscriber, ``` # Image() Returns an `img` tag in which the `src` attribute is the path to an image from your Portfolio. The img tag includes the title and alt information for the selected image, a `border` attribute set to `0`, and a `thid` attribute that contains the ID of the image in the Portfolio. ## Availability
Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No
## Syntax ``` Image(imageExternalKey, defaultImageExternalKey) ``` The `Image()` function has two parameters: - `imageExternalKey` (string): Required. The external key of an image in your Portfolio. - `defaultImageExternalKey` (string): The external key of a fallback image in your Portfolio. The function uses this image if it can’t find the image that you specified in the `imageExternalKey` parameter. ## Usage To use this function, pass it the external ID of an image in your Portfolio. You can optionally specify a default image to use if the function is unable to find the first image. ``` %%=Image('CorpLogo','DefaultImage')=%% ``` If the function finds the image that you specified in the first parameter, it returns an `` tag that refers to that image. ``` Logo ``` If the function doesn’t find the specified image, it returns an `` tag that refers to the image that you specified in the second parameter. ``` Default ``` # Impersonation via WSProxy To impersonate another user, or switch contexts, use the setClientId method on the WSProxy object. This method takes a single parameter, which defines the fields and properties to set on the ClientId object. You can set any property on the ClientId object in the WSDL using this method. In this example, both the ID and UserID are specified on the object. You can add multiple credentials to a single WSProxy, but most actions use only the first one set as they accept only a single ClientId object. ``` api.setClientId({ "ID": 1234, "UserID": 1234 }); ``` To clear all set ClientId objects, use the resetClientIds() method. After using this method, the request goes back to using the default credentials determined by the execution context. ``` api.resetClientIds(); ``` # Import Definition and Activity The following are import definition and activity technical articles for SOAP API. - [Create an Import Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/creating_an_import_definition.md) - [Perform an Import without an Existing Import Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/performing_an_import_via_the_soap_api_without_an_existing_import_definition.md) - [Retrieve the Aggregate Results of an Import Via ImportResultsSummary](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve_the_aggregate_results_of_an_import_via_importresultssummary.md) - [Retrieve the Results of an Import](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_results_of_an_import.md) - [Start an Import Definition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/starting_an_import_definition_via_the_web_service_api.md) # ImportDefinition Defines a reusable pattern of import options. For example, you could create an import definition to upload **Subscribers.csv** every day into the **Customers** list to prevent having to re-enter the same parameters every day. If you import information to a data extension, you must create a data extension object and set the ObjectID property or customer key on the data extension object. You must then set the DestinationObject property to that object. If you are importing to a list, you must create a list object, set an ID property, and set the DestinationObject property to that object. You must specify the ID property for a list. Imports don't currently support the use of ObjectID or CustomerKey when importing to a list. You can specify what character encoding you wish to use with your imports, but this specification applies to all imports in an account and can only be enabled by your Account Executive. - To create an ImportDefinition where the destination object is a list, you need the Email | Subscribers | List | Import Subscribers permission. - To create or update an ImportDefinition where the destination object is a data extension, you need the Email | Subscribers | Data Extension | Import and Manage Data permissions. - To create or update an ImportDefinition where the destination object is a list and the list ID is the All Subs List ID, you need the Email | Subscribers | All Subscribers | Import Subscribers and View permissions. ## Properties | Name | Data Type | Description | | ------------------------------ | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AllowErrors` | Boolean | Specifies whether an import continues after an error occurs. A value of true permits the import process to continue, and a value of false stops the import process after the first error. | | `AutoGenerateDestination` | [ImportDefinitionAutoGenerateDestination](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionautogeneratedestination.md) object | Specifies the properties of the destination to be generated automatically during an import. | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `ControlColumn` | String | Specifies the column name in which to find control values as part of an import. Use when the value of `ImportDefinitionUpdateType` is `ColumnBased`. | | `ControlColumnActions` | Array of [ImportDefinitionColumnBasedAction](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitioncolumnbasedaction.md) objects | Specifies the control column actions to apply to an import. | | `ControlColumnDefaultAction` | [ImportDefinitionColumnBasedActionType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitioncolumnbasedactiontype.md) | Defines default control column action to take as part of an import definition. Valid values include:
  • AddAndUpdate
  • AddButDoNotUpdate
  • Delete
  • Skip
  • UpdateButDoNotAdd
| | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DateFormattingLocale` | [Locale](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/locale.md) object | Specifies how dates are formatted in the imported data. | | `DeleteFile` | Boolean | Indicates whether the call deletes the file used in the import once the process completes. | | `Delimiter` | String | Specifies the delimiter used as part of an import definition. | | `Description` | String | Describes and provides information regarding the object. | | `DestinationObject` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies the destination of an import. | | `DestinationType` | Int | Not used. | | `EndOfLineRepresentation` | String | Specifies the line-ending character(s) used in delimited files to be imported. | | `FieldMappingType` | [ImportDefinitionFieldMappingType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionfieldmappingtype.md) object | Defines how fields are mapped within an import definition. Valid values include:
  • InferFromColumnHeadings
  • MapByOrdinal
  • ManualMap
| | `FieldMaps` | Array of [FieldMap](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/fieldmap.md) objects | Specifies the mapping of fields to columns in a file. | | `FileSpec` | String | Defines the file-naming pattern associated with an activity (valid substitutions include%%YEAR%%, %%MONTH%%, and %%DAY%%). | | `FileType` | [FileType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filetype.md) object | Specifies column delimiter of a file. Valid values include:
  • CSV
  • TAB
  • Other
| | `Filter` | String | Specifies filter to apply to retrieve. | | `HeaderLines` | Int | Specifies the number of header lines in the file to ignore. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `InteractionObjectID` | String | Returns associated ID for activities within the asynchronous process of the overall conversation or program. | | `Keyword` | String | Not used. | | `MaxFileAge` | Int | Specifies the age of the oldest file to be included in an import definition. Any files older than the maximum age aren't included in the import definition. | | `MaxFileAgeScheduleOffset` | Int | Specifies an offset in hours to associate with a file age for accomodating timezone differences. This time represents the maximum allowable difference between the scheduled time and the time the import definition actually accesses the file to be imported. | | `MaxImportFrequency` | Int | Specifies the number of hours to wait before allowing a file to be imported again. This property prevents an import definition run within a program from executing if a specified number of hours have passed since the program began. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `Name` | String | Name of the object or property. | | `Notification` | [AsyncResponse](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/asyncresponse.md) object | Specifies the email address to which to send a notification. | | `NullRepresentation` | String | Defines character used to represent a null value during an import. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `RetrieveFileTransferLocation` | [FileTransferLocation](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/filetransferlocation.md) object | Specifies the file transfer location to contain the file. | | `SourceObject` | [APIObject](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiobject.md) object | Specifies source of the import. | | `StandardQuotedStrings` | Boolean | Specifies whether standard quoted strings are used as part of an import definition. A true value indicates standard quoted strings are used in an import definition. | | `SubscriberImportType` | [ImportDefinitionSubscriberImportType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionsubscriberimporttype.md) object | Specifies the subscriber import type for an import definition. Possible values are `Email` and `SMS`. The default value is `Email`. | | `SubscriptionDefinitionId` | String | Identifies subscription to which the import definition is associated. | | `UpdateType` | [ImportDefinitionUpdateType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionupdatetype.md) object | Indicates update type associated with an import definition. Valid values include:
  • AddAndUpdate
  • AddAndDoNotUpdate
  • UpdateButDoNotAdd
  • Merge
  • Overwrite
  • ColumnBased
| ## Related Items - [Supported Operations for Objects and Methods](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/supported_operations_for_objects_and_methods.md) # ImportDefinitionAutoGenerateDestination An object that indicates destination of auto-generated data extension specified by import definition. | Name | Data Type | Description | | --------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | `DataExtensionTarget` | [DataExtension](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/dataextension.md) object | Indicates data extension to use as a template when auto-generating a new data extension. | | `ErrorIfExists` | Boolean | Indicates whether the API returns an error if a data extension already exists for an auto-generated process. | # ImportDefinitionColumnBasedAction An object that contains multiple value and action pairs that determine the action to take in a column depending on the value in a field. For example, you can set this object to skip and not add a value of A, delete a value of B, and update a value of C. | Name | Data Type | Description | | -------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Action` | [ImportDefinitionColumnBasedActionType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitioncolumnbasedactiontype.md) object | Defines the action to take for the specified object. Valid values include:
  • CREATE
  • DELETE
  • UPDATE
| | `Value` | String | Defines the value to use in a filter or other object. In filters, the `BETWEEN` operator requires two values. The `IN` operator can handle multiple values. All other operators require only one value. If the value is `isNull` or `isNotNull`, the API ignores any supplied values and doesn't return an error. | # ImportDefinitionColumnBasedActionType The row-level outcomes for a column-based import. Use this data type for `ControlColumnActions.Action` and `ControlColumnDefaultAction` when `UpdateType` is `ColumnBased`. ## Values | Name | Description | | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AddAndUpdate` | Indicates that the import adds new subscribers and updates existing subscribers. It corresponds to the **Add and Update** option. | | `AddButDoNotUpdate` | Indicates that the import adds new subscribers but doesn’t update existing subscribers. It corresponds to the **Add Only** option. | | `Delete` | Indicates that the import deletes matching subscribers. | | `Skip` | Indicates that the import takes no action on the matching row. | | `UpdateButDoNotAdd` | Indicates that the import updates existing subscribers but doesn’t add subscribers. This property applies to both subscriber lists and data extensions. It corresponds to the **Update Only** option. | ## Related Items - [ImportDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinition.md) - [ImportDefinitionColumnBasedAction](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitioncolumnbasedaction.md) # ImportDefinitionFieldMap An object that represents the field mapping configuration within an Import Definition. ## Properties | Name | Data Type | Description | | ------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DestinationName` | String | Defines field where imported data resides. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `Item` | Object | Identifies an item in a mapped relationship. | | `ModifiedDate` | DateTime | The date and time when the object was last modified. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | ## Related Items - [ImportDefinitionFieldMappingType](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionfieldmappingtype.md) # ImportDefinitionFieldMappingType The strategies for mapping columns in an import file to fields in a data extension or list. ## Values | Name | Description | | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `InferFromColumnHeadings` | Indicates that during the import, Marketing Cloud Engagement matches field headings in the import file to the data extension fields based on similarities in the text and values. | | `ManualMap` | Indicates that all relationships between fields in an import file and a data extension are explicitly stated in the API call. | | `MapByOrdinal` | Indicates that during the import, Marketing Cloud Engagement maps fields from an import field to the data extension by their position in the file. Use a 0-based ordinal when importing to a subscriber list, and use a 1-based ordinal when importing to a data extension. | ## Related Items - [ImportDefinitionFieldMap](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinitionfieldmap.md) # ImportDefinitionSubscriberImportType The channel context (email or SMS) for subscriber data imported by an import definition. ## Values | Name | Description | | ------- | ------------------------------------------------------------------ | | `Email` | Indicates that the subscriber information is used for email sends. | | `SMS` | Indicates that the subscriber information is used for SMS sends. | ## Related Items - [ImportDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinition.md) # ImportDefinitionUpdateType The merge and overwrite behaviors available when an import definition runs against a list or data extension. ## Values | Name | Description | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AddAndDoNotUpdate` | Indicates that the import adds new subscribers but ignores existing subscribers. This property applies to both subscriber lists and data extensions. It corresponds to the **Add Only** option. | | `AddAndUpdate` | Indicates that the import adds new subscribers and updates existing subscribers. This property applies to both subscriber lists and data extensions. It corresponds to the **Add and Update** option. | | `ColumnBased` | Indicates that information in the import is updated based on column values. | | `Merge` | Not used. | | `Overwrite` | Indicates that the import overwrites all existing data. This property applies to data extensions, and it can be used only if the primary key is unavailable. | | `UpdateButDoNotAdd` | Indicates that the import updates existing subscribers but doesn’t add new subscribers. This property applies to both subscriber lists and data extensions. It corresponds to the **Update Only** option. | ## Related Items - [ImportDefinition](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/importdefinition.md) # ImportResultsSummary A retrieve-only object that contains status and aggregate information about an individual import started from an ImportDefinition. Possible values include: - `New` - The Retrieve request has yet to be processed by the application. - `Processing` - The application is processing the Retrieve request. - `Completed` - The application has completely processed the Retrieve request. - `Error` - An error occurred while processing the Retrieve request. - `IOWork` - The application is currently writing information to disk. - `Unknown` - No status is currently available for the Retrieve request. ## Properties | Name | Data Type | Description | | ----------------------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Client` | [ClientID](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/clientid.md) object | Specifies the account ownership and context of an object. | | `CorrelationID` | String | Identifies correlation of objects across several requests. | | `CreatedDate` | DateTime | The date and time when the object was created. | | `CustomerKey` | String | User-supplied unique identifier for an object within an object type. This property corresponds to the external key assigned to an object. | | `DestinationID` | String | Specifies the identifier of either the list or the data extension associated with a completed import (lists return a number value for an ID, while data extensions return an GUID). | | `EndDate` | String | Specifies the end data of an activity. | | `ID` | Int | Read-only identifier for an object. Some objects use the ObjectID property as a unique ID. | | `ImportDefinitionCustomerKey` | String | Specifies customer key associated with import definition used in an import. | | `ImportStatus` | String | Specifies import status associated with an import. | | `ImportType` | String | Specfies type of import performed. | | `ModifiedDate` | String | The date and time when the object was last modified. | | `NumberDuplicated` | Int | Specifies number of duplicated records resulting from an import. | | `NumberErrors` | Int | Indicates number of errors resulting from an import. | | `NumberSuccessful` | Int | Specifies number of successful record imports resulting from an import action. | | `ObjectID` | String | System-controlled, read-only text string identifier for object. | | `ObjectState` | String | Not used. | | `Owner` | [Owner](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/owner.md) object | Describes account ownership of subscriber in an on-your-behalf account. | | `PartnerKey` | String | Unique identifier provided by partner for an object. This property is accessible only via API. | | `PartnerProperties` | Array of [APIProperty](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/apiproperty.md) objects | A collection of metadata supplied by the client and stored by the system. These properties are accessible only via API. | | `StartDate` | String | Indicates the start date for the time period for which to retrieve import results. | | `TaskResultID` | Int | Indicates the task result ID associated with a summary of import results. | | `TotalRows` | Int | Indicates the total number of rows included in the summary of an import. | ## Methods | Name | Description | | ----------------------- | ----------------------------------------------------- | | [Retrieve](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve.md) | Retrieves an individual object or a batch of objects. | # Impression Tracking Use impression tracking to define a region of content in an email. After you send the email, you can view reports in Email Studio that track the performance of each impression region. ## Impression Tracking Considerations and Capabilities There are several important behaviors and capabilities to understand when adding impression regions to your emails. - Impression region names are case insensitive. - There’s no limit on the number of impression regions that you can add to an email. - Impression regions can be used in both HTML and text portions of an email. - Impression regions can contain dynamic content. - Impression regions can be nested within one another. ## Using Impression Regions Start and end an impression region by using the [BeginImpressionRegion()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-begin-impression-region.html) and [EndImpressionRegion()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-end-impression-region.html) AMPscript functions, respectively. You can also use one of the functions related to content blocks ([ContentBlockByName()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.html), [ContentBlockByKey()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-key.html), and [ContentBlockById()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-id.html)) to insert a content block into your email and associate that block with an impression region. If you don’t explicitly close an impression region, the system closes that region at the end of the message. In this situation, an impression region that you open in the HTML version of an email doesn’t remain open when the text version of the message builds. If you open multiple regions and don’t close them, all remain open and the final impression region opened remains the active one returned for resolving the related substitutions. If you issue one `EndImpressionRegion()` call, the second-to-last region becomes the active region. Issuing `EndImpressionRegion(true)` closes all open regions. ## Email Studio Reports The reports in Email Studio group impression regions by job. You can view metrics that encompass the entire job and that provide details about individual impression regions. For more information, see [Track Impressions by Job Report for Email Studio in Analytics Builder](https://help.salesforce.com/s/articleView?id=mktg.mc_re_impression_tracking_by_job_report.htm). # Include Content from an RSS Feed in an Email Message RSS feeds are XML-based lists of the latest articles published on a website or other content source. You can use AMPscript to pull content from an RSS feed and add that content to an email message. An advantage of this approach is that AMPscript retrieves content from the RSS feed at send time, ensuring that the content you add to the email is as current as possible. ## Basic Code Example In this example, the AMPscript takes the five most recent entries from the feed and includes them in the email. The `@xml` variable pulls in the content area with the content syndication, while the other variables pull information from the feed to include in the email. The For loop in the email counts how many times articles have been pulled from the feed and stops after adding five articles to the message. In the body of the email message, include this code example. ```AMPscript %%[ Var @xml, @titles, @title, @descs, @desc, @links, @link, @cnt Set @xml = HTTPGet("https://example.com/xmlfile.xml") Set @titles = BuildRowsetFromXML(@xml,"//item/title",1) Set @descs = BuildRowsetFromXML(@xml,"//item/description",1) Set @links = BuildRowsetFromXML(@xml,"//item/link",1) If RowCount(@titles) > 5 then Set @rows = 5 Else Set @rows = RowCount(@titles) EndIf If @rows >= 1 then For @cnt = 1 to @rows do Set @title = Field(Row(@titles,@cnt),"Value") Set @desc = Field(Row(@descs,@cnt), "Value") Set @link = Field(Row(@links,@cnt), "Value") ]%%

%%=v(@title)=%%

%%=v(@desc)=%%
%%[ Next @cnt EndIf ]%% ``` You can modify the HTML in the example to fit the formatting of your email message. To make sure that the message pulls the correct content and that the content is formatted correctly, always send emails before you send to your customers. If the RSS feed contains HTML formatting, remove any AMPscript from the text version of the email, and provide the VAWP URL. If you don’t make these changes, the email fails. ## Code Example that Removes Colons from RSS Data If you reference a node that includes a colon, the AMPscript function returns an error. This code example uses the [Replace()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-replace.html) function to remove the colon so that you can successfully add content from your RSS feed to your emails. ```AMPscript %%[ Var @xml, @xml1, @titles, @title, @descs, @desc, @links, @link, @cnt Set @xml1 = HTTPGet("https://example.com/xmlfile.xml") Set @xml = Replace(@xml1,'content:encoded','contentencoded') Set @titles = BuildRowsetFromXML(@xml,"//item/title",1) Set @descs = BuildRowsetFromXML(@xml,"//item/contentencoded",1) Set @links = BuildRowsetFromXML(@xml,"//item/link",1) If RowCount(@titles) > 5 then Set @rows = 5 Else Set @rows = RowCount(@titles) EndIf If @rows >= 1 then For @cnt = 1 to 5 do Set @title = Field(Row(@titles,@cnt),"Value") Set @desc = Field(Row(@descs,@cnt), "Value") Set @link = Field(Row(@links,@cnt), "Value") ]%%

%%=v(@title)=%%

%%=v(@desc)=%%
%%[ Next @cnt EndIf ]%% ``` ## See Also - [HTTPGet()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-http/mc-ampscript-reference-http-get.html) function reference - [BuildRowsetFromXML()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-build-rowset-from-xml.html) function reference - [Field()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-field.html) function reference - [Row()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-row.html) function reference - [Replace()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-replace.html) function reference # Incoming Date Normalization Marketing Cloud Engagement normalizes the date and time formats represented in a SOAP message. All of the times listed in this table refer to the same time. | Format | Example | Description | | --------------------------- | ------------------------- | -------------------- | | `yyyy-MM-ddTHH:mm:ddZ` | 2025-08-21T18:32:15Z | UTC format | | `yyyy-MM-ddTHH:mm:dd` | 2025-08-21T14:32:15 | Server time | | `yyyy-MM-ddTHH:mm:dd-zz:zz` | 2025-08-21T12:02:15-06:30 | Time offset from UTC | ## Methods and Parameters Affected by Normalization Time normalization applies to these methods and parameters. - [Create](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/create.md "Create"): Options and Objects - [Retrieve](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieve.md "Retrieve"): RetrieveRequest - [Update](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/update.md "Update"): Options and Objects - [Delete](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/delete.md "Delete"): Options and Objects - [Query](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/query.md "Query"): QueryRequest - [Execute](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/execute.md "Execute"): Requests - [Extract](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/extract.md "Extract"): Requests - [Perform](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/perform.md "Perform"): Options and Definitions - [Configure](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/configure.md "Configure"): Options and Configurations - [Schedule](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/schedule.md "Schedule"): Options, Schedule, and Interactions The API searches for properties with a type of DateTime in any objects passed in through these parameters. The API then normalizes any time formats found, and this normalization applies recursively to any nested objects. Any response including the incoming request object presents a different time in that response. For example, the [CreateResult object](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/createresult.md) on a Create call contains the object from the request and presents any dates in the returned object in server time. # Index of AMPscript Functions We organized the functions in this reference guide into categories based on the types of data that each function interacts with. For example, you can find information about AMPscript functions that manipulate dates and times in the [Date & Time Functions category](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/date-time/mc-ampscript-reference-date-time.md). The purpose of this index is to make it easier to explore and discover AMPscript functions that you might not have encountered otherwise. This table lists all of the existing AMPscript functions in alphabetical order. In the table, the value in the Engagement column indicates whether the function works in Marketing Cloud Engagement, and the value in the Next column indicates whether the function works in Marketing Cloud Next. | Function Name | Category | Description | Engagement | Next | | ------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------- | ----------- | ----------- | | [Add()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/math/mc-ampscript-reference-math-add.md) | Math | Returns the sum of two numbers. | ✅ Yes | ✅ Yes | | [AddMscrmListMember()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/microsoft-dynamics-crm/mc-ampscript-reference-microsoft-dynamics-crm-add-list-member.md) | Microsoft Dynamics CRM | Adds a record to a Microsoft Dynamics CRM marketing list. | ✅ Yes | ❌ No | | [AddObjectArrayItem()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/api/mc-ampscript-reference-api-add-object-array.md) | API | Adds an object to an array in a Marketing Cloud Engagement API object. | ✅ Yes | ❌ No | | [AttributeValue()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/utilities/mc-ampscript-reference-utilities-attribute-value.md) | Utilities | Returns the value of an attribute. | ✅ Yes | ❌ No | | [AttachFile()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/content/mc-ampscript-reference-content-attach-file.md) | Content | Attaches a file to an outgoing email message. | ✅ Yes | ❌ No | | [AuthenticatedEmployeeId()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-employee-id.md) | Sites | Returns the employee ID of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEmployeeNotificationAddress()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-employee-notification-address.md) | Sites | Returns the email address of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEmployeeUserName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-employee-username.md) | Sites | Returns the username of the current Marketing Cloud Engagement user. | ✅ Yes | ❌ No | | [AuthenticatedEnterpriseID()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-enterprise-id.md) | Sites | Returns the enterprise ID of the current authenticated landing page user. | ✅ Yes | ❌ No | | [AuthenticatedMemberID()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-member-id.md) | Sites | Returns the member ID of the authenticated landing page user. | ✅ Yes | ❌ No | | [AuthenticatedMemberName()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/sites/mc-ampscript-reference-sites-authenticated-member-name.md) | Sites | Returns the member name of the authenticated landing page user. | ✅ Yes | ❌ No | | [BarcodeUrl()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/content/mc-ampscript-reference-content-barcode-url.md) | Content | Generates a barcode based on an input string. | ✅ Yes | ❌ No | | [Base64Decode](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/utilities/mc-ampscript-reference-utilities-base64-decode.md) | Utilities | Converts Base64-encoded binary data to a string of plain text. | ✅ Yes | ✅ Yes | | [Base64Encode](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/utilities/mc-ampscript-reference-utilities-base64-encode.md) | Utilities | Converts plain text to Base64-encoded binary data. | ✅ Yes | ✅ Yes | | [BeginImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/content/mc-ampscript-reference-content-begin-impression-region.md) | Content | Denotes the beginning of a region to track with impression tracking. | ✅ Yes | ✅ Yes | | [BuildOptionList()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-references/content/mc-ampscript-reference-content-build-option-list.md) | Content | Creates a set of `