n8n and workflows

Connect n8n to APIs and webhooks with a clear contract

Reading time
17 minutes
Updated
Published
Topic guide
n8n automation
Written by
modernagents editorial teammodernagents is an AI automation agency from Austria for SMEs, based in the Vienna region.
AI-generated image: Junction box with two ports and an indigo lid on a black rubber mat

You want to connect n8n to APIs and webhooks so that nobody has to type new jobs from one program into the next by hand any more. Today, someone in the office may copy jobs from a portal into the scheduling system every morning. That takes time, and now and then a job appears twice or is missing altogether.

n8n is a program that carries out work steps between your other programs. A webhook in n8n receives messages from another program. An HTTP Request step, in turn, calls another program's API itself, meaning its interface for other software, for example to read data there or to enter something. For the connection to hold up in daily work, n8n checks who sends a message and whether its details are correct. Every job needs a unique, stable reference, such as the job number, and failure handling must be traceable. A working test request is not enough: a message sent twice, an unclear response or an interrupted run must not create a wrong job either.

An example: a heating and ventilation service company in Tartu with 30 employees receives its maintenance jobs from property managers through a customer portal. When a property manager approves a job there, Mart from dispatch types it into the scheduling system by hand today, where the technicians see their appointments. In future, the portal should notify n8n through a webhook. Then n8n reads the job through the portal's API and creates it in the scheduling system, and anything unclear goes to Mart.

Key takeaways

  • Write down which messages arrive with which details and which response the sender expects, before anyone builds the workflow.
  • A hard-to-guess webhook address alone does not protect the workflow well enough.
  • Decide whether a successful response to the sender means "accepted" or "done".
  • If no response comes after an attempt to write, first check in the destination program what has already happened there.

01 / 15

Webhook or API: which direction are you describing?

Many people first ask whether they need a webhook or an API. Through an API, a program offers functions or data, and n8n asks for them. With a webhook, a program sends a notification on its own to an agreed address as soon as something happens. So the two are not real opposites: a workflow can start through a webhook and then fetch complete, current data through an API.

This is how it looks at the service company in Tartu. At 9:30, a property manager approves the heating maintenance for an apartment building in the portal. The portal sends n8n the message "job approved". n8n checks whether the message really comes from the portal, reads the job through the portal's API and enters the approved job in the scheduling system. The additional read can be useful if the message contains only the job number, or if the data may have changed in the meantime, for example because the property manager moved the preferred date.

In n8n, these are two different nodes: the Webhook node receives the portal's message, and the HTTP Request node calls the portal's API itself. The n8n documentation on both nodes was checked on 26 September 2026. How the connection works in detail also always depends on the API's contract, meaning its defined rules, and on the permissions n8n has there.

02 / 15

What belongs in the interface contract before you open the editor?

Before anyone creates the first node in n8n, write down with the portal vendor what runs over the connection. This is called the interface contract. It states which kind of message arrives, the so-called event type, for example "job approved". In addition, it states which details are required, in which format they arrive (text, number or date) and which values are allowed. Add the version information of the message and the response the sender expects.

Also define which ID identifies a single delivery uniquely and which ID names the job itself. At the service company, the same maintenance job REQ-2048 can trigger several messages, first "approved" and later a change of date. Each message has its own delivery ID, while the job stays REQ-2048. So a delivery ID and a job number can serve different purposes.

Also write down what happens when a message arrives with an unknown version or an unknown event type. Suppose the portal one day sends "job cancelled", although nobody agreed on it. The fields look almost the same as for an approved job, but even so, n8n must not write anything into the scheduling system just because the fields happen to match. A clear rejection, or a visible case for Mart to clarify, is usually preferable to a silent assumption.

What such a message looks like technically is shown below under "For your IT team".

03 / 15

How do you version changes to the interface contract?

At some point, the portal vendor changes something. A new required detail, or a status that suddenly means something else, can cause errors with existing senders even though the webhook address stays the same. So agree how n8n recognises the version of a message and how long old versions remain supported. For a small internal process, a documented version number in the message may be enough. What matters is that it is clear for each version how n8n handles it.

At the service company, this could look as follows: in version 1, the portal sends a general contact address of the property manager, and version 2 also adds a verified billing recipient, meaning who should receive the invoice. If a sender still sends version 1, n8n must not act as if it had confirmed this new detail. It then processes the message under the old rule, rejects it with a traceable reason or requests the missing detail through the agreed route. n8n does not invent a billing recipient.

For each version you support, keep a few typical sample messages that someone has checked and approved. Run them again when the workflow or the portal changes. This way you see differences before real jobs hit a combination that does not fit together.

04 / 15

How do test and production webhook URLs differ?

n8n gives a webhook two addresses, one for testing and one for real operation. The test address receives messages in a controlled way while someone builds the workflow. The production address belongs to the published workflow that runs in daily work. The details are in the Webhook documentation.

In the portal, enter the address intended for each environment. Use clear names and separate credentials. Suppose the test in the editor works perfectly at the service company, but on the first real day, the portal keeps sending the messages to the test address, because nobody switched the address. A successful test in the editor does not show that the portal will later use the correct production address.

Also record who can change the settings in the portal. If, for example, this is only possible through the portal vendor's support, a finished webhook address in n8n is of little use if nobody can adjust the webhook setting in the portal during the switch, or during the restart after an outage.

If n8n runs on your own server, your IT team checks a few more points. They are listed below under "For your IT team".

05 / 15

How do you verify the webhook sender?

A hard-to-guess webhook address does not fully settle who may send something. Choose a sign-in method (authentication) that the portal supports and that fits your requirements. n8n documents several methods for this. If the portal signs its messages, meaning it adds a digital seal, your IT team must implement and test this check according to the vendor's instructions.

Limit which kinds of messages n8n accepts and how large they may be. An open webhook address must not allow arbitrary inputs to start paid models, such as AI services, or to trigger write actions in your internal programs, meaning to create, change or delete something there.

Check three things separately: whether the sender is who it claims to be, whether the details in the message are correct and whether this sender is allowed to send this job at all. A known sender can still send something that is not allowed. At the service company, a property manager could approve maintenance by mistake for a building it does not manage.

If the portal cannot use the sign-in method your IT team chose first, resolve this explicitly. Simply removing the sign-in so that the test passes changes the protection of the whole connection, and this should not end up unnoticed as a shortcut in the finished workflow.

06 / 15

What does a successful webhook response mean: receipt or completion?

When n8n receives a message, it responds to the portal. Decide what this successful response means. Does it only confirm that n8n accepted the message, or does it mean "the job is fully in the scheduling system"? The portal must understand the response the same way you do.

If processing takes longer, a quick "accepted" response with later tracking of the status may be appropriate. But this requires that n8n has reliably taken over the message before this response. Otherwise, the portal could stop resending the message even though the job gets lost after an outage.

If n8n responds synchronously, meaning the portal waits for the response in the same connection, three times must fit together: the longest run time of the workflow, possible API delays and the time the portal waits for a response. With overly long processing, the portal may send the message again while the first run is still working. So you need protection against duplicate jobs with both options.

Make visible which jobs are still open, for example through a status for each job or an agreed overview for Mart. Suppose the portal gets "accepted" back all morning, but at noon twelve jobs are missing in the scheduling system. A series of successful acknowledgements can hide a growing backlog if nobody measures how long it takes until the job is actually created.

07 / 15

How do you configure HTTP Request against the supplier's contract?

With the HTTP Request step, n8n calls another program's API itself. At the service company, it reads the job in the portal and looks up the property manager in the scheduling system. How your IT team sets up this step is described below under "For your IT team". For your business, three things matter most.

Check the status of the response and also what it contains. If n8n looks up the property manager, for example, and gets "successful" back, but with an empty list of matches, that is different from a clearly found customer. Conversely, a setting that passes on error responses like normal data must not cause n8n to mark a rejected write as done.

For lists, pay attention to pagination, because some APIs deliver a long list in several pages. A test with ten contacts can look correct, while the workflow later reads only the first page of a larger list. At the service company, this might only show up when Mart notices that n8n does not find some property managers at all.

When mapping fields, pay attention to dates and IDs, such as customer or job numbers. If leading zeros have a meaning, customer number 004711 must not become 4711. Distinguish a missing value from an explicit instruction to clear a field: if the property manager sends no phone number, n8n must not delete the existing number in the scheduling system. It is different if they explicitly removed the number. Also decide which time zone applies when n8n compares times, for example appointments. These details belong in the interface contract and are not a question of looks.

Got a workflow like this?

Tell me about it. Honest take and a rough price, usually within a day.

08 / 15

Example: process an approved service request through a webhook and API

At 9:30, the property manager approves maintenance job REQ-2048. This is how the workflow at the service company could proceed step by step:

  1. Check whether the message really comes from the portal and whether n8n may accept this kind of message.
  2. Check whether all required details are present and the version is correct.
  3. Record the delivery ID in a controlled way and detect whether the same message has arrived before.
  4. Read the current job REQ-2048 in the portal.
  5. Check again whether the job is still approved and has all the necessary data.
  6. Look in the scheduling system to see whether an entry for REQ-2048 already exists. If not, carry out the new action in a controlled way, here creating the job.
  7. Store the number the scheduling system confirms and the state reached.
  8. Make visible whether the job has been fully created or is waiting for clarification with Mart.

The order prevents several common errors. Suppose the property manager withdraws the maintenance job at 9:40, and a delayed message from 9:30 arrives only afterwards. An old message must not override an approval that was withdrawn in the meantime. Because n8n reads the current job in step 4 and checks it again in step 5, this does not happen here. Likewise, a message sent twice must not create a second job. And if n8n does not find the property manager, it must not hide this by simply taking the first match.

For each step, define how you can see that it worked. "Job created" names the job in the scheduling system with its number. "Clarification open" names the decision that is still missing and who has to make it, for example Mart. This way someone can later trace what happened without piecing together every intermediate message.

09 / 15

How do you handle idempotency, concurrency and late events?

Behind the technical terms is a simple question: what may happen only once for the same job, even if a message arrives twice, two runs work at the same time or a message arrives late? Decide this. At the service company, the job may need to be created exactly once. But if the property manager later approves a change of date, n8n may update the same job. So it is not enough to simply ignore every later message with the same job number.

Suppose the portal sends the same message twice in quick succession, and two runs start at the same time. Both search the scheduling system, both find nothing, and both create a job. The next morning, there are two maintenance visits for the same building in the plan. A simple sequence of "search, find nothing, create" can therefore write twice when two runs work at the same time. How your IT team prevents this is described below under "For your IT team".

Also check the order of changes. A delayed message from yesterday must not reset a newer confirmed state. If, for example, the property manager set the appointment to Thursday yesterday and moved it to Friday today, Friday must stay, even if the older message arrives last. A version number or a modification time from the portal can help with the decision if its meaning is reliably documented. If that is unclear, n8n must read the current state in the authoritative program, here the portal.

A single setting in an n8n node does not make sure that every job is created exactly once in business terms. That depends on how everything works together: how n8n accepts messages, where it keeps track of the state, how the scheduling system behaves and what happens during the restart after an outage. Have the important cases demonstrated for your actual setup.

10 / 15

How do you provide a controlled recovery route?

Not all failures are the same. If the scheduling system is briefly unreachable, bounded retries may be useful. Missing permissions or invalid data need a different response.

A timeout while n8n was about to write something, for example create or change a job, is different again. Suppose n8n sends the job to the scheduling system and gets no response. Maybe the job was created, maybe not. In that case, n8n first reconciles what is already in the scheduling system. If the whole run restarts without this check, the original effect can be duplicated, and the same job appears twice in the plan.

Keep a visible list of open cases with job number, state, age and next step. Mart should be able to have a case he has corrected processed again on purpose. This second run must pass the same checks against duplicate jobs and for permission as the original message.

If the portal resends a message only for a limited time, an additional reconciliation may be needed. Here n8n reads through the portal's API which jobs are approved and compares them with the scheduling system. Decide how missing messages are noticed and how far back n8n can read again. Webhooks alone do not prove that a message can never be lost.

11 / 15

Which cases belong in the failure matrix?

The failure matrix is a list of the cases you test before launch, each with the result you expect. Test these cases for an n8n webhook and API connection, shown here for the service company:

  • Normal case: the property manager approves a maintenance job.
  • Unknown sender: a program other than the portal sends a message.
  • Missing field: the message arrives without a job number.
  • Duplicate delivery: the same message arrives twice.
  • Concurrent duplicate delivery: the same message arrives twice almost at the same time.
  • Late update: yesterday's change of date arrives after today's.
  • Empty API response: the portal responds, but without data.
  • Multiple pages: the list of property managers has more than one page.

Add lost responses and an outage of the destination program, here the scheduling system.

For each case, define an expected state and an expected number of actions in the destination program, here for example jobs created in the scheduling system. If the same approval arrives twice, there is one job in the plan afterwards. Two green runs with two jobs would be an error. An unknown sender must not start paid processing. An unfamiliar schema must not lead n8n to map fields silently by guesswork.

Keep sanitised test messages and the test results for later changes, so that you can check the same contract again after an API update. Also test with as many messages and as large files as really occur at peak times, at the service company for example in autumn before the heating season. One successful request is not a load test.

12 / 15

What belongs in the operating handover of the interface?

At some point the project is finished, and the workflow runs in daily work. Then write down who owns the connection, which version is running and when credentials have to be renewed. Also record what load the connection may handle, for example how many messages in what time, what a successful response means and how you restart after an outage. In addition, watch how long it takes from the arrival of a message to the confirmed job in the scheduling system, not only how fast n8n responds. As described above, a fast acknowledgement can hide a growing processing backlog.

Decide which details may appear in logs and when stored messages are deleted. For many operating questions, the job number, status and timestamp, meaning date and time, are enough. If every alert contains the complete customer documents, this rarely helps troubleshooting enough to justify the additional access to this data.

The connection is meaningfully accepted when Mart can trace why a job is in the scheduling system the way it is, and when the person who looks after the workflow can handle a failure safely. A webhook address and an API key alone do not make a complete integration.

13 / 15

For your IT team

What does a message in the interface contract look like?

This invented payload illustrates a planning contract; it is not a real supplier endpoint:

{
  "event_id": "evt-demo-2048",
  "event_type": "service_request.approved",
  "schema_version": "1",
  "request_id": "REQ-2048",
  "approved_at": "2026-09-26T09:30:00Z"
}

event_id helps detect a repeated delivery. request_id links several messages to the same job. schema_version makes changes to the data contract visible. The example deliberately contains no complete customer data. A targeted read can fetch it from the authoritative source when needed.

Own server

If n8n runs on your own infrastructure, also check the domain, encrypted transport, the reverse proxy configuration and reachability from the actual sender. Test the route from outside with an authorised request. A local call on the server bypasses exactly the network path that must work later.

Signatures

If the vendor signs messages, establish which unmodified data goes into the check, how timestamps are handled and how a key rotation works. Checking content that has already been reformatted can fail when the vendor signs the original bytes. Do not reuse a generic signature recipe without checking the vendor's actual protocol contract.

Setting up HTTP Request

For each outbound call, record the method, URL, authentication, headers, parameters and the expected response format. Use the appropriate managed credential type for the service where it fits. Do not put production keys in examples or ordinary data fields.

The HTTP Request documentation describes the options for pagination. How continuation across several pages actually works is defined by the API in question.

Preventing duplicate jobs technically

Use the target API's documented idempotency mechanism where available. A unique processing table may also be necessary. The storage must handle concurrent access correctly, so that two executions running at the same time do not both write.

14 / 15

Take the worksheet

Worksheet

Download the editable CSV table

PropertyQuestionTest
AuthenticationHow is sender verified?Invalid credentials
SchemaRequired fields?Missing value
DeliveryCan it repeat?Duplicate event
OrderingCan it arrive late?Out-of-order update
ResponseAccepted or completed?Delayed processing
LimitsAllowed rate and size?Controlled burst

Columns to fill in, in the file: Your value / observation, Owner, Next action.

Download the editable CSV table (CSV). Add your own values, owners and open actions. This worksheet contains no measured client results.

15 / 15

These pages cover the service overview and the related decisions for n8n webhook and API integrations:

For a workflow review, start with the task, systems involved and typical exceptions. Discuss it with modernagents.

ShareEmail

Related reading

n8n automation

Got a workflow like this?

Tell me about it. Honest take and a rough price, usually within a day.

Robert Van Ysendyck · Founder & Managing Director