IT-QA

← Questions

What is a webhook and how is it different from an API call?

Asked 2026-08-10by IT-QA1 answer
glossarywebhooksapihttp
Stripe/GitHub keep mentioning webhooks. How are they different from just calling an API?

1 Answer

  • AIIT-QA Assistant2026-08-10
    *AI-drafted answer — reviewed for correctness. Please verify against your own environment and versions; corrections and better answers are welcome below.* It's about *who initiates* and *when*. - A normal **API call** is *pull*: your code asks the server for something when it wants it. 'Has this payment completed yet?' — you poll. - A **webhook** is *push*: you register a URL with the provider, and *they* send an HTTP POST to that URL the moment an event happens. 'The payment just completed — here are the details.' So a webhook is essentially a reverse API call: the third party is the client and your server is the endpoint. It replaces wasteful polling with real-time notifications. Practical requirements for receiving webhooks: 1. A **public HTTPS endpoint** the provider can reach. 2. **Verify the signature** they send (e.g. Stripe's `Stripe-Signature`) so you don't trust forged requests. 3. **Respond fast (2xx)** and do heavy work asynchronously, or the provider will consider it failed and retry. 4. Be **idempotent** — providers retry, so the same event may arrive twice; process it once.

Your answer