Short answer
An API is a program’s door for other software: you ask, the other system answers. A webhook is the reverse: when something happens, the other system sends a message by itself to an address you gave it. Before you buy, check the documentation for an API, authentication, rate limits and webhooks.
Picture this: a shop’s orders collect in one panel, while invoices are issued in a separate accounting program. Every evening someone looks at the new orders in the panel and types them into the accounting program again. Connecting the two programs can remove that job. Whether they can be connected comes down to two words: API and webhook. This article looks at what an API and a webhook are, and how they differ, from the point of view of a business owner deciding whether a connection is worth the investment. It explains the two ideas in plain words first, then lists what to check in the documentation before you buy and what to ask the vendor.
If you have not yet chosen which job to automate, start with the inventory in where to start with automation. We are not choosing tools here; we explain how a connection is made and where it breaks.
What is an API
The MDN glossary defines an API as a set of features and rules inside a piece of software that lets you interact with it through software rather than through a human interface. The same page compares an API to a contract between the application that offers it and third-party software.
In business terms, an API is a door a program opens to the outside, with its rules written down. The one pressing the button on screen is another program, not you. It sends a request such as “give me the orders created since the last check” or “save this invoice”, and the other system sends back an answer. What matters is the direction: with an API, the side that wants to connect starts the conversation.
What is a webhook
With a webhook the direction reverses. You define an address in the other system; when an event happens there, the other system sends that address a message carrying the details of the event. According to Stripe’s documentation, once you register a webhook endpoint (the address the message goes to), Stripe itself sends data to it when events happen, and it does so over HTTPS in a plain-text format called JSON. Shopify describes webhooks as a way to receive near-real-time data about specific events in a shop, and presents them as a more efficient option than continually asking whether anything has changed. For a short definition of the term, see the webhook entry in the glossary.
In short, with an API you say “I am asking”, and with a webhook you say “tell me when something happens”.
The same order, two ways
You can carry an order from the shop to accounting in two ways.
With an API. The program on the accounting side, or an automation tool in between, asks the shop’s API at set intervals “are there any new orders?” and writes every order in the list it gets back to accounting. How often you ask decides how late the news arrives; the answer to many of the questions is “no”.
With a webhook. You set up a subscription for the “order created” event in the shop and give the address the message should go to. The moment an order arrives, the shop sends a message to that address. Below is a simplified example of such a message (a payload); every value is invented.
{
"event": "order.created",
"order_no": "EXAMPLE-0001",
"customer": "Example Customer",
"items": [{ "sku": "EXAMPLE-SKU", "quantity": 1 }]
}
A real message carries many more fields; which ones arrive is written in the product’s documentation. The receiving side reads the message and writes the order into the accounting program.
Side by side, the difference is easier to see.
| Question | API | Webhook |
|---|---|---|
| Who starts it? | You or your tool | The other system |
| When does it run? | The moment you ask | When the event happens |
| What is it best for? | Reading, creating and updating records; pulling past data | Starting a job as soon as an event happens |
| What if it is missed? | Caught at the next question | A message that does not arrive may be retried, but not every product guarantees delivery |
Most real connections use both: the webhook says “something happened”, and the API fetches the detail and anything that was missed when needed. Shopify’s documentation likewise advises against relying on webhooks alone and suggests running a check (a reconciliation job) that pulls data through the API at intervals and brings the records on both sides into line.
You do not have to write these calls from scratch: workflow tools such as n8n, Make and Zapier offer ready-made parts for connecting to an API and receiving a webhook. We compared the three in n8n vs Make vs Zapier; whichever tool you use, if the product you connect to has no API or webhook, those ready-made parts often have nowhere to connect.
What to check in the documentation before you buy
Before you pick software or a service, open the product’s developer documentation; it is usually under “API”, “Developers” or “Integrations”. You do not need to be technical. Look for five things.
- Is there an API, and what does it cover? Not everything you do in the interface can be done through the API. Is the operation your process needs (reading orders, creating an invoice) in the list? Older programs may have no API at all; in that case other routes such as regular file transfers sometimes turn up, though not always.
- How does authentication work? In other words, how does the other system know the request comes from you? Stripe’s documentation, for example, says that at Stripe API keys authenticate requests and determine which resources the connection can reach. Can you create a separate key that grants only the permission you need, or does one key allow everything?
- Is there a rate limit? According to GitHub’s documentation, for example, the number of requests you can make to GitHub’s REST API in a given time is limited, and the limit depends on how you authenticate. You can hit it when you import past orders in one go or set up a flow that asks very often.
- Is there a webhook, and for which events? Shopify, for example, calls these event types “topics”, and there is a separate one for order creation. Are the events your process needs, such as order creation, cancellation and refund, on the list?
- A test environment and failure behaviour. Stripe’s documentation describes a test environment (a sandbox) separate from live mode; ask whether the product has one so you can try things without touching live data. The documentation should also say what the other system does when a message does not arrive; we come back to that below.
Why an API key is kept secret
An API key is your program’s identity. Whoever gets hold of it can make requests on your behalf, as far as the product allows. Stripe’s keys page draws the line clearly. There are “publishable” keys that can sit in the code sent to a visitor’s browser, which anyone can see, but a secret key has unrestricted permissions on all Stripe APIs and must not be exposed. That is why the page recommends “restricted” keys, whose permissions can be limited, for new uses. The same page recommends rotating a key when it is compromised or when an employee leaves.
In practice that means:
- Do not write a key in an email, a chat app or a spreadsheet everyone can see.
- Ask for a separate key for each connection, with as narrow permissions as possible, so that revoking one does not stop everything.
- Know whose account the key sits in. We cover account and key ownership in the first section of how to choose an automation agency.
A webhook has a secret too. Stripe writes that without verification an attacker could send fake events to your endpoint to trigger actions such as fulfilling orders, and asks you to verify each event’s signature. A signature is a code showing that the message really came from that system; at Stripe the secret value used to verify it is separate from API keys. Shopify likewise says every message arrives with a signature (an HMAC signature, in the documentation’s words) that should be verified. A setup that does not check who sends messages to the webhook address is incomplete. If you want to build a flow that receives a webhook in n8n step by step, your first n8n workflow also covers the n8n options for protecting a webhook address.
When a call fails: retries and logs
Connections break: the other system does not answer, a limit is exceeded, a message is lost on the way. What matters is knowing in advance what happens when they do.
On the API side a common case is the rate limit. In GitHub’s case, according to the documentation, exceeding the limit returns an error response with the code 403 or 429, and you are asked not to retry until the limit resets. The documentation adds that continuing to send requests while limited may get your connection banned. If a request keeps failing because of the extra limits GitHub calls “secondary”, the documentation advises increasing the wait between attempts and raising an error after a set number of tries. So resending a failed call straight away is not a fix.
On the webhook side the other system usually retries. Stripe writes that in live mode it keeps trying to deliver events for up to three days, with growing intervals. That has two consequences. First, the same event can arrive twice: Stripe advises recording the IDs of the events you have processed, and Shopify advises ignoring duplicate deliveries by checking the ID that comes with the message. To avoid invoicing an order twice, check “was this record already processed?” against a unique key such as the order number. Second, order is not guaranteed: both documents say events may not arrive in the order they were generated. Shopify also says delivery is not always guaranteed, and suggests an occasional reconciliation as a backup.
So every connection needs two things: an error alert and a log. The alert carries the news that “a step failed” to a named person. The log shows which order was not processed; without it you cannot tell who missed what. We open every flow we build with both; the details are on the automation and AI service page. There we also write that a flow has to be updated when a system you connect to changes its API, and that the monthly review tries to catch such changes.
Questions to ask the vendor
In the buying conversation, ask these questions and ask for the answers in writing:
- Which jobs done in the product’s interface can also be done through the API? Where is the list?
- How does authentication work? Can I create a separate key that grants only the permission I need?
- What is the rate limit, and what happens when it is exceeded? Does it change with the plan I use?
- Which events have a webhook? If a message does not arrive, is it retried, and for how long?
- Is there a test environment? Can I see past messages and errors on a screen?
- If the API changes, how and how far in advance do you announce it?
If you have an old accounting or ERP program and the answer is “no API”, the matter is not closed. In our process inventory we look at how the program gets data out: regular file transfers, database access or reports that arrive by email can be an entry point. If there is no reliable route, we say so openly and leave that step with a person. For the role of the API in marketplace connections, see what is marketplace integration.
Common mistakes
- Settling for “we have an API”. An existing API may not cover your operation; ask for the scope.
- Relying on the webhook alone. Not every product guarantees delivery; add an occasional check.
- Starting a bulk import without looking at the rate limit. A flow that hits the limit stops half-done.
- Creating duplicate records on retries. A flow that does not check against a unique key writes the same order twice.
- Writing a key in a shared place. If a key sits somewhere shared, you cannot keep track of who knows what when an employee leaves.
Common questions
What is the difference between an API and a webhook?
With an API, the side that wants to connect asks and the other system answers. With a webhook, the other system sends a message by itself to a pre-agreed address when an event happens. The difference is who starts the conversation.
Should I use a webhook or an API?
If you want a job to start as soon as something happens (a new order, a payment result), a webhook fits. To pull past data, create records or catch events that were missed, you need the API. Most connections use both.
What do I do if an API key leaks?
Revoke it straight away, create a new one and give the new key to the connection. Stripe’s documentation recommends revoking and replacing a compromised key. If the product keeps request logs (Stripe’s keys page says each key’s request logs can be viewed in Workbench), look at what was done with the key during the leak.
There is one thing you can do today: open the documentation of one of the two programs you want to connect and type “webhook”, “rate limit” and “authentication” into its search box. Finding a page for all three is a good sign that the product is open to the outside. If you cannot find them, send the six questions above to the vendor in writing.
Sources
This article is general information, not legal, financial or technical advice. Platforms, their rules and the law change over time, so some details may have changed since 11 November 2026 or contain small errors. Before you make a decision for your business, check the current official sources or write to us.