# What architectural role do API Gateways play in managing enterprise traffic entering Salesforce endpoints?

**Topic:** Integration · **Difficulty:** Medium · **Tags:** Integration, API Gateway, Enterprise Architecture

Read it on the site: https://www.forcechallenges.com/interview-questions/what-architectural-role-do-api-gateways-play-in-managing-enterprise-traffic-entering-salesforce-endpoints

## Answer

**Basics:** Without a gateway, every client app calls Salesforce REST endpoints directly, each with its own credentials and retry behavior. A gateway, such as MuleSoft Anypoint API Manager, Azure API Management, Apigee or AWS API Gateway, gives you one place to apply policies and to see who is calling what.

**How it works:**
1. A client calls the gateway URL with its own client ID or token.
2. The gateway checks authentication, applies quotas and throttling, validates the request schema, and may transform or cache it.
3. It forwards the call to Salesforce using a single connected app and integration user.
4. It handles Salesforce errors and returns a consistent response to the client.

**Advanced / deep dive:** The gateway protects the Salesforce API request allocation (a rolling 24-hour limit by edition and license count) and the concurrent long-running request limit. Caching of read-heavy calls cuts consumption. Using one integration identity improves control but hides the end user, so pass user context in a signed claim if Salesforce needs it. API-led connectivity in MuleSoft arranges this into system, process and experience APIs, so changes to Salesforce do not break every consumer. The gateway should also handle token refresh, retry with backoff for `REQUEST_LIMIT_EXCEEDED` (a 403 response from Salesforce) and circuit breaking. It is an additional hop, so it adds latency and an extra system to operate. Salesforce security still applies: the integration user's profile, permission sets and sharing decide what can be read.

**Code / config example:**
```text
Policy chain at the gateway (example)
1. Client ID enforcement / OAuth token validation
2. Rate limiting: 100 requests / 60 s per client
3. IP allowlist for partner traffic
4. Request schema validation (JSON schema)
5. Forward to https://<MyDomain>.my.salesforce.com/services/data/vXX.X/...
```

**Hidden gotchas & must-remember points:**
- Salesforce counts every forwarded call against its API limits, so the gateway must throttle first.
- The gateway becomes a single point of failure unless deployed redundantly.
- A shared integration user concentrates risk. Give it least-privilege permissions.
- Salesforce rate-limit errors come back as HTTP 403 `REQUEST_LIMIT_EXCEEDED`, not 429, so map them.
- Gateways do not replace Salesforce sharing and field-level security.
- Egress IPs of the gateway must be allowlisted in Salesforce if IP restrictions are used.

**Best practice:** Put policy, throttling and observability in the gateway, and keep Salesforce permissions minimal on its integration user.

---
Source: ForceChallenges · last updated 2026-11-02
