Skip to content
← Blog

Why failed API calls should be free

hoshime bills only when a source answers. Here is why billing failures is the wrong incentive for a data API, and what is free.

1 min read#pricing#reliability

Data APIs fail more than most. Sources change their markup, rate limit, put up bot walls or simply go down. An API that sits in front of hundreds of sources sees some of that every hour.

So who pays for a failure?

The incentive problem

If failures bill, the provider earns money when its integration breaks, and you pay for the retries your code makes to get one good answer. A provider that bills failures has no money reason to fix them quickly.

hoshime bills only when the source answers. A blocked source, a timeout, a bad parameter or a hoshime bug costs nothing. Retrying a failed call never costs more than the one call that succeeds.

What else is free

  • Cached answers. Endpoints keep a successful answer for a while. A call that hits the cache says meta.cached: true and bills 0 units.
  • Internal retries. When a source blocks a request, hoshime retries through proxy tiers, from direct to datacenter, residential and mobile exits. You pay for the answer, not the attempts.
  • Idempotent repeats. Creates that take an idempotencyKey return the stored resource for a repeated key, and bill nothing.

Every answer says what it cost

meta.units and the Hoshime-Units header say what each call billed. GET /v1/usage sums it by day, by route, or by the X-Client-Ref you send, so you can pass the cost on to your own customers. See Billing and caching.

Keeping failures rare

Free failures are a promise, and a daily health check keeps it honest: every endpoint is called with a sample that must work, and endpoints that fail or answer bad data are flagged before customers find them.

esc
↑↓ move↵ open