An Azure service that provides a hybrid, multi-cloud management platform for APIs.
Hi @jinxjer lee
Thank you for reaching out to Microsoft Q&A.
Azure API Management (APIM) is designed as an API gateway and policy engine, not as a logging or payload archival system. When dealing with large request bodies (for example, 1 MB to 10 MB), APIM enforces multiple internal limits to protect gateway stability, memory usage, and performance. Because of these limits, built-in logging mechanisms such as Azure Monitor/Application Insights truncate request bodies by design, and policies like log-to-EventHub enforce a strict payload size limit (around 200 KB). Even other outbound policies such as send-one-way-request still process the payload inside the APIM runtime and are not guaranteed to handle large bodies safely or reliably. As a result, attempting to persist or forward large, failed request bodies (for example, on HTTP 400 responses) directly from APIM is not supported and can lead to throttling, latency issues, gateway failures, or even data loss. This behavior is expected and aligns with APIM’s intended role in the architecture.
Refer below points to resolve this issue or use these as workarounds:
Log large request bodies at the backend, not in APIM Move the responsibility of capturing and storing the full request body to your backend service (App Service, Functions, Container Apps, etc.). When a 400 error occurs, the backend can safely store the complete request payload in Blob Storage, a database, or another storage service without APIM size constraints. APIM should only forward the request and handle routing, security, and transformation.
Use correlation IDs instead of full payload logging in APIM Generate or pass a correlation ID (for example, x-correlation-id) in APIM and forward it to the backend. On failure, log this correlation ID along with metadata such as request size, headers, or hashes in APIM, while the backend stores the full request body. This allows you to correlate logs without storing large payloads in APIM.
Pre-upload large payloads and pass references through APIM For very large request bodies, a recommended pattern is to have clients upload the payload directly to Blob Storage and then call the API through APIM with only a reference (Blob URL or ID). This avoids large payload handling in APIM entirely and makes error investigation simpler and more reliable.
If APIM-side logging is required, only log partial data As a compromise, you can log only a small truncated portion of the request body (for example, first 32–64 KB), the total content length, and a hash of the body when a 400 error occurs. This provides diagnostic value without violating APIM size and memory limits.
Avoid sending large request bodies via email or external webhooks from APIM Using send-one-way-request to send full request bodies to email, Logic Apps, or external services is not recommended for large payloads. This approach increases the risk of gateway instability, performance degradation, and potential security or compliance issues, especially in production environments.