This document outlines key considerations for reliably using Marketing Cloud Engagement Web APIs. We cover critical strategies for ensuring stable API operation, including the importance of implementing automated retries to handle intermittent errors, adjusting various timeouts, and effective logging practices.
This article explains key considerations for successfully using Marketing Cloud Engagement Web APIs. It covers the importance of implementing automatic retries for transient errors, adjusting timeouts, and proper logging methods to ensure stable API operation.
API requests may occasionally return temporary errors (primarily HTTP Status Codes such as 500 or 429). The causes vary—from temporary API service load to issues on the internet route—but in real-world usage, these temporary errors are inevitable and will occur irregularly. Therefore, you must anticipate the occurrence of temporary errors in advance and implement a retry mechanism.
Specifically, add error handling logic within the application issuing the API requests. Implement a mechanism to automatically retry API requests at appropriate intervals and frequencies when a 500-range error occurs. When resending requests, it is essential to handle them from the perspective of whether the process might be executed twice (including pre- and post-processing) or if the results might differ from the intended outcome.
On the other hand, for cases such as 400 Bad Request or 401 Unauthorized, where the issue lies with the client-side request, retrying will basically never succeed. In these cases, stop automatic retries, correct the request based on the error message, and then resend.
***) or hash this information before logging. Do not include this information in support inquiries.If no problem is found in the request and you wish to request an investigation from our support team, please mask confidential information and provide all request/response data.
※ If you provide only unique application logs or information that has been excessively processed or omitted, we may not be able to grasp the exact behavior on the MCE side, and consequently, may be unable to provide appropriate insights or solutions.
Acquiring a token (POST /v2/token) for every single process you execute will simply double your request count. A high number of requests increases the likelihood of encountering temporary errors or hitting request limits. Since tokens have a 20-minute expiration period, you should consider reusing an acquired token as much as possible within its active lifespan.
Client Secrets expire 180 days after generation. To ensure systematic rotation, please track and manage the locations where they are used (Servers, SSJS, etc.), associated installed package names, and expiration dates, and plan for regular updates.
Additionally, hardcoding Client Secrets directly within your code carries risks, such as exposure to MCE administrators or API application developers/managers, and the potential for overlooking necessary updates during rotation. Consider management methods such as using configuration files or secret management services for applications, or storing them as encrypted values in Data Extensions (DEs) for reference when using SSJS.
Reference) Rotate OAuth 2.0 Client Secret
Architectures that execute APIs directly from browsers or mobile app devices involve the following problems. As a general rule, we strongly recommend a "Server-Mediated (Proxy) Architecture."
Security: Storing authentication credentials (Client ID and Secret) on the app side to execute APIs carries a high risk of "spoofing" or "unauthorized use" by malicious third parties. Once embedded in an app, this information is easily extracted, and it is difficult for the customer to completely control or conceal it.
Reduced Maintainability: When API changes or version upgrades are required, you must force all users to update their apps, which incurs significant time and cost for the migration. By using a proxy server, API changes can be absorbed on the server side, enabling flexible system modifications independent of the client. Furthermore, because Client Secrets expire every 180 days, an architecture where the client directly holds the secret forces mobile users to constantly update to the latest version containing a valid secret. This not only complicates release management for the provider but also imposes a continuous update burden on end users.
Negative Impact on User Experience (UX): When requests are made directly from a device, momentary network interruptions or API service maintenance can directly cause screen freezes or inconsistent data displays. By utilizing caching or controlling alternative displays on the proxy server side, the impact on end users can be minimized.
To maintain the stable operation of the overall system, the API returns an HTTP 429 Too Many Requests error and temporarily restricts (throttles) requests when a large volume of requests is made from a specific account in a short period. In such cases, consider the following for stable utilization:
Respect the Retry-After Header: If a 429 error is returned, check the response header for the Retry-After value (in seconds). If you ignore this wait time and retry immediately, you may repeatedly receive 429 errors.
Traffic Leveling (Load Distribution): API rate limit thresholds are dynamic. Even if the total traffic volume is within limits, "spikes" caused by concentrated requests at a specific moment (e.g., exactly at XX:00:00) can trigger limits. We recommend leveling the load by staggering processing start times.
Reducing Request Count (Batching): In addition to avoiding redundant token acquisitions (Point 4), consider whether requests can be consolidated into batch operations where possible. (e.g., using Send email message to multiple recipients to send to multiple recipients in a single request.)
[NOTE]
*For security, be sure to mask (e.g., replace with ***), hash, or remove Access Tokens, Client Secrets, and personal information.
*For sporadic 500 errors, as described below, temporary issues are a common cause. A detailed investigation is most productive when a clear increase in error frequency is observed. If that is the case, please report the approximate trend — such as when it began and by how much the frequency has increased.
In some cases, the error details or occurrence counts recorded on the API client side may differ from the records on our (MCE) side.
HTTP 500 errors can be triggered by a wide range of external factors—including unstable internet routes, momentary interruptions of intermediary devices, or client-side timeout settings—in addition to temporary internal issues within our service.
Many of these cases are difficult to pinpoint, or even if identified, have no solution other than "retrying." To ensure we can prioritize resources for more critical errors, please categorize the event based on the following criteria before requesting an investigation.
These are errors that are "statistically inevitable" due to factors like temporary network congestion. Even with a post-mortem investigation, these events often leave no clear evidence in system logs, making it extremely likely that the investigation will conclude as "Reason Unknown."
Patterns of Occurrence:
Low Frequency / Non-consecutive: Only a few requests fail within several minutes, or occur irregularly a few times over several days.
Non-reproducible: The request succeeds normally when retried under the same conditions.
Our Policy on These Cases: Tracking low-frequency, sporadic events requires significant manual effort to isolate specific communications from vast system logs. Furthermore, most of these cases do not stem from persistent issues like system failures within MCE. Consequently, individual investigations are likely to conclude as "Reason Unknown," "Unavoidable Transient External Factor," or "Localized Overload." In many cases, providing a response will take time, and the ultimate guidance will be a recommendation to retry.
Recommended Action: Consider implementing automatic retry logic using algorithms such as Exponential Backoff within your application. This allows for automatic recovery and ensures stable operation with minimal business impact. Rather than tracking individual successes or failures in isolation, we recommend monitoring the trend of error counts—focusing on whether there is a clear upward trend compared to before or if the error content being returned is something never seen before. (This also helps determine if the situation has escalated to Category 2 below).
These are cases where a clear abnormal trend is observed, and there is a high probability of identifying the cause through server-side log analysis or process scrutiny.
Patterns of Occurrence:
High Frequency / Persistent: The 500 error rate has clearly risen above normal levels and continues without self-healing.
Full Reproducibility: The error occurs 100% of the time (or with very high probability) with specific operations or parameter combinations.
Our Policy on These Cases: These cases suggest persistent issues such as system faults, resource overload, or logical errors in the API. To identify the cause promptly, please verify the situation and submit a support case along with the "Recommended Information to Provide" mentioned above.
Additional Notes:
The transient and sporadic network errors described in this section are common to all web-based communications, including SFTP as well as APIs. (Refer to the article on SFTP).
Our investigations primarily focus on verifying the status and functionality of the API-related services provided by our company.
Q) Are there any recommended retry strategies?
A) While it depends on the use case, we recommend exponential backoff — gradually increasing the interval between retry attempts (e.g., retry after 3 seconds, then 10 seconds, then 60 seconds) — optionally combined with random jitter. If a Retry-After header (indicating the wait time before retrying) is returned with a 429 error, prioritize that value over your own backoff calculation and wait for the specified duration.
Q) I want to confirm information about the limits like request caps and timeouts.
A) Basic limitations for our API are documented in the "API Limits and Guidelines" below. However, even within these limits, temporary restrictions (HTTP 429 Too Many Requests) may be applied if a large number of high-load requests are executed in a short period.
Reference 1: API Limits and Guidelines
Reference 2: Rate Limiting Errors
Q) What is the specific "limit" or threshold that triggers a 429 error?
A) There is no fixed, published limit. The throttling threshold varies dynamically based on the overall system load at any given moment and the specific processing requirements of the request (e.g., database load). Therefore, you may receive a 429 response even if your API traffic volume is at its usual levels.
If 429 errors persist despite implementing Point 4 (Token reuse) and Point 7 (Peak distribution), please contact Support with details regarding the occurrence and detailed logs.
Q) If an error occurs during data registration, updates, automation, or email sends, is it okay to retry as-is?
A) No. Performing a simple retry upon an error can lead to risks such as duplicate sends (sending the same message multiple times) or data inconsistency (unintended updates or sends occurring because the data changed by the time of the retry).
Key Considerations for Retries: If the API client treats a request as an error (e.g., due to a timeout) without waiting for a response from MCE, there is a possibility that the process succeeded on the MCE side. When implementing automatic retries, you must ensure that they do not lead to duplicate sends or executions.
Specific Example:
Transactional Messaging API (Email): In this API, if the client does not specify a messageKey, the server generates one automatically. If the client retries while the server has already successfully accepted the original request, there is a risk of duplicate sends. (If the client does specify the key, retrying with the same key will result in an error as that key cannot be reused within a certain period).
Recommended Measures:
Obtain the messageKey from the send request response.
Use Retrieve status of an email message to confirm the send result.
Execute a retry only if it is confirmed as unsent.
Q: Can you assist with implementing the API client — for example, how to write or configure it in Python or cURL?
A) We are unable to provide official guidance on implementation details specific to programming languages or external tools in support cases. However, if you suspect that an error related to a specific implementation is caused by MCE behavior, please contact us with your isolation findings and the raw HTTP request/response logs captured during the issue.
001035940

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.