#engineering

"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 is null — 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.

Written by Scrapeeg Engineering

We build enrichment infrastructure and write about what we learn: data quality, deliverability, compliance, and API design. Corrections and questions welcome via the contact page.

Put this into production

Get 250 free enrichment credits — no credit card required.

Get your API key

Related reading

← Back to all articles