Webhook vs API: the difference is who makes the request
The webhook vs API difference is direction: with an API your code asks for data, with a webhook the other service pushes it to you. Same HTTP, opposite initiator, very different costs.
On this page
The webhook vs API difference is direction. When you call an API, your code makes the request and waits for the answer. When you receive a webhook, the other service makes the request and your code has to answer it. Same protocol, same JSON, opposite initiator. Every other difference people list is a consequence of that one flip.
Same HTTP, opposite roles
RFC 9110 defines HTTP the obvious way: a client sends requests, a server responds. A webhook does not escape that. It swaps who is the client. In the pull direction your process is the client and the provider is the server. In the push direction the provider is the client and your process is the server.
That is why the two checklists look so different. As the client you already hold the credentials, you chose the moment, and a failure lands in your own stack trace. As the server you need a publicly reachable HTTPS URL, you have to prove the caller is who they claim to be instead of the other way round, and a failure lands in somebody else’s retry queue.
What each direction actually costs
In practice the webhook vs API difference is a trade of engineering effort against latency. Pulling is cheap to reason about. No inbound URL, no shared secret, no replay window, and a test that reads top to bottom. The classic cost is latency plus wasted requests: a timer that fires every two seconds is mostly asking a question whose answer is “not yet”. Long polling removes most of that. One request stays open until the event happens or the timeout expires, so you get push-like latency with pull-shaped code.
Pushing is cheap at runtime and expensive in engineering. You now run an endpoint that strangers can POST to, so you need signature verification, constant time comparison, a timestamp window, idempotent handling, and somewhere to look when a delivery never arrives.
What the mature implementations look like
Stripe’s webhook documentation is the reference implementation most others copy. You register an HTTPS endpoint, Stripe signs each event with an HMAC covering a timestamp plus the raw body, and the docs are explicit that any framework which manipulates the raw body breaks verification. It retries with exponential backoff for up to three days in live mode, tells you to return a 2xx before doing real work, defaults to a five minute timestamp tolerance against replays, and warns that an endpoint can receive the same event twice, so you log event IDs and dedupe.
Svix attacks the other half of the problem. Its docs describe webhook sending as a service: retries, signature verification, endpoint management, idempotency, and a portal where your customers manage their own endpoints. If your product needs to send webhooks, that is a genuine strength, and rebuilding it badly in-house is a common way to waste a quarter.
Where the difference stops being abstract: email in tests
Say a Playwright test needs the verification code your app just emailed. Both directions exist; one is obviously correct.
Pull, with InboxDome: POST /v1/inboxes creates a throwaway address, then
GET /v1/inboxes/{id}/wait?for=otp&timeoutSeconds=30 blocks until a verification code
lands and returns the message with the parsed OTP. No inbound URL, no secret, nothing to
tunnel. It behaves the same on a laptop and in CI.
Push, same service: POST /v1/webhooks registers your HTTPS endpoint and returns a secret
once. Each message.received delivery carries X-InboxDome-Event-Id,
X-InboxDome-Timestamp and X-InboxDome-Signature, a hex HMAC-SHA256 over the timestamp,
a dot, and the body. Verify it in constant time, reject stale timestamps, dedupe on the
event id. Failed deliveries retry up to five attempts, and GET /v1/webhooks/deliveries
is the log you check when your endpoint “never got it”. The payload carries metadata rather
than the message body, so you fetch content from the messages endpoint only when you
actually need it. Exact shapes live on the Email Testing API reference.
The rule that falls out: tests pull, services push. A test wants a deterministic wait it can fail on. A support desk ingesting replies wants to be told the instant mail lands. Receiving test email inside Playwright covers the pull side, and the same reasoning explains why IMAP based tests fall over in CI, since IMAP is polling with extra connection state bolted on.
Local development is where push gets annoying
A webhook endpoint has to be reachable over public HTTPS, which localhost is not. The
ngrok agent forwards traffic from an endpoint on its cloud service to your local app, and
some vendors ship their own forwarder: stripe listen --forward-to localhost:4242/webhook
prints a signing secret and pipes live events at your machine. Both are good tools.
Neither has an equivalent on the pull side, because there is nothing to tunnel. That
asymmetry, not latency, decides it for most teams.
You can also test the handler with no real traffic. Sign a fixture with your secret, POST it at yourself, and assert that a tampered body is rejected. That test is worth more than the happy path, which a signature check that accepts everything passes perfectly.
Where InboxDome is the wrong choice
Plainly:
- You need to send webhooks to your own customers. Use Svix, or copy Stripe’s pattern. InboxDome only pushes events about mail arriving in inboxes you created with it.
- You need to send email, or run your own SMTP server. InboxDome is receive-only by design, which is exactly why it cannot be used to spoof or spam. For capture and inspect workflows, weigh the options in email sandboxes compared.
- You want to watch an existing production mailbox. We do not connect to your IMAP account.
- You want many webhook endpoints on the free tier. It allows one, so a fan-out design will not fit.
- Mailosaur is the closest direct comparison. Its documentation describes a simple REST API for testing email; check their docs for current push support and their pricing page for limits.
The rule worth remembering
Ask who knows first. If your code knows when to expect the thing, pull, and use a long poll so you are not burning requests. If only the other system knows, push, and budget for signatures, retries and duplicates. Most real integrations end up doing both: a webhook to learn that something happened, then an ordinary API call to fetch what it was. Once you read the webhook vs API difference as a question about who initiates, rather than which style is more modern, choosing takes seconds.
Next: picking an email API for your stack and the API reference.
Disclosure: InboxDome publishes this blog and makes the products it mentions. We describe what they do rather than promise results.
Key takeaways
- A webhook is not a different protocol. It is the same HTTP request with the roles swapped: their server calls your server.
- Pulling from an API is deterministic and works from a laptop. Pushing is instant but needs a public HTTPS endpoint you own and defend.
- Push costs you signature verification, retries, duplicates and a debugging surface you did not initiate.
- Tests should pull. Long running services that must react to an external event should push.
- If your own product needs to send webhooks to customers, a dedicated delivery service beats building one in-house.
Sources
- Stripe: receive events in your webhook endpoint — Documents signature verification over the raw body, automatic retries, and returning a 2xx quickly.
- RFC 9110: HTTP Semantics — The client sends requests and the server responds. A webhook only changes which machine plays which role.
- Svix documentation — Webhook sending as a service, covering retries, signature verification and endpoint management.
- ngrok agent documentation — Forwards traffic from a public endpoint to a local service, which is how you receive webhooks on a laptop.
Links last checked September 11, 2026.
Frequently asked questions
Is a webhook an API?
It is part of one, but the direction is reversed. A REST API is an endpoint you call. A webhook is an endpoint you host that the provider calls. Most services ship both, and the webhook payload usually tells you just enough to go and call the regular API for the full object.
Is polling always worse than a webhook?
No. Polling is far easier to test, needs no public URL, and cannot be spoofed by a stranger posting JSON at you. Long polling removes most of the latency penalty. Naive polling on a fixed timer is what people actually mean when they say polling is worse.
Why does my webhook signature check fail on some payloads only?
Almost always because you hashed a re-serialized body instead of the raw bytes. Key order, whitespace and unicode escaping do not survive a JSON parse and re-encode, so it passes on plain ASCII payloads and fails the first time a subject line has an accent in it.
Do I need a tunnel to develop against webhooks?
Yes, unless the provider ships a forwarding CLI. A webhook endpoint has to be reachable from the public internet over HTTPS, so localhost needs something like the ngrok agent in front of it. That requirement is one sided: the pull direction never needs a tunnel.