API Gateway Patterns for ERP Integration: When to Use and When It's Overkill

Type: ERP Integration System: Cross-ERP (Architecture Pattern) Confidence: 0.85 Sources: 8 Verified: 2026-03-07 Freshness: 2026-03-07

TL;DR

System Profile

This card covers the architecture pattern of placing an API gateway between API consumers and ERP backend systems. It is system-agnostic and applies to any ERP (Salesforce, SAP S/4HANA, Oracle ERP Cloud, Dynamics 365, NetSuite, Workday) with any gateway product (Kong, Apigee, AWS API Gateway, Azure APIM, SAP API Management). The card does NOT cover iPaaS-specific API management features (MuleSoft API Manager, Boomi API Management) — those are covered in the iPaaS comparison card.

SystemRoleAPI SurfaceDirection
API Gateway (Kong / Apigee / AWS / Azure APIM / SAP)Proxy, auth, rate limiting, monitoringREST, OData passthroughInbound from consumers
ERP System(s)Backend data source / targetREST, OData, SOAP, BulkOutbound to consumers via gateway
iPaaS (optional)Data transformation, orchestrationN/ABetween gateway and ERP
API ConsumersApplications, partners, agentsREST (via gateway)Inbound

API Surfaces & Capabilities

Comparison of what each gateway product offers for ERP API proxying.

GatewayDeploymentRate LimitingRequest TransformAuth MethodsCircuit BreakerPricing Model
Kong Gateway 3.xSelf-hosted, Konnect CloudSliding window, fixed windowHeaders, query, body (plugins)OAuth 2.0, JWT, API key, mTLSYes (plugin)OSS free; Enterprise ~$50K+/yr
Google Apigee XGoogle Cloud managedSpike arrest, quota, concurrentAssignMessage, JavaScript, XSLTOAuth 2.0, API key, SAML, JWTYes (target health)Pay-per-use or committed
AWS API Gateway v2AWS managed10K RPS default, per-routeVTL mapping templatesIAM, Cognito, Lambda authorizerNo native$1-3.50 per million requests
Azure API ManagementAzure managed, self-hosted optionPer-key, per-IP, per-subscriptionLiquid, XSLT policiesOAuth 2.0, certificates, managed identityYes (backend policy)Dev free; Std ~$700/mo; Prem ~$2,800/mo
SAP API ManagementSAP BTP managed (OEM Apigee Edge)Spike arrest, quotaAssignMessage, JavaScript, KVMOAuth 2.0, API key, principal propagationYes (target health)Bundled with Integration Suite
MuleSoft API ManagerAnypoint PlatformRate limit, spike control, SLA tiersFull DataWeave (iPaaS-grade)OAuth 2.0, client ID, JWTYes (built-in)Bundled with Anypoint license

Rate Limits & Quotas

Gateway vs ERP Rate Limits — The Coordination Problem

Gateway rate limits and ERP-native rate limits operate independently. Configure gateway limits to be stricter than ERP limits, or consumers hit opaque ERP errors instead of clean gateway 429 responses.

ERP SystemNative Rate LimitWindowGateway Should Be Set To
Salesforce100,000 API calls (Enterprise)24h rolling< 90,000/24h (10% margin)
SAP S/4HANA CloudFair-use throttlingPer-requestMonitor and adapt
Oracle ERP CloudThrottled at service levelPer-requestStart at 60 req/min
Dynamics 365 (Dataverse)6,000 requests per 5 min per user5 min rolling< 5,000/5min per user
NetSuite (SuiteTalk)10 concurrent, governance unitsPer-execution< 8 concurrent
WorkdayNo published hard limitsN/AStart at 120 req/min

Per-Request Limits at the Gateway

Limit TypeKongApigeeAWS API GatewayAzure APIM
Max request body sizeConfigurable (default 8MB)10 MB10 MB256 KB - 4 MB (by tier)
Request timeoutConfigurable (default 60s)55s (configurable)29s (hard limit, REST API)240s (configurable)
Max header size64 KB25 headers / 7 KB each10,240 bytes32 KB
WebSocket supportYes (Enterprise)NoYes (HTTP API)Yes (Premium tier)

Authentication

Two-Layer Auth Model

An API gateway creates a two-layer authentication architecture: the gateway authenticates the consumer; the gateway itself authenticates to the ERP.

LayerWho AuthenticatesFlowToken LifetimeManaged By
Consumer-to-GatewayAPI consumer (app, partner)API key, OAuth 2.0 client credentials, JWTMinutes to hoursGateway admin
Gateway-to-ERPGateway service accountERP-native OAuth 2.0, TBA, certificateSession-based (hours)ERP admin

Per-ERP Gateway Authentication

ERPRecommended AuthGotcha
SalesforceOAuth 2.0 JWT BearerConnected app digital certificate required; gateway must cache and refresh tokens
SAP S/4HANAOAuth 2.0 client credentials via BTPPrincipal propagation needed if ERP authorization is user-based
Oracle ERP CloudOAuth 2.0 client credentialsToken refresh endpoint differs from authorization endpoint
Dynamics 365Azure AD client credentials (managed identity if Azure APIM)Azure APIM + managed identity = zero-secret setup
NetSuiteToken-Based Authentication (TBA)TBA tokens don't expire; Kong/Apigee need custom plugin for HMAC-SHA256

Authentication Gotchas

Constraints

Integration Pattern Decision Tree

START — Should I put an API gateway in front of my ERP APIs?
├── How many applications/teams consume ERP APIs?
│   ├── 1 (single integration)
│   │   ├── Using iPaaS? YES → SKIP GATEWAY (iPaaS handles concerns)
│   │   ├── Using iPaaS? NO → SKIP GATEWAY (direct API simpler)
│   │   └── External partner access? YES → ADD GATEWAY (security boundary)
│   ├── 2-5 consumers
│   │   ├── All internal? YES → MAYBE (unified monitoring/auth)
│   │   ├── External partners? → ADD GATEWAY (security + per-partner rate limiting)
│   │   └── iPaaS already managing? → CHECK iPaaS API management first
│   └── 6+ consumers or external API program
│       └── ADD GATEWAY — this is the sweet spot
├── Which ERP?
│   ├── Salesforce → Gateway for auth consolidation; rate limiting secondary
│   ├── SAP S/4HANA on BTP → USE SAP API MANAGEMENT (native, principal propagation)
│   ├── SAP on-premise → ADD GATEWAY (reverse proxy)
│   ├── Dynamics 365 → USE AZURE APIM (managed identity, zero-secret)
│   ├── Oracle ERP Cloud → ADD GATEWAY (no built-in API management)
│   └── NetSuite → ADD GATEWAY only if >5 consumers
└── What does the gateway need to do?
    ├── Rate limiting only → CHECK if ERP native limits sufficient
    ├── Auth consolidation → ADD GATEWAY
    ├── Simple transform (header/query) → Gateway OK
    ├── Complex transform (object mapping) → USE iPaaS instead
    ├── Monitoring/analytics → ADD GATEWAY
    ├── API versioning → ADD GATEWAY
    └── Caching → ADD GATEWAY (reference data only)

Quick Reference: Gateway Product Decision Matrix

CriterionKongApigee XAWS API GatewayAzure APIMSAP API Mgmt
Best for ERPMulti-cloud, on-prem SAPMulti-ERP, analyticsAWS-native workloadsDynamics 365SAP S/4HANA on BTP
Rate limitingSliding/fixed, cluster-wideSpike arrest + quotaPer-route, 10K RPS defaultPer-key, per-IP, per-subSpike arrest + quota
Circuit breakerYes (plugin)Via target healthNo nativeVia backend policyVia target health
Developer portalYes (Enterprise)Yes (built-in)NoYes (built-in)Yes (API Business Hub)
Multi-regionManual per regionGlobal (Anthos)Per-region, via CloudFrontPremium tierSingle BTP region
OSS optionYesNoNoNoNo
ERP connectorsNo (generic proxy)No (generic proxy)No (generic proxy)D365 via Logic AppsSAP prebuilt adapters
Typical costOSS free; Ent $50K+/yr$25K-$100K+/yr$1-3.50/M requests$700-$2,800/moBundled w/ IS

Step-by-Step Integration Guide

1. Assess whether a gateway is needed

Audit your ERP API landscape: count consumers, map auth flows, check if your iPaaS already provides API management. [src6]

# Audit checklist
# 1. How many applications call ERP APIs? If < 5 internal, gateway may be overkill
# 2. Do external partners need ERP data? If yes, gateway is mandatory
# 3. Does your iPaaS have API management? (MuleSoft API Manager, Boomi, SAP API Mgmt)
# 4. Which ERP systems? D365 = Azure APIM; SAP BTP = SAP API Mgmt
# 5. Timeout requirement? AWS API GW hard limit 29s (REST API type)

Verify: If < 5 internal consumers and iPaaS handles auth/rate limiting → skip the gateway.

2. Configure gateway-to-ERP authentication

The gateway must authenticate to each ERP using ERP-native credentials. This is the most error-prone step. [src3]

# Kong declarative config — Salesforce OAuth 2.0 JWT Bearer
services:
  - name: salesforce-api
    url: https://your-instance.salesforce.com
    routes:
      - name: salesforce-query
        paths:
          - /erp/salesforce
    plugins:
      - name: request-transformer
        config:
          add:
            headers:
              - "Authorization: Bearer $(cached_sf_token)"

Verify: curl -H "apikey: KEY" https://gateway.example.com/erp/salesforce/services/data/v62.0/limits → returns Salesforce API limits JSON.

3. Set rate limits below ERP native limits

Configure gateway rate limiting with 10-15% safety margin below ERP native limits. [src7]

# Kong rate-limiting plugin — Salesforce example
plugins:
  - name: rate-limiting
    service: salesforce-api
    config:
      minute: 60
      hour: 3500
      day: 85000        # 85K vs Salesforce 100K = 15% margin
      policy: cluster   # Cluster-wide counter, not per-node
      hide_client_headers: false

Verify: Send 65 requests in 1 minute → requests 61-65 return HTTP 429 with Retry-After header.

4. Configure circuit breaker for ERP backend

ERP systems have maintenance windows. A circuit breaker at the gateway prevents cascading failures. [src2]

# Kong upstream health checks (circuit breaker)
upstreams:
  - name: salesforce-upstream
    healthchecks:
      active:
        healthy: { interval: 10, successes: 3 }
        unhealthy: { interval: 5, tcp_failures: 3, timeouts: 3, http_failures: 3 }
      passive:
        unhealthy: { tcp_failures: 3, timeouts: 3, http_failures: 3 }

Verify: Simulate ERP downtime → gateway returns 503, stops sending requests, auto-recovers.

Code Examples

Python: Rate limit coordination checker

# Input:  ERP rate limit config, gateway rate limit config
# Output: Validation — are gateway limits safely below ERP limits

def validate_rate_limits(erp_limits: dict, gateway_limits: dict, margin: float = 0.15):
    """Ensure gateway rate limits are below ERP native limits with safety margin."""
    issues = []
    for window, erp_limit in erp_limits.items():
        gw_limit = gateway_limits.get(window)
        if gw_limit is None:
            issues.append(f"WARNING: No gateway {window} limit — ERP enforces at {erp_limit}")
            continue
        max_safe = int(erp_limit * (1 - margin))
        if gw_limit > max_safe:
            issues.append(f"DANGER: Gateway {window} ({gw_limit}) exceeds safe ({max_safe})")
        else:
            issues.append(f"OK: Gateway {window} ({gw_limit}) safely below ERP ({erp_limit})")
    return issues

sf_limits = {"daily": 100_000, "hourly": 5_000}
gw_limits = {"daily": 85_000, "hourly": 4_250}
for line in validate_rate_limits(sf_limits, gw_limits):
    print(line)

XML: Azure APIM policy for Dynamics 365

<!-- Azure APIM inbound policy — Dynamics 365 Dataverse proxy -->
<policies>
  <inbound>
    <rate-limit-by-key calls="5000" renewal-period="300"
      counter-key="@(context.Subscription.Id)" />
    <authentication-managed-identity
      resource="https://your-org.crm.dynamics.com" />
    <rewrite-uri template="/api/data/v9.2/{remaining}" />
    <set-header name="OData-MaxVersion" exists-action="override">
      <value>4.0</value>
    </set-header>
  </inbound>
  <backend>
    <forward-request timeout="120" />
  </backend>
  <on-error>
    <choose>
      <when condition="@(context.Response.StatusCode == 429)">
        <return-response>
          <set-status code="429" reason="Rate limit exceeded" />
          <set-header name="Retry-After" exists-action="override">
            <value>60</value>
          </set-header>
        </return-response>
      </when>
    </choose>
  </on-error>
</policies>

cURL: Test gateway-proxied ERP API

# Test Salesforce query through Kong gateway
curl -s -w "\nHTTP Status: %{http_code}\nTime: %{time_total}s\n" \
  -H "apikey: YOUR_GATEWAY_KEY" \
  "https://gateway.example.com/erp/salesforce/services/data/v62.0/query?q=SELECT+Id,Name+FROM+Account+LIMIT+5"

# Check rate limit headers
curl -s -D - -o /dev/null \
  -H "apikey: YOUR_GATEWAY_KEY" \
  "https://gateway.example.com/erp/salesforce/limits" \
  | grep -i "x-ratelimit"

Data Mapping

Gateway Responsibility vs iPaaS Responsibility

ConcernGateway Can HandleiPaaS Should HandleNotes
Header injection (auth tokens)YesYesGateway is simpler
Query parameter rewritingYesYesGateway is simpler
URL path transformationYesYesGateway is simpler
JSON field renaming (flat)Possible (with plugins)YesGateway is fragile
Object nesting/flatteningNoYesBeyond gateway scope
Multi-object JOIN across ERPsNoYesiPaaS core capability
Error response normalizationYesYesGateway is ideal
Response cachingYesPossibleGateway is ideal

Data Type Gotchas

Error Handling & Failure Points

Common Error Codes

CodeSourceMeaningCauseResolution
429 (gateway)GatewayConsumer exceeded gateway rate limitToo many requestsWait for Retry-After header
429 (ERP)ERP (passed through)Exceeded ERP native limitGateway limit set too highReduce gateway rate limit
502GatewayERP returned invalid responseERP downtime, TLS mismatchCheck ERP health, verify TLS cert
503GatewayCircuit breaker openRepeated ERP failuresWait for half-open; check ERP
504GatewayERP response exceeded timeoutERP slow or maintenanceIncrease gateway timeout
401 (gateway)GatewayInvalid consumer API keyCredential issueRotate consumer key
401 (ERP via 502)ERPGateway ERP token expiredToken cache staleRefresh ERP OAuth token

Failure Points in Production

Anti-Patterns

Wrong: Using the API gateway as an integration platform

# BAD — treating the gateway like an ESB/iPaaS
# 200 lines of Lua/JavaScript doing: query SF, query SAP, join data,
# transform schema, apply business rules
# Result: unmaintainable, untestable, no error recovery

Correct: Gateway does routing and security; iPaaS does transformation

# GOOD — gateway handles proxy, auth, rate limiting only
services:
  - name: order-integration-api
    url: https://mulesoft.example.com/api/v1/orders  # Points to iPaaS
    plugins:
      - name: rate-limiting
        config: { minute: 60 }
      - name: key-auth
        config: { key_names: ["apikey"] }

Wrong: Double rate limiting without coordination

# BAD — gateway AND iPaaS AND ERP all enforce separate rate limits
# Consumer gets inconsistent 429 errors from different layers
# with different Retry-After values

Correct: Single rate limiting layer with ERP-aware limits

# GOOD — gateway is the ONLY consumer-facing rate limiter
# iPaaS rate limiting disabled; gateway limits set 15% below ERP
plugins:
  - name: rate-limiting
    config:
      day: 85000     # 15% below Salesforce 100K/24h
      policy: cluster
      hide_client_headers: false

Wrong: Gateway as single point of failure

# BAD — single gateway instance, no failover
# If this node dies, ALL ERP traffic stops

Correct: HA gateway with graceful degradation

# GOOD — multi-node cluster behind LB with direct-to-ERP fallback
upstreams:
  - name: erp-backend
    targets:
      - target: erp-node-1:443
      - target: erp-node-2:443
    healthchecks:
      active:
        healthy: { interval: 5, successes: 2 }
        unhealthy: { interval: 2, tcp_failures: 2 }

Common Pitfalls

Diagnostic Commands

# Check gateway health and upstream ERP status (Kong)
curl -s http://localhost:8001/upstreams/salesforce-upstream/health | jq '.data[].health'

# Check current rate limit counters (Kong)
curl -s http://localhost:8001/plugins | jq '.data[] | select(.name=="rate-limiting") | .config'

# Test gateway-to-ERP latency (difference = gateway overhead, should be < 50ms)
time curl -s -o /dev/null https://your-instance.salesforce.com/services/data/v62.0/limits
time curl -s -o /dev/null -H "apikey: KEY" https://gateway.example.com/erp/salesforce/limits

# Check Azure APIM metrics for D365 backend
az apim api show --resource-group RG --service-name APIM --api-id dynamics365

# Verify gateway TLS cert not expired
echo | openssl s_client -connect gateway.example.com:443 2>/dev/null | openssl x509 -noout -dates

Version History & Compatibility

GatewayLatest VersionReleaseNotable ChangesERP Impact
Kong 3.92025-12CurrentImproved WebSocket, new rate-limiting algoBetter event-driven ERP integrations
Apigee X2025-Q4CurrentAdvanced security analyticsBetter ERP API abuse visibility
AWS API Gateway v22024-11CurrentHTTP API matured (30min timeout)Higher timeout than REST API (29s)
Azure APIM2024-05-01CurrentSelf-hosted v2, managed identity improvementsBetter D365 zero-secret auth
SAP API MgmtIS 2024CurrentUpdated Apigee Edge, improved adaptersTighter BTP + principal propagation

When to Use / When Not to Use

Use API Gateway WhenDon't Use WhenUse Instead
6+ apps consume ERP APIs, need unified auth/monitoringSingle iPaaS integration handles auth, rate limiting, monitoringiPaaS built-in API management
External partners need ERP data accessAll consumers are internal with direct networkDirect API calls with retry logic
Multiple ERPs, need unified consumer experienceSingle ERP with well-documented native APIERP native API directly
Need API versioning (proxy old paths to new versions)ERP API is stable with backward compatibilityERP native versioning
Azure APIM + Dynamics 365 (managed identity, natural fit)Adding Azure APIM just for non-Azure ERPKong or Apigee (cloud-agnostic)
SAP BTP landscape needing S/4HANA API managementNon-SAP landscape with no BTP investmentThird-party gateway
Need circuit breaker / retry at the edgeiPaaS already has circuit breaker and retryiPaaS error handling

Cross-System Comparison: API Gateway vs iPaaS API Management

CapabilityStandalone Gateway (Kong/Apigee/AWS)iPaaS API Mgmt (MuleSoft/Boomi/SAP IS)Notes
Rate limitingFull (sliding window, quota, spike arrest)Basic to full (varies by platform)Standalone more configurable
Auth consolidationFull (OAuth, JWT, API key, mTLS)FullFeature parity
Request transformationSimple (headers, query, URL rewrite)Full (complex object mapping)iPaaS wins for complex transforms
Response cachingFullLimitedGateway purpose-built
Circuit breakerFullVariesGateway more configurable
Developer portalFullVariesStandalone gateways better
API analyticsFullBasic to fullApigee excels
Multi-ERP orchestrationNo (single hop proxy)Full (multi-step flows)iPaaS core capability
Error recoveryRetry + circuit breakerFull (DLQ, compensation)iPaaS wins complex recovery
Deployment flexibilitySelf-hosted, cloud, hybridCloud-firstKong wins on-premise
Cost (mid-scale)$0-$50K/yr$50K-$200K+/yrGateway cheaper standalone

Important Caveats

Related Units