Programmers who make a request to an API will then receive a response. For example, using Web API to send an email, you’d pass the email contents with the request. If all goes well, you will receive a response declaring success.

To use a webhook, you register a URL with the company providing the service. That URL is a place within your application that will accept the data and do something with it. In some cases, you can tell the provider the situations when you’d like to receive data. Whenever there’s something new, the webhook will send it to your URL.

So, they are basically doing the same thing.

My question is this: What is the difference between webhook and api?

Not in the terms WEBHOOK IS ____ and API IS ______.

I know what are they. I'm interested in key differences and when to use one, and when to use another.


6 Answers 6


The first and main difference between them is that with most APIs there’s a request followed by a response. No request is required for a webhook, it just sends the data when it’s available.

Simple view:

The API is an interface to your data on example.com. The API is used from your server to the example.com platform and can be used to List, Create, Edit or Delete items.

Webhooks are automated calls from example.com to your server triggered when a specific event happens in example.com. For example, when a task is completed and you want to know about it in real time we'll make a POST request to the URL you have registered for the EVENT.COMPLETED webhook in your example account.

So, in a nutshell: The API is where you tell example.com things and Webhooks is where example.com tell you things.

Looking more in depth:

SaaS is a concept - the idea of Software that exists in the cloud and the client is generally a browser. A SaaS application is defined by the functions it can provide to a user (for example Salesforce provides a database that can be used to store customer information) the functions available are determined by the purpose of the application (ie: CRM, Email Blaster, CMS, etc.).

An API is a way for SaaS applications to be connected with other applications via a common communication method (ReST, SOAP, JSON, etc). An API cannot speak directly to another API. An API can be used by a coded application or middleware that acts as a bridge between two API's and runs the thread of execution. For example - both NetSuite and Salesforce have a SOAP API, but for them to communicate - you'd want to use middleware software that can interact with both systems and be configured to pull new contact records through Salesforce's API and push new records to NetSuite through it's API every hour.

Webhooks is another communication protocol for SaaS applications that allows for communication between applications, but simply using HTTP POSTS to control the thread of execution. Webhooks allow an application to speak directly to one another, without using middleware. For example - when you submit a form to WuFoo, it can be set up to initiate an webhooks HTTP POST to another service and pass over some field values from the form submission. Webhooks can also be used in conjunction with an API - for example after the webhook notifies the other application something to happened to record id X, that application could use an API to communicate with the service to check the new field values or modify a status of a record.

It is difficult to have an API or webhooks without having a SaaS application. However, you can easily have a SaaS application that doesn't use webhooks or a (public)API. Similarly, depending on the functions of your SaaS application, you may choose to use webhooks OR an API.

  • Thanks! I joined this community just to upvote your answer (and the question of course!).
    – Kaushal28
    Mar 16, 2020 at 6:05

API is doing stuff when you ask it to, while Webhook does stuff on it's own when certain criteria match.

So, in a nutshell: The API is where you tell us things and Webhooks is where we tell you things.

via http://apidocs.teamwork.com/article/466-whats-the-difference-between-the-api-and-webhooks

Whenever there’s something new, the webhook will send it to your URL.

via https://sendgrid.com/blog/webhook-vs-api-whats-difference/


I'll illustrate this with a concrete example: Credit card payments.

When your site wants to charge a credit card, you call an API at your credit card processor. The credit card processor then charges the credit card returns a success or failure status to that API call.

The credit card processor may need some way of updating your site about this transaction later. For example, the transaction may be reversed next week. Your credit card processor could just send you an email about this. Another way of dealing with it is webhooks. You tell your credit card processor a URL on your site that they can hit and send you data. When the transaction is reversed, a credit card processor that supports web hooks will contact your site at the URL you provide and send you data in machine readable format that you can parse and have your web application deal with automatically.

A webhook is a callback mechanism for an API. You basically implement an API for asynchronous callbacks in conjunction with an API that you are calling.

  • "You basically implement an API for asynchronous callbacks..." - shouldn't that be "webhook"?
    – MrWhite
    Jan 26, 2019 at 9:30
  • 2
    I'm trying to say that a webhook is an API that you implement. You call an API. A webhook is an API that you implement so that they call you. Jan 26, 2019 at 9:50

Here's an example of the difference between webhook and API in layman's term:

Say you ordered something online and the delivery would be today but you're at work so you told your maid get the package once it arrives. The goal is, you have to be notified if the package already arrived. This is what happens in:


  • Once the package arrived, your maid will immediately call you to notify you that the package already arrived.


  • The packaged already arrived but you still don't know. You then called you're maid to ask if it already arrived, then she says yes.

The difference is in API you need a trigger to fetch data like the call you made, while webhook automatically notifies you once a new data arrives without the need of a trigger.


an Api is simply a small application which is used to gain access to certain features or data in any development platform from an already existing platform, for example: you want to use google geo-location service (already existing platform) on your website (developing platform), instead of rebuilding the whole system and getting to setup your own satellite, you use a small Api to access that feature from google.

While Web hook is simply a return or fall-back Url to your website or platform where the response and data you requested using the Api is been sent to and there you collect the information you seek.



When to Use Webhooks

​​Webhooks usually acts as a messenger for smaller data. It helps to send and extracting real-time updates.

​​One of the most suitable scenarios for using a webhook is when your app or platform requires a real-time feature and you don’t want to use an API, because you don’t want to get entangled with the setups and waste resources in the process. In such instances, a webhook framework will be most beneficial.

​​Another best use case for using a webhook is where an API isn’t provided or the available API isn’t best fit to act, a webhook could be used instead in such a situation.

​​Webhooks can be regarded as a perfect, and sometimes even essential complement to API-based application integration.

​​Here are some outlines from Agility CMS on other use cases of using a webhook:​​

​​Clearing and managing a custom cache in an external system such as a website, mobile application, or database.​​Providing a way to sync content/data for integrations with third-party systems (i.e. Salesforce, Mailchimp, etc).​​Building custom content workflows.​​Kick-off a CI/D pipeline to redeploy your website when content has been updated - this is often used for JAMstack sites that are built using static site generators.

​​​​Content Webhooks allow external applications or websites to become aware of content changes that occur within your Agility CMS instance. 

​​It works by providing a list or URL endpoints to Agility CMS. Each time content changes or is published in the CMS, Agility will notify each endpoint of the change and pass-on a message representing the exact change that occurred.

​​To get started with a webhook on Agility CMS, please follow this guide.

​​​When To Use API

​​APIs work incredibly well when you’re certain of constant incremental changes in data. Relatively stagnate data doesn’t need an API. For example, if you’re an eCommerce store that regularly has to track data or updating some shipping status, then an API would be the best bet.

​​As you know, to obtain data updates through API, you need to “call” it regularly. So, one can say that APIs are a great fit for application integration when you know you will have a constant change of data.

​​Well, APIs are still popular for several reasons:

​​Not every application supports webhook integrations.​​Sometimes you only want to know about the result, rather than every event (i.e. every permutation) that’s changed an object.​​Webhooks can only notify you about an event, so if you want to make a change based on new information, you’ll need an API.​​A webhook payload may not contain all the data you need about an event, hence an API is used.



​​Both API’s and webhooks have different use cases, but if your goal is to transfer data between two services, webhooks are the way to go. And if your platform or application would demand frequent data changes, then an API should be used.

​​You could use both APIs and webhooks together to create a system that can communicate the right types of data as it suits your application.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.