An API gateway will happily accept a request from a token that was issued to a completely different tenant. That's not a bug in the gateway. It's what happens when object-level authorization lives in your head instead of in the code, and it's the single most common way cloud APIs get breached in 2026.
If you want the short version: best practices for securing cloud APIs come down to verifying every request against the actual object it's touching, treating your own workloads as untrusted callers, and knowing exactly which endpoints exist before an attacker finds them first. Everything else—encryption, logging, gateways—sits on top of those three.
Key takeaways
- Broken object-level authorization (BOLA) remains the top risk in OWASP's API Security Top 10, and it's a code problem, not an infrastructure one
- Cloud-native controls (workload IAM, secrets managers, mTLS between services) matter more than generic API checklists when your APIs run in AWS, Azure, or GCP
- Every endpoint needs to be inventoried, versioned, and decommissioned on a schedule—shadow APIs are where breaches hide
- Encryption in transit and at rest is table stakes; key rotation and tokenization of sensitive fields are where teams still fall short
- Logging that doesn't capture the caller identity, the object ID, and the decision outcome is decorative, not useful
Why securing cloud APIs is different from securing a monolith
The first time I audited a cloud-native API, I found forty-three endpoints. The team's own documentation listed twenty-two. The rest had been added by contractors, by a migration script, and by someone who left the company two years earlier. None of them required authentication beyond a shared service token.
That's the core tension with cloud APIs: they multiply fast, they're consumed by machines more than humans, and the blast radius of a single misconfigured endpoint is enormous because everything lives on the same network fabric as your databases and object storage.
The cloud changes the threat model
In a traditional data center, the perimeter did a lot of invisible work. In the cloud, there is no perimeter. Your API is reachable from anywhere if a security group rule says so, and those rules get loosened during incidents at 2 a.m. and never tightened again. The mechanisms that actually protect you are different:
- Workload identity—IAM roles attached to compute instances or pods, not long-lived static keys baked into images
- Network policies at the service-mesh or VPC level, not just security groups
- Secrets management with rotation built in, rather than environment variables in a deployment manifest
- Mutual TLS between internal services so that a compromised pod can't just call its neighbors
Notice what's missing from that list: nothing about firewalls in the classic sense. Cloud API security is mostly about assuming network trust has already failed.
Which APIs actually matter
You cannot secure four hundred endpoints to the same standard, and pretending otherwise is how teams burn out. The dimension that should drive your prioritization is reachability: which endpoints are internet-facing, which ones touch regulated data, and which ones accept user-controllable input that eventually reaches a database.
I use a simple triage scheme—three columns, scored by hand:
- Exposure: public internet, partner network, or internal-only
- Data sensitivity: does this endpoint return PII, credentials, financial records, or anything covered by a compliance regime?
- Auth complexity: does it rely on object-level checks, role hierarchies, or tenancy boundaries?
Anything scoring high on two or more columns goes to the top of the list. This isn't scientific. But it forces a conversation about which API actually hurts if it's compromised, and in my experience that conversation alone prevents more incidents than any scanning tool.
Authentication is easy; authorization is where teams fail
Getting a JWT issued is a solved problem. Getting the right JWT to access the right object is not, and it's the reason BOLA has stayed at the top of the OWASP list for years.
The pattern is always the same. An endpoint like /api/v1/invoices/{id} validates the token, confirms the caller is a paying customer, and then returns whatever invoice ID you ask for. The token proves who you are. Nothing checks whether this invoice belongs to you.
Check the object, not just the token
The fix isn't exotic. Every request handler that touches an object must query by both the object ID and the caller's tenant or ownership scope. Sounds obvious. In a codebase where the data access layer was written before multi-tenancy existed, it's a rewrite.
What I've found works, practically:
- Centralize the ownership check in a middleware or repository layer, so individual handlers can't forget it
- Add a negative test for every endpoint: authenticated as tenant A, request tenant B's object, expect a 403 or 404, and fail the build if you get a 200
- Prefer 404 over 403 in responses that reveal whether an object exists at all
That last point is a matter of opinion, but I'll defend it: a 403 tells an attacker the object is real and they just can't reach it, which is useful reconnaissance. A 404 tells them nothing.
What are the 5 basic principles of REST API?
REST itself defines five architectural constraints, and they matter for security because they determine where controls can live:
- Client–server separation: the client never holds your database credentials, only a token
- Statelessness: every request carries its own authentication context, so a stolen session can't be resurrected on another node
- Cacheability: cached responses must be marked correctly, or sensitive data leaks into shared caches
- Uniform interface: predictable resource paths make object-level authorization easier to apply consistently
- Layered system: intermediaries (gateways, proxies, meshes) can enforce policy without touching application code
None of that is security guidance on its own. But it tells you where to put the enforcement: at the resource layer and at the intermediary, not scattered through business logic.
You can't secure endpoints you don't know about
Every cloud estate I've looked at has at least one API endpoint responding on a hostname nobody remembers creating. A staging service still pointed at production data. An old version that was supposed to be sunset six months ago.
Inventory sounds boring until you realize that shadow APIs are the ones attackers find quickly, because they're scanned for just like everything else. The endpoint you forgot is the one without rate limiting.
What actually helps:
- Enumerate from the traffic side, not the code side: pull from load balancer logs and gateway access logs, then reconcile against your declared spec
- Version explicitly. When
/v1is deprecated, retire it on a published date rather than letting it run "until further notice" - Tag endpoints by owner in your service catalog so that when a scan flags something, someone is accountable for the fix
The reconciliation is the hard part. I've written scripts comparing an OpenAPI spec against observed request paths, and the diff is always longer than expected. That's not a reason to skip it—it's the reason the exercise is worth doing.
Protecting the data that flows through your APIs
What are some best practices for securing data in the cloud?
Data protection for cloud APIs comes down to three layers: encryption in transit, encryption at rest with keys you control, and reducing how much sensitive data the API ever touches in the first place.
In transit, enforce TLS with a modern minimum version at the gateway and reject plaintext fallbacks at the service level, not just at the edge. In my experience, the second hop—service to service inside the cluster—is where TLS is most often disabled "temporarily" for debugging and never re-enabled.
At rest, the practical question is key ownership. Managed cloud encryption is fine until you need to revoke access to your own data for regulatory reasons, at which point customer-managed keys give you a lever that the platform's default doesn't. Rotation intervals are worth documenting: I've seen key versioning policies set to ninety days on paper and never actually executed because the rotation job was disabled during an incident.
Tokenization and field-level masking are underused. If your API returns an account number, consider returning a tokenized reference instead and resolving the full value only in the one service that genuinely needs it. Fewer services seeing raw PII means fewer places it can leak from.
What are the five pillars of cloud security?
The five-pillar model that most cloud security frameworks use gives you a reusable structure for assessing any API:
- Identity and access management—workload roles, least privilege, no static credentials in code
- Network security—segmentation, private endpoints where possible, egress control
- Data protection—encryption, key management, classification
- Visibility and monitoring—logs with caller and object context, anomaly detection
- Incident response and governance—tested runbooks, mandatory reviews for new endpoints
Where teams get stuck is treating these as separate workstreams. An API that authenticates perfectly but logs nothing about which object was accessed leaves you unable to answer "was this a breach?" during an incident. The pillars only work as a set.
Operational controls that make the difference
Observability for APIs deserves more attention than it usually gets. A log line that records timestamp, status code, and latency tells you the API is up. It doesn't tell you that a single caller enumerated forty thousand object IDs in five minutes.
What I want in the log, minimally:
- The authenticated subject—which user, service, or role made the call
- The object identifier and the authorization decision, including denials
- Enough of the request shape to detect enumeration patterns without storing payloads
Denials are the gold. A sudden run of 403s from one caller is either a broken client or an attacker probing boundaries, and both are worth knowing about within minutes rather than after a quarterly review.
A working checklist for cloud API hardening
Here's the sequence I actually follow, ordered by return on effort rather than by how impressive the tooling looks in a slide deck.
| Layer | What to enforce | Typical failure I see |
|---|---|---|
| Authorization | Ownership check on every object access | Token validated, object not scoped |
| Identity | Workload IAM, short-lived credentials | Static API keys in container images |
| Network | Private endpoints, service-to-service mTLS | Internal traffic unencrypted |
| Data | TLS enforced, keys rotated, PII minimized | Rotation job silently disabled |
| Inventory | Reconciled endpoint list with owners | Shadow endpoints on old hostnames |
| Logging | Subject, object, decision recorded | Access logs without caller identity |
| Testing | Negative auth tests in the pipeline | Only happy-path tests run in CI |
Start at the top. Every row below it is worth less if the first one is broken.
The mistake I'd warn you against
The instinct I see most often is to buy an API security platform and assume the problem is solved. The scanning catches misconfigurations, the gateway enforces rate limits, the dashboard goes green. And then someone tests with the wrong tenant ID and gets someone else's data back.
None of the tools I've used will tell you that your code forgot to check ownership. That has to be designed in, tested negatively, and enforced at a layer where an individual developer can't accidentally route around it.
So the next time you're reviewing a cloud API, ask a blunt question: if I authenticate as a valid user and ask for an object that isn't mine, what happens? If nobody on the team can answer without opening the code, that's your first task—before the next gateway rule, before the next scan.