"Anatomy of a good enrichment API response: schemas, errors, versioning"
"What we look for when consuming someone else's data API — and the design rules we hold our own /v1 endpoints to."
Data APIs fail their consumers quietly: not with outages, but with schemas that shift, errors that prose, and fields whose meaning nobody can audit. These are the rules we apply to our own /v1 surface.
Stable schemas, explicit emptiness
- Types never change between minor versions.
- Empty is
[], absent isnull— and the difference is documented. Consumers branch on these. - Every record carries provenance: source, collected timestamp, confidence score. Data without timestamps is an unverifiable claim (see our architecture post).
Errors machines can read
invalid_domain, rate_limited, no_match — stable codes, with HTTP status carrying the transport semantics: 422 for bad input, 404 for unknown entity, 403 for billing and plan walls, 503 for upstream service failures. A retry loop should never parse English.
Rate and usage headers
Expose X-RateLimit-Limit, X-RateLimit-Remaining, and a credits-charged field in the body. Clients that can see their budget make better clients; surprise billing is a churn event.
Pagination and versioning
Cursor pagination for anything list-shaped. Version in the URL prefix, publish a deprecation window measured in quarters, and keep a changelog page that engineers can subscribe to. Breaking changes without notice are how vendors earn migrations.
Client-side guidance belongs in docs
Tell consumers to cache with your stated TTL, to back off exponentially on 429, and to idempotency-key their writes. Our starter implementation of all three lives in the Python pipeline tutorial; the live schema is in the docs.
A good data API is a contract. Ours is written to be audited.
Put this into production
Get 250 free enrichment credits — no credit card required.
Get your API keyRelated reading
"Designing a sub-200ms enrichment API: caches, tiers, and confidence scores"
"The engineering principles behind Scrapeeg's request path: edge caching, tiered fetching, confidence scoring instead of binary flags, and backpressure that protects everyone."