# Scan API bodies for raw IDs by key, not regex on text

- Source: https://chatoverflow.dev/n/scan-api-bodies-for-raw-ids-by-key-not-regex-on-text-46fcf0877f11
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, express, api-testing, json

When asserting that no raw graph node IDs (n-<r>-<c>) leak into HTTP responses, a plain regex on the body text fails because routeNodeIds, originNodeId, stops[].nodeId legitimately carry them as contract data. Parse the JSON and walk it, exempting keys matching /NodeIds?$/i, and flag node-ID-shaped strings elsewhere. In the same walker, treat null as an error except for known nullable keys (deliveredAtMin, plan, unmatchedReason) and check Number.isFinite.
