API security monitoring: how the OWASP API Security Top 10 shows up in your telemetry

A practical guide to detecting broken authorization, credential abuse, resource exhaustion, data exposure and shadow APIs from the logs, metrics and traces you already collect, without logging secrets.

Obseria TeamObseria
Summary
  • API security monitoring works best when each OWASP API Security Top 10 2023 risk is mapped to a concrete signal in logs, metrics or traces, such as per-identity 403 rates, object-ID enumeration or response size anomalies.
  • Distributed traces give you a living API inventory, which is the most reliable way to find shadow and zombie endpoints that never made it into your OpenAPI specs or gateway configuration.
  • Good API security telemetry records who called what, on which object, with which outcome, while tokens, Authorization headers and personal data are removed before the data is stored.

API security monitoring is the practice of watching how your APIs are actually used in production and spotting the patterns that indicate abuse: an authenticated user walking through other customers' order IDs, a credential list being replayed against the login endpoint, or an old v1 endpoint that nobody remembers still serving data. Many API attacks look like perfectly valid HTTP requests. They only become visible when you look at behaviour over time, per identity and per object.

This guide uses the OWASP API Security Top 10 2023 as a structure. For each risk it shows what you can observe in logs, metrics and traces, gives example detections, explains how to build an API inventory from traces, and covers what to log without leaking secrets. It ends with an alerting approach and a checklist you can copy.

The OWASP API Security Top 10 2023 in brief

The OWASP API Security Project published its current list in 2023. The ten risks are:

  1. API1:2023 Broken Object Level Authorization (BOLA): a caller can access objects that belong to someone else by changing an ID.
  2. API2:2023 Broken Authentication: weak or flawed authentication lets attackers take over identities or tokens.
  3. API3:2023 Broken Object Property Level Authorization: responses expose properties the caller should not see, or requests can set properties they should not change (mass assignment).
  4. API4:2023 Unrestricted Resource Consumption: no effective limits on requests, payload sizes, pagination or expensive operations.
  5. API5:2023 Broken Function Level Authorization: regular users can call administrative functions.
  6. API6:2023 Unrestricted Access to Sensitive Business Flows: automated abuse of legitimate flows such as sign-up, checkout or voucher redemption.
  7. API7:2023 Server Side Request Forgery (SSRF): the API fetches a URL supplied by the caller and can be pointed at internal targets.
  8. API8:2023 Security Misconfiguration: verbose errors, permissive CORS, missing TLS or unnecessary HTTP methods.
  9. API9:2023 Improper Inventory Management: undocumented, outdated or forgotten API versions and hosts.
  10. API10:2023 Unsafe Consumption of APIs: trusting data from third-party APIs too much.

Prevention belongs in design and testing; monitoring tells you whether a control is missing, failing or being probed right now.

From risk to signal: a detection mapping

The table below maps each risk to the telemetry that reveals it. Thresholds are examples to illustrate the idea; tune them against your own baseline.

RiskObservable signalExample detection
API1 BOLADistinct object IDs per identity on one route; 403/404 ratio per identityOne user requests more than 200 distinct /orders/{id} objects in 10 min (example), or many sequential IDs
API2 Broken Authentication401 rate on auth endpoints, failed logins per IP and per account, token refresh errorsFailed logins from one IP across more than 20 accounts in 5 min (example)
API3 Property level authorizationResponse size per route and role; unexpected fields in write requestsp95 response bytes of a route doubles after a deploy; requests containing role or isAdmin fields
API4 Resource consumption429 rate, request rate per key, page size parameters, latency and CPU per routeOne API key exceeds 5x its usual hourly volume (example); limit=10000 on list endpoints
API5 Function level authorizationCalls to admin routes by non-admin roles; 403 on admin routesAny 2xx on /admin/* for a token without admin scope
API6 Business flowsBusiness events per identity, device or IP (sign-ups, redemptions, purchases)Voucher redemptions per account far above the normal distribution
API7 SSRFOutbound client spans from URL-fetching features; egress to internal ranges or metadata endpointsClient span from a webhook or import service to 169.254.169.254 or a private range
API8 Misconfiguration500s with stack traces in responses, unexpected HTTP methods, TLS versions, CORS preflights from unknown originsNew TRACE or PUT requests on routes that only support GET
API9 InventoryRoutes seen in traces that are missing from the spec; traffic to deprecated versionsAny traffic to /v1/ after its sunset date; a new http.route not in the catalogue
API10 Unsafe consumptionError rate, latency and payload anomalies on calls to third-party APIs; redirects followedParsing errors or schema validation failures on a partner API rise sharply

API inventory: finding shadow and zombie APIs from traces

You cannot protect an endpoint you do not know exists. Shadow APIs are endpoints that run in production without being documented or reviewed; zombie APIs are old versions that were supposed to be retired but still answer. Both are classic examples of API9.

Distributed traces are a reliable source for an inventory because they are generated by the running code. OpenTelemetry HTTP server spans carry attributes such as http.request.method, http.route (the route template, for example /orders/{id}), http.response.status_code and server.address, together with the service.name resource attribute. Grouping server spans by service, method and route gives you a list of every endpoint that received traffic, how often, from whom and with which outcome.

  • Compare against your specs. Diff the observed routes against your OpenAPI files and gateway configuration. Routes in traces but not in the spec are shadow candidates; routes in the spec with no traffic for months are candidates for removal.
  • Watch deprecated versions. Track request volume and distinct clients on old versions, so you know who still needs to migrate before you switch them off.
  • Flag new routes. A route that appears for the first time after a deploy is worth a quick review: is it authenticated, rate-limited and documented?
  • Use the topology. A service map shows which services are exposed externally and which internal services they call, which helps prioritise review.

Uninstrumented services remain invisible to this approach, so combine trace data with gateway and load balancer logs, which see every request at the edge regardless of instrumentation. A service catalogue is the natural home for the result.

Authentication and authorization failure patterns

Most API attacks produce a characteristic pattern of status codes. The trick is to look at them per identity, per client IP and per route rather than as a global error rate.

401 and 403 spikes

A rising 401 rate on login or token endpoints usually means credential stuffing, password spraying or a broken client. Many accounts from few IPs suggests spraying; one account from many IPs a targeted attack; one client version failing after a release a bug. A 403 spike for one authenticated identity across many routes or objects suggests that someone is probing authorization, which is the typical prelude to BOLA (API1) and function level attacks (API5).

Object ID enumeration

BOLA is hard to see in aggregate metrics because each request looks legitimate. It becomes visible when you count distinct object IDs per identity on a route in a time window. Sequential IDs, very high distinct counts, or a high share of 404 and 403 responses for one user are strong indicators. To make this possible, record the authenticated subject (a pseudonymous user or client ID, not an email address) and the object identifier as span or log attributes. Keep these out of metric labels, because unbounded IDs drive up cardinality; query them from logs or traces instead.

Privilege mismatches

Log the authorization decision itself: which policy or scope was evaluated, and whether it allowed or denied. A successful response on an admin route for a token without the admin scope is a high-confidence signal that deserves an immediate page.

Rate limiting, abuse and data exposure

Rate limiting is a control, but it is also a sensor. HTTP 429 Too Many Requests (defined in RFC 6585) tells you that a limit is doing its job; a sudden increase in 429s from one key or IP tells you who is pushing against it. Useful views:

  • Per-key and per-IP baselines: requests per minute, distinct routes and error share per API key, compared with that key's own history. Legitimate integrations differ by orders of magnitude.
  • Expensive parameters: page sizes, date ranges, export requests and GraphQL query depth on routes that drive database load. Correlate them with latency and CPU.
  • Business flow volumes (API6): sign-ups, password resets, voucher redemptions or seat reservations per identity, device and IP. These are business events rather than HTTP metrics, so emit them explicitly.

For data exposure (API3), monitor response size per route and role. A list endpoint whose p95 response size suddenly doubles may have started returning extra properties after a serializer change, or someone may be paging through it aggressively. Pair this with anomaly detection on bytes sent per identity, and you catch both regressions and bulk extraction.

Logging what you need without logging secrets

Security telemetry is useless if it becomes a liability. The most common mistakes are logging full request headers, including Authorization and Cookie, logging request bodies with passwords or personal data, and putting tokens or API keys into URLs, where they end up in every access log.

Log the facts needed for detection and investigation, in a structured form:

  • Timestamp, service, route template, method, status code, latency, request and response size
  • Pseudonymous subject or client ID, tenant, auth method, token scopes and key ID (not the key)
  • Authorization decision and policy name, object type and object ID where relevant
  • Client IP (consider truncation or hashing per your data protection assessment), user agent, gateway request ID and trace ID

OpenTelemetry instrumentations capture HTTP headers only when you explicitly configure them, as http.request.header.<key> attributes, so keep that list short and never include credential headers. As a safety net, remove or hash sensitive attributes centrally in the telemetry pipeline before storage, for example with the attributes or redaction processors of the OpenTelemetry Collector or with PII masking rules. Our post on security logging and audit logs covers retention and tamper protection in more depth.

# OpenTelemetry Collector, attributes processor (example)
processors:
  attributes/strip-secrets:
    actions:
      - key: http.request.header.authorization
        action: delete
      - key: http.request.header.cookie
        action: delete
      - key: enduser.id
        action: hash

Correlating gateway and WAF logs with distributed traces

Your API gateway and web application firewall see every request at the edge, including those they block. Your traces show what happened inside the application for requests that got through. Neither view is complete on its own: the WAF does not know that a request returned another customer's data.

Join the two by a shared identifier. The most robust option is to let the gateway start or propagate the W3C traceparent header, so gateway logs carry the same trace ID as the application spans. If that is not possible, log the gateway's request ID and pass it on as a header that the application records as an attribute. Then you can pivot from a WAF rule hit to the application behaviour of the same client, or from a suspicious trace back to the edge decision. Our comparison of SIEM and observability explains where each tool fits and how to forward relevant security events to a SIEM.

Alerting and response

API security alerts compete with every other alert for attention, so be selective:

  • Page on high-confidence signals: successful admin calls without the right scope, egress from URL-fetching services to metadata endpoints, bulk object access by one identity, or a sharp rise in successful logins after a failed-login spike.
  • Ticket for inventory findings: new undocumented routes, traffic on deprecated versions, response size regressions after a deploy.
  • Dashboard for context: 401/403/429 rates per route and key, top identities by distinct objects, top keys by volume.

Every alert should link to a runbook with first steps: identify the subject, key and IPs, check related traces, revoke or rotate the credential, tighten the rate limit or block at the gateway, and preserve evidence. Treat confirmed abuse as an incident with an owner and a timeline, as described in our incident management process guide.

API security monitoring checklist

  • All externally reachable services instrumented with OpenTelemetry, with http.route templates
  • Observed routes diffed against OpenAPI specs and gateway config at least weekly
  • Traffic on deprecated API versions tracked per client
  • 401, 403, 404 and 429 rates per route, per identity, per key and per IP
  • Pseudonymous subject, tenant, scopes and object ID recorded on spans or logs, not as metric labels
  • Authorization decisions logged with policy name and outcome
  • Distinct object IDs per identity per route available as a query or detection
  • Response size per route and role monitored for anomalies
  • Business flow events (sign-up, reset, redemption, checkout) emitted and baselined
  • Outbound calls from URL-fetching features traced; egress to internal ranges alerted
  • Authorization, Cookie, tokens, API keys and passwords never logged; pipeline redaction as safety net
  • Gateway/WAF logs share trace ID or request ID with application telemetry
  • Paging alerts limited to high-confidence signals, each linked to a runbook

How Obseria helps with API security monitoring

Obseria is an OpenTelemetry-native observability platform, so the traces, logs and metrics from your APIs and gateways arrive in one place without a proprietary agent. Application security builds on the same data that powers distributed tracing, which means a suspicious pattern links directly to the requests, services and deploys behind it.

  • Obseria Pipeline removes credentials and masks personal data before storage in the EU.
  • TopoGraph shows which services are exposed and which routes actually receive traffic.
  • Obseria Intelligence correlates 403 spikes, response size changes and recent deploys with evidence.
  • Incident management and the optional Managed Observability & Security service help you respond.

Want to see your API inventory and auth failure patterns on your own traffic? Book a demo.

Share

Observability that delivers answers.

Start for free with OpenTelemetry, no credit card required.