# Idle API Gateway

> API Gateway APIs with a Count series showing zero requests across the full 30-day window would be delete candidates worth their entire monthly cost. ZopNight abstains on every API today: the aggregator prices api-gateway at $0 (calcFree), and the CloudWatch query dimensions ApiName by ID instead of display name.

Source: https://zop.dev/integrations/aws/recommendations/idle-api-gateway
Updated: 2026-08-19

---

## The Count series and the cost gate

- metric: Count (CloudWatch AWS/ApiGateway, Dimension ApiName; replaces the dead requests Tag). Keyed UID:Count.
- pricing: per-API recoverable monthly cost (abstains when absent or ≤ 0).

## Two producer gaps that keep this abstaining

Concrete or abstain: savings = cost × 1.00 (full cost recoverable on delete). Fires only when the Count series is present, covers the full window, is idle (Maximum==0 && Average==0), and r.pricing[uid] > 0. Producer-gap #1 (cost, dormant on live data): aws api-gateway/api-gateway-v2 are mapped to calcFree in the aggregator (registry.go:166-167), so r.pricing[uid]==0 for every API Gateway in production and the cost-gate always abstains, so RC-166 never emits on live data today. To make it fire concretely, the producer must move api-gateway off calcFree onto a Count(Sum) times [per-request-rate](https://aws.amazon.com/api-gateway/pricing/) calc (and surface fixed standing items like custom-domain/ACM/log-retention); an idle API's usage cost is itself ~$0. Producer-gap #2 (metric, independent, fails first): the aggregator's api-gateway MetricSpec dimensions the CloudWatch Count query with the resource UID (the API's ID), but [AWS's real ApiName dimension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html) is the API's configured display name, so for most real APIs the series is empty/absent and the metric gate abstains before the cost gate is even reached. Fixing this requires the discoverer to capture the API's display name into Metadata and the MetricSpec to dimension off it. Never fabricates a fraction and never emits $0.

## Retiring an unused API

1. Verify no applications depend on this API
2. Check custom domain mappings and Route 53 records
3. Delete unused stages first
4. Delete the API Gateway if confirmed unused

## The Count metric window

Count (30d)
